git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11643 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2014-03-19 18:26:56 +00:00
parent 760ea47603
commit 544bf593c5
4 changed files with 142 additions and 73 deletions

View File

@ -1,5 +1,23 @@
Stephanie Teich-McGoldrick (Sandai) is the current maintainer
of the msi2lmp tool. She can be contacted at steichm at sandia.gov
Axel Kohlmeyer is the current maintainer of the msi2lmp tool.
Please send any inquiries about msi2lmp to the lammps-users mailing list.
06 Mar 2014 Axel Kohlmeyer <akohlmey@gmail.com>
Fixed a bug in handling of triclinic cells, where the matrices to
convert to and from fractional coordinates were incorrectly built.
26 Oct 2013 Axel Kohlmeyer <akohlmey@gmail.com>
Implemented writing out force field style hints in generated data
files for improved consistency checking when reading those files.
Also added writing out CGCMM style comments to identify atom types.
08 Oct 2013 Axel Kohlmeyer <akohlmey@gmail.com>
Fixed a memory access violation with Class 2 force fields.
Free all allocated memory to better detection of memory errors.
Print out version number and data with all print levels > 0.
Added valgrind checks to the regression tests
08 Oct 2013 Axel Kohlmeyer <akohlmey@gmail.com>
@ -99,6 +117,9 @@ see msi2lmp/TriclinicModification.pdf doc for details
geometrical center of the provided geometry but
rather around the origin
-- -oldstyle (or -o) write out a data file without style hints
(to be compatible with older LAMMPS versions)
-- -shift (or -s) translate the entire system (box and coordinates)
by a vector (default: 0.0 0.0 0.0)

View File

