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

This commit is contained in:
sjplimp
2011-09-23 13:57:46 +00:00
parent 4e7b605fa1
commit 1ab03c7ee0
9 changed files with 122 additions and 39 deletions

View File

@ -1,3 +1,12 @@
Stephanie Teich-McGoldrick (Sandai) is the current maintainer
of the msi2lmp tool. She can be contacted at steichm at sandia.gov
23 Sep 2011
added support for triclinic boxes
see msi2lmp/TriclinicModification.pdf doc for details
-----------------------------
msi2lmp V3.6 4/10/2005

Binary file not shown.

View File

@ -736,8 +736,8 @@ void GetParameters(int Forcefield)
ooptypes[i].types[3]);
ooptypes[i].angleangle_params[3] = tabc;
ooptypes[i].angleangle_params[4] = tabd;
ooptypes[i].angleangle_params[5] = tcbd;
ooptypes[i].angleangle_params[4] = tcbd;
ooptypes[i].angleangle_params[5] = tabd;
k = find_angleangle_data(potential_types,ff_angang,kloc);
if (k < 0) {

View File

@ -18,7 +18,7 @@ OBJS = $(SRCS:.c=.o)
HEADERS = Msi2LMP2.h Forcefield.h
CC = gcc
CFLAGS = -O2
CFLAGS = -O3
FRCFILE = cvff.frc
FRCFILE2 = cff91.frc
README = README

View File

@ -61,6 +61,8 @@
#define MAX_CONNECTIONS 6
#define MAX_STRING 50
struct ResidueList {
int start;
int end;
@ -168,6 +170,8 @@ _EX char rootname[20];
_EX char path[20];
_EX double pbc[9];
_EX int periodic _ARG( 1 ); /* 0= nonperiodic 1= 3-D periodic */
// Added triclinic flag for non-orthogonal boxes Oct 5, 2010 SLTM
_EX int TriclinicFlag; // 1 for non-orthoganal boxes, 0 for orthogonal boxes
_EX int forcefield _ARG( 0 ); /* 0= ClassI 1= ClassII */
_EX int pflag;
_EX int *no_atoms;

View File

@ -12,6 +12,13 @@ void ReadCarFile(void)
int skip; /* lines to skip at beginning of file */
double lowest, highest; /* temp coordinate finding variables */
double total_q;
double sq_c;
double cos_alpha; // Added by SLTM Sept 13, 2010
double cos_gamma;
double sin_gamma;
double cos_beta;
double sin_beta;
double A, B, C;
/* Open .car file for reading */
@ -39,10 +46,12 @@ void ReadCarFile(void)
fgets(line,MAX_LINE_LENGTH,CarF); /* Date stamp */
fscanf(CarF,"%*s %lf %lf %lf %lf %lf %lf %*s",
&pbc[0],&pbc[1],&pbc[2],&pbc[3],&pbc[4],&pbc[5]);
if(pbc[3] != 90.0 || pbc[4] != 90.0 || pbc[5] != 90.0) {
fprintf(stderr,"The system is not rectangular- LAMMPS can't handle it!!");
exit(2);
// Added triclinic flag for non-orthogonal boxes Oct 5, 2010 SLTM
if(pbc[3] != 90.0 || pbc[4] != 90.0 || pbc[5] != 90.0) {
TriclinicFlag = 1;
}
else TriclinicFlag = 0;
}
else {
periodic = 0;
@ -142,23 +151,59 @@ void ReadCarFile(void)
/* Search coordinates to find lowest and highest for x, y, and z */
if (periodic == 0) {
for ( k = 0; k < 3; k++) {
lowest = atoms[0].x[k];
highest = atoms[0].x[k];
// Added if/else statment STLM Oct 5 2010
if (TriclinicFlag == 0)
{
for ( k = 0; k < 3; k++) {
lowest = atoms[0].x[k];
highest = atoms[0].x[k];
for ( m = 1; m < total_no_atoms; m++) {
if (atoms[m].x[k] < lowest) lowest = atoms[m].x[k];
if (atoms[m].x[k] > highest) highest = atoms[m].x[k];
for ( m = 1; m < total_no_atoms; m++) {
if (atoms[m].x[k] < lowest) lowest = atoms[m].x[k];
if (atoms[m].x[k] > highest) highest = atoms[m].x[k];
}
pbc[k] = lowest;
pbc[k+3] = highest;
}
pbc[k] = lowest;
pbc[k+3] = highest;
}
}
else {
printf("Code only works for periodic systems with triclinic boxes");
exit(2);
}
}
else {
for (k=0; k < 3; k++) {
pbc[k+3] = pbc[k];
pbc[k] = 0.0;
}
// Modified lines 176 - 201 Oct 5th 2010
if (TriclinicFlag == 0) {
for (k=0; k < 3; k++) {
pbc[k+3] = pbc[k];
pbc[k] = 0.0;
}
}
else {
sq_c = pbc[2]*pbc[2];
cos_alpha = cos(pbc[3]*3.14159265358979323846/180.0);
cos_gamma = cos(pbc[5]*3.14159265358979323846/180.0);
sin_gamma = sin(pbc[5]*3.14159265358979323846/180.0);
cos_beta = cos(pbc[4]*3.14159265358979323846/180.0);
sin_beta = sin(pbc[4]*3.14159265358979323846/180.0);
printf("pbc[3] %lf pbc[4] %lf pbc[5] %lf\n", pbc[3] ,pbc[4] ,pbc[5]);
printf("cos_alpha %lf cos_beta %lf cos_gamma %lf\n", cos_alpha ,cos_beta ,cos_gamma);
A = pbc[0];
B = pbc[1];
C = pbc[2];
pbc[0] = A;
pbc[1] = B*sin_gamma;
pbc[2] = sqrt(sq_c * sin_beta*sin_beta - C*(cos_alpha-cos_gamma*cos_beta)/sin_gamma);
pbc[3] = B * cos_gamma; // This is xy SLTM
pbc[4] = C * cos_beta; // This is xz SLTM
pbc[5] = C*(cos_alpha-cos_gamma*cos_beta)/sin_gamma; // This is yz SLTM
}
}
/* Close .car file */

View File

@ -37,11 +37,14 @@ void WriteDataFile(FILE *DatF,char *nameroot,int forcefield)
if (no_oop_types > 0)
fprintf (DatF, " %3d improper types\n", no_oop_types);
}
fprintf(DatF, "\n");
fprintf(DatF, " %15.9f %15.9f xlo xhi\n", pbc[0], pbc[3]);
fprintf(DatF, " %15.9f %15.9f ylo yhi\n", pbc[1], pbc[4]);
fprintf(DatF, " %15.9f %15.9f zlo zhi\n", pbc[2], pbc[5]);
fprintf(DatF, " %15.9f %15.9f xlo xhi\n", 0.0, pbc[0]);
fprintf(DatF, " %15.9f %15.9f ylo yhi\n", 0.0, pbc[1]);
fprintf(DatF, " %15.9f %15.9f zlo zhi\n", 0.0, pbc[2]);
fprintf(DatF, " %15.9f %15.9f %15.9f xy xz yz\n", pbc[3], pbc[4], pbc[5]);
/* MASSES */

View File

@ -49,12 +49,25 @@ void WriteDataFile05(char *nameroot,int forcefield)
if (no_oop_types > 0)
fprintf (DatF, " %3d improper types\n", no_oop_types);
}
fprintf(DatF, "\n");
fprintf(DatF, " %15.9f %15.9f xlo xhi\n", pbc[0], pbc[3]);
fprintf(DatF, " %15.9f %15.9f ylo yhi\n", pbc[1], pbc[4]);
fprintf(DatF, " %15.9f %15.9f zlo zhi\n", pbc[2], pbc[5]);
// Modified by SLTM to print out triclinic box types 10/05/10 - lines 56-68
if (TriclinicFlag == 0) {
fprintf(DatF, "\n");
fprintf(DatF, " %15.9f %15.9f xlo xhi\n", pbc[0], pbc[3]);
fprintf(DatF, " %15.9f %15.9f ylo yhi\n", pbc[1], pbc[4]);
fprintf(DatF, " %15.9f %15.9f zlo zhi\n", pbc[2], pbc[5]);
}
else {
fprintf(DatF, "\n");
fprintf(DatF, " %15.9f %15.9f xlo xhi\n", 0.0, pbc[0]);
fprintf(DatF, " %15.9f %15.9f ylo yhi\n", 0.0, pbc[1]);
fprintf(DatF, " %15.9f %15.9f zlo zhi\n", 0.0, pbc[2]);
fprintf(DatF, " %15.9f %15.9f %15.9f xy xz yz\n", pbc[3], pbc[4], pbc[5]);
}
/* MASSES */
@ -113,7 +126,10 @@ void WriteDataFile05(char *nameroot,int forcefield)
for (i=0; i < no_dihedral_types; i++) {
fprintf(DatF, "%3i ", i+1);
for ( j = 0; j < m; j++)
fprintf(DatF, "%10.4f ", dihedraltypes[i].params[j]);
// Modified on 10/05/2010 by STLM to match with lammps reading in integers for the all but the first coefficients
if (j == 0)
fprintf(DatF, "%10.4f ", dihedraltypes[i].params[j]);
else fprintf(DatF, "%10.0f ", dihedraltypes[i].params[j]);
fprintf(DatF,"\n");
}
fprintf(DatF, "\n");
@ -124,7 +140,10 @@ void WriteDataFile05(char *nameroot,int forcefield)
for (i=0; i < no_oop_types; i++) {
fprintf(DatF, "%3i ", i+1);
for ( j = 0; j < 3; j++)
fprintf(DatF, "%10.4f ", ooptypes[i].params[j]);
// Modified on 10/05/2010 by STLM to match with lammps reading in integers for the all but the first coefficients
if (j == 0)
fprintf(DatF, "%10.4f ", ooptypes[i].params[j]);
else fprintf(DatF, "%10.0f ", ooptypes[i].params[j]);
fprintf(DatF, "\n");
}
fprintf(DatF, "\n");

View File

@ -131,7 +131,7 @@ int main (int argc, char *argv[])
extern void CheckLists();
extern void WriteDataFile(FILE *,char *,int);
outv = 2005;
pflag = 1;
forcefield = 1; /* Variable that identifies forcefield to use */
@ -140,9 +140,9 @@ int main (int argc, char *argv[])
frc_dir_name = (char *) calloc(160,sizeof(char));
frc_dir_name = getenv("BIOSYM_LIBRARY");
if (frc_dir_name == NULL) {
frc_file_name = strcpy(frc_file_name,"./cvff.frc");
frc_file_name = strcpy(frc_file_name,"../biosym_frc_files/clayff.frc");
}
else {
for (i=0; i < strlen(frc_dir_name); i++)
@ -150,12 +150,14 @@ int main (int argc, char *argv[])
frc_file_name = strcat(frc_file_name,"/cvff.frc");
}
if (argc < 2) { /* If no rootname was supplied, prompt for it */
fprintf(stderr,"The rootname of the .car and .mdf files must be entered\n");
}
else /* rootname was supplied as first argument, copy to rootname */
sprintf(rootname,"%s",argv[1]);
n = 2;
while (n < argc) {
if (strcmp(argv[n],"-class") == 0) {
@ -223,20 +225,21 @@ int main (int argc, char *argv[])
}
/* Read in .car file */
printf("I am before read car file\n");
ReadCarFile();
printf("I am after read car file\n");
/*Read in .mdf file */
ReadMdfFile();
printf("I am after read mdf file\n");
/* Define bonds, angles, etc...*/
if (pflag > 0) fprintf(stderr,"\n Building internal coordinate lists \n");
MakeLists();
/* Read .frc file into memory */
// Commented out to create conversion file suitable for non-orthogonal boxes Sept 13, 2010 SLTM
if (pflag > 0) fprintf(stderr,"\n Reading forcefield file \n");
ReadFrcFile();