@ -83,7 +83,14 @@ void WriteDataFile(char *nameroot)
/* COEFFICIENTS */
fprintf(DatF,"Pair Coeffs\n\n");
fputs("Pair Coeffs",DatF);
if (hintflag) {
if (forcefield & (FF_TYPE_CLASS1|FF_TYPE_OPLSAA))
fputs(" # lj/cut/coul/long\n\n",DatF);
else if (forcefield & FF_TYPE_CLASS2)
fputs(" # lj/class2/coul/long\n\n",DatF);
} else fputs("\n\n",DatF);
for (i=0; i < no_atom_types; i++) {
fprintf(DatF, " %3i ", i+1);
for ( j = 0; j < 2; j++)
@ -98,7 +105,14 @@ void WriteDataFile(char *nameroot)
if (forcefield & FF_TYPE_OPLSAA) m = 2;
if (forcefield & FF_TYPE_CLASS2) m = 4;
fprintf(DatF,"Bond Coeffs\n\n");
fputs("Bond Coeffs",DatF);
if (hintflag) {
if (forcefield & (FF_TYPE_CLASS1|FF_TYPE_OPLSAA))
fputs(" # harmonic\n\n",DatF);
else if (forcefield & FF_TYPE_CLASS2)
fputs(" # class2\n\n",DatF);
} else fputs("\n\n",DatF);
for (i=0; i < no_bond_types; i++) {
fprintf(DatF, "%3i ", i+1);
for ( j = 0; j < m; j++)
@ -114,7 +128,14 @@ void WriteDataFile(char *nameroot)
if (forcefield & FF_TYPE_OPLSAA) m = 2;
if (forcefield & FF_TYPE_CLASS2) m = 4;
fprintf(DatF,"Angle Coeffs\n\n");
fputs("Angle Coeffs",DatF);
if (hintflag) {
if (forcefield & (FF_TYPE_CLASS1|FF_TYPE_OPLSAA))
fputs(" # harmonic\n\n",DatF);
else if (forcefield & FF_TYPE_CLASS2)
fputs(" # class2\n\n",DatF);
} else fputs("\n\n",DatF);
for (i=0; i < no_angle_types; i++) {
fprintf(DatF, "%3i ", i+1);
for ( j = 0; j < m; j++)
@ -127,81 +148,91 @@ void WriteDataFile(char *nameroot)
if (no_dihedral_types > 0) {
if (forcefield & FF_TYPE_CLASS1) {
fputs("Dihedral Coeffs",DatF);
if (forcefield & FF_TYPE_CLASS1) {
fprintf(DatF,"Dihedral Coeffs\n\n");
if (hintflag) fputs(" # harmonic\n\n",DatF);
else fputs("\n\n",DatF);
for (i=0; i < no_dihedral_types; i++)
fprintf(DatF, "%3i %10.4f %3i %3i\n", i+1,
dihedraltypes[i].params[0],
(int) dihedraltypes[i].params[1],
(int) dihedraltypes[i].params[2]);
for (i=0; i < no_dihedral_types; i++)
fprintf(DatF, "%3i %10.4f %3i %3i\n", i+1,
dihedraltypes[i].params[0],
(int) dihedraltypes[i].params[1],
(int) dihedraltypes[i].params[2]);
} else if (forcefield & FF_TYPE_OPLSAA) {
} else if (forcefield & FF_TYPE_OPLSAA) {
fprintf(DatF,"Dihedral Coeffs\n\n");
if (hintflag) fputs(" # opls\n\n",DatF);
else fputs("\n\n",DatF);
for (i=0; i < no_dihedral_types; i++) {
fprintf(DatF, "%3i",i+1);
for ( j = 0; j < 4; j++)
fprintf(DatF, " %10.4f",dihedraltypes[i].params[j]);
for (i=0; i < no_dihedral_types; i++) {
fprintf(DatF, "%3i",i+1);
for ( j = 0; j < 4; j++)
fprintf(DatF, " %10.4f",dihedraltypes[i].params[j]);
fputs("\n",DatF);
fputs("\n",DatF);
}
} else if (forcefield & FF_TYPE_CLASS2) {
if (hintflag) fputs(" # class2\n\n",DatF);
else fputs("\n\n",DatF);
for (i=0; i < no_dihedral_types; i++) {
fprintf(DatF, "%3i",i+1);
for ( j = 0; j < 6; j++)
fprintf(DatF, " %10.4f",dihedraltypes[i].params[j]);
fputs("\n",DatF);
}
}
} else if (forcefield & FF_TYPE_CLASS2) {
fprintf(DatF,"Dihedral Coeffs\n\n");
for (i=0; i < no_dihedral_types; i++) {
fprintf(DatF, "%3i",i+1);
for ( j = 0; j < 6; j++)
fprintf(DatF, " %10.4f",dihedraltypes[i].params[j]);
fputs("\n",DatF);
}
}
fputs("\n",DatF);
fputs("\n",DatF);
}
if (forcefield & FF_TYPE_CLASS1) {
if (no_oop_types > 0) {
/* cvff improper coeffs are: type K0 d n */
fprintf(DatF,"Improper Coeffs\n\n");
for (i=0; i < no_oop_types; i++) {
fprintf(DatF,"%5i %10.4f %3i %3i\n",i+1,
ooptypes[i].params[0], (int) ooptypes[i].params[1],
(int) ooptypes[i].params[2]);
if (no_oop_types > 0) {
/* cvff improper coeffs are: type K0 d n */
if (hintflag) fputs("Improper Coeffs # cvff\n\n",DatF);
else fputs("Improper Coeffs\n\n",DatF);
for (i=0; i < no_oop_types; i++) {
fprintf(DatF,"%5i %10.4f %3i %3i\n",i+1,
ooptypes[i].params[0], (int) ooptypes[i].params[1],
(int) ooptypes[i].params[2]);
}
fputs("\n",DatF);
}
fputs("\n",DatF);
}
} else if (forcefield & FF_TYPE_OPLSAA) {
if (no_oop_types > 0) {
/* opls improper coeffs are like cvff: type K0 d(=-1) n(=2) */
fprintf(DatF,"Improper Coeffs\n\n");
for (i=0; i < no_oop_types; i++) {
fprintf(DatF,"%5i %10.4f %3i %3i\n",i+1,
ooptypes[i].params[0], (int) ooptypes[i].params[1],
(int) ooptypes[i].params[2]);
if (no_oop_types > 0) {
/* opls improper coeffs are like cvff: type K0 d(=-1) n(=2) */
if (hintflag) fputs("Improper Coeffs # cvff\n\n",DatF);
else fputs("Improper Coeffs\n\n",DatF);
for (i=0; i < no_oop_types; i++) {
fprintf(DatF,"%5i %10.4f %3i %3i\n",i+1,
ooptypes[i].params[0], (int) ooptypes[i].params[1],
(int) ooptypes[i].params[2]);
}
fputs("\n",DatF);
}
fputs("\n",DatF);
}
} else if (forcefield & FF_TYPE_CLASS2) {
if ((no_oop_types + no_angleangle_types) > 0) {
fprintf(DatF,"Improper Coeffs\n\n");
for (i=0; i < no_oop_types; i++) {
fprintf(DatF, "%3i ", i+1);
for ( j = 0; j < 2; j++)
fprintf(DatF, "%10.4f ", ooptypes[i].params[j]);
fputs("\n",DatF);
if ((no_oop_types + no_angleangle_types) > 0) {
if (hintflag) fputs("Improper Coeffs # class2\n\n",DatF);
else fputs("Improper Coeffs\n\n",DatF);
for (i=0; i < no_oop_types; i++) {
fprintf(DatF, "%3i ", i+1);
for ( j = 0; j < 2; j++)
fprintf(DatF, "%10.4f ", ooptypes[i].params[j]);
fputs("\n",DatF);
}
for (i=0; i < no_angleangle_types; i++) {
fprintf(DatF, "%3i ", i+no_oop_types+1);
for ( j = 0; j < 2; j++)
fprintf(DatF, "%10.4f ", 0.0);
fputs("\n",DatF);
}
fputs("\n",DatF);
}
for (i=0; i < no_angleangle_types; i++) {
fprintf(DatF, "%3i ", i+no_oop_types+1);
for ( j = 0; j < 2; j++)
fprintf(DatF, "%10.4f ", 0.0);
fputs("\n",DatF);
}
fputs("\n",DatF);
}
}
if (forcefield & FF_TYPE_CLASS2) {
@ -302,19 +333,23 @@ void WriteDataFile(char *nameroot)
/* ATOMS */
fprintf(DatF, "Atoms\n\n");
if (hintflag) fputs("Atoms # full\n\n",DatF);
else fputs("Atoms\n\n",DatF);
for(k=0; k < total_no_atoms; k++) {
fprintf(DatF, " %6i %6i %3i %9.6f %15.9f %15.9f %15.9f %3i %3i %3i\n",
int typ = atoms[k].type;
fprintf(DatF," %6i %6i %3i %9.6f %15.9f %15.9f %15.9f %3i %3i %3i # %s\n",
k+1,
atoms[k].molecule,
atoms[k].type+1,
typ+1,
atoms[k].q,
atoms[k].x[0],
atoms[k].x[1],
atoms[k].x[2],
atoms[k].image[0],
atoms[k].image[1],
atoms[k].image[2]);
atoms[k].image[2],
atomtypes[typ].potential);
}
fputs("\n",DatF);

View File

@ -2,6 +2,8 @@
*
* msi2lmp.exe
*
* v3.9.4 AK- Make force field style hints optional with a flag
*
* v3.9.3 AK- Bugfix for triclinic cells.
*
* v3.9.2 AK- Support for writing out force field style hints
@ -51,7 +53,7 @@
* The program is started by supplying information at the command prompt
* according to the usage described below.
*
* USAGE: msi2lmp3 ROOTNAME {-print #} {-class #} {-frc FRC_FILE} {-ignore} {-nocenter}
* USAGE: msi2lmp3 ROOTNAME {-print #} {-class #} {-frc FRC_FILE} {-ignore} {-nocenter} {-oldstyle}
*
* -- msi2lmp3 is the name of the executable
* -- ROOTNAME is the base name of the .car and .mdf files
@ -73,6 +75,9 @@
* -- -nocenter - tells msi2lmp to not center the box around the (geometrical)
* center of the atoms, but around the origin
*
* -- -oldstyle - tells msi2lmp to write out a data file without style hints
* (to be compatible with older LAMMPS versions)
*
* -- -shift - tells msi2lmp to shift the entire system (box and coordinates)
* by a vector (default: 0.0 0.0 0.0)
*
@ -148,6 +153,7 @@ int periodic = 1;
int TriclinicFlag = 0;
int forcefield = 0;
int centerflag = 1;
int hintflag = 1;
int pflag;
int iflag;
@ -219,7 +225,7 @@ int main (int argc, char *argv[])
frc_dir_name = getenv("MSI2LMP_LIBRARY");
if (argc < 2) {
printf("usage: %s <rootname> [-class <I|1|II|2>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter]\n",argv[0]);
printf("usage: %s <rootname> [-class <I|1|II|2>] [-frc <path to frc file>] [-print #] [-ignore] [-nocenter] [-oldstyle]\n",argv[0]);
return 1;
} else { /* rootname was supplied as first argument, copy to rootname */
int len = strlen(argv[1]) + 1;
@ -258,8 +264,10 @@ int main (int argc, char *argv[])
shift[2] = atof(argv[++n]);
} else if (strncmp(argv[n],"-i",2) == 0 ) {
iflag = 1;
} else if (strncmp(argv[n],"-n",2) == 0 ) {
} else if (strncmp(argv[n],"-n",4) == 0 ) {
centerflag = 0;
} else if (strncmp(argv[n],"-o",4) == 0 ) {
hintflag = 0;
} else if (strncmp(argv[n],"-p",2) == 0) {
n++;
if (check_arg(argv,"-print",n,argc))
@ -333,6 +341,10 @@ int main (int argc, char *argv[])
if (forcefield & FF_TYPE_CLASS2) puts(" Forcefield: Class II");
if (forcefield & FF_TYPE_OPLSAA) puts(" Forcefield: OPLS-AA");
printf(" Forcefield file name: %s\n",FrcFileName);
if (centerflag) puts(" Output is recentered around geometrical center");
if (hintflag) puts(" Output contains style flag hints");
else puts(" Style flag hints disabled");
printf(" System translated by: %g %g %g\n",shift[0],shift[1],shift[2]);
}
n = 0;

View File

@ -36,7 +36,7 @@
# include <stdio.h>
#define MSI2LMP_VERSION "v3.9.3 / 07 Mar 2014"
#define MSI2LMP_VERSION "v3.9.4 / 11 Mar 2014"
#define PI_180 0.01745329251994329576
@ -171,6 +171,7 @@ extern int TriclinicFlag; /* 0= Orthogonal 1= Triclinic */
extern int forcefield; /* BitMask: the value FF_TYPE_COMMON is set for common components of the options below,
* FF_TYPE_CLASS1 = ClassI, FF_TYPE_CLASS2 = ClassII, FF_TYPE_OPLSAA = OPLS-AA*/
extern int centerflag; /* 1= center box 0= keep box */
extern int hintflag; /* 1= print style hint comments 0= no hints */
extern int pflag; /* print level: 0, 1, 2, 3 */
extern int iflag; /* 0 stop at errors 1 = ignore errors */
extern int *no_atoms;