99 |
|
return NULL; |
100 |
|
} |
101 |
|
|
102 |
+ |
void printMe( void ){ |
103 |
+ |
|
104 |
+ |
std::cerr << "LinkedAtype " << name << ": ident = " << ident << "\n"; |
105 |
+ |
if( next != NULL ) next->printMe(); |
106 |
+ |
|
107 |
+ |
} |
108 |
+ |
|
109 |
|
void add( atomStruct &info ){ |
110 |
|
|
111 |
|
// check for duplicates |
121 |
|
|
122 |
|
if( next != NULL ) next->add(info); |
123 |
|
else{ |
124 |
< |
next = new LinkedType(); |
124 |
> |
next = new LinkedAtomType(); |
125 |
|
strcpy(next->name, info.name); |
126 |
|
next->isDipole = info.isDipole; |
127 |
|
next->isSSD = info.isSSD; |
147 |
|
info.dipole = dipole; |
148 |
|
info.w0 = w0; |
149 |
|
info.v0 = v0; |
150 |
+ |
info.ident = ident; |
151 |
|
info.last = 0; |
152 |
|
} |
153 |
|
|
205 |
|
|
206 |
|
if( next != NULL ) next->add(info); |
207 |
|
else{ |
208 |
< |
next = new LinkedType(); |
208 |
> |
next = new LinkedBondType(); |
209 |
|
strcpy(next->nameA, info.nameA); |
210 |
|
strcpy(next->nameB, info.nameB); |
211 |
|
strcpy(next->type, info.type); |
274 |
|
|
275 |
|
if( next != NULL ) next->add(info); |
276 |
|
else{ |
277 |
< |
next = new LinkedType(); |
277 |
> |
next = new LinkedBendType(); |
278 |
|
strcpy(next->nameA, info.nameA); |
279 |
|
strcpy(next->nameB, info.nameB); |
280 |
|
strcpy(next->nameC, info.nameC); |
358 |
|
|
359 |
|
if( next != NULL ) next->add(info); |
360 |
|
else{ |
361 |
< |
next = new LinkedType(); |
361 |
> |
next = new LinkedTorsionType(); |
362 |
|
strcpy(next->nameA, info.nameA); |
363 |
|
strcpy(next->nameB, info.nameB); |
364 |
|
strcpy(next->nameC, info.nameC); |
629 |
|
|
630 |
|
void TraPPE_ExFF::readParams( void ){ |
631 |
|
|
632 |
< |
int i; |
632 |
> |
int i, a, b, c, d; |
633 |
|
int identNum; |
634 |
+ |
char* atomA; |
635 |
+ |
char* atomB; |
636 |
+ |
char* atomC; |
637 |
+ |
char* atomD; |
638 |
|
|
639 |
|
atomStruct atomInfo; |
640 |
|
bondStruct bondInfo; |
641 |
|
bendStruct bendInfo; |
642 |
|
torsionStruct torsionInfo; |
643 |
|
|
644 |
< |
|
644 |
> |
bigSigma = 0.0; |
645 |
> |
|
646 |
|
atomInfo.last = 1; |
647 |
|
bondInfo.last = 1; |
648 |
|
bendInfo.last = 1; |
728 |
|
|
729 |
|
MPIcheckPoint(); |
730 |
|
|
731 |
< |
headAtomType = new LinkedType; |
731 |
> |
headAtomType = new LinkedAtomType; |
732 |
|
recieveFrcStruct( &atomInfo, mpiAtomStructType ); |
733 |
|
|
734 |
|
while( !atomInfo.last ){ |
742 |
|
recieveFrcStruct( &atomInfo, mpiAtomStructType ); |
743 |
|
} |
744 |
|
} |
745 |
+ |
|
746 |
|
#endif // is_mpi |
747 |
|
|
748 |
+ |
|
749 |
+ |
|
750 |
|
// call new A_types in fortran |
751 |
|
|
752 |
|
int isError; |
803 |
|
|
804 |
|
|
805 |
|
// read in the bonds |
790 |
– |
|
806 |
|
|
807 |
< |
|
808 |
< |
|
809 |
< |
} |
807 |
> |
#ifdef IS_MPI |
808 |
> |
if( worldRank == 0 ){ |
809 |
> |
#endif |
810 |
> |
|
811 |
> |
// read in the bond types. |
812 |
> |
|
813 |
> |
headBondType = new LinkedBondType; |
814 |
> |
|
815 |
> |
fastForward( "BondTypes", "initializeBonds" ); |
816 |
|
|
817 |
+ |
// we are now at the bondTypes section |
818 |
|
|
819 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
820 |
+ |
lineNum++; |
821 |
+ |
|
822 |
+ |
|
823 |
+ |
// read a line, and start parseing out the atom types |
824 |
|
|
825 |
< |
void TraPPE_ExFF::initializeAtoms( void ){ |
826 |
< |
|
825 |
> |
if( eof_test == NULL ){ |
826 |
> |
sprintf( painCave.errMsg, |
827 |
> |
"Error in reading bonds from force file at line %d.\n", |
828 |
> |
lineNum ); |
829 |
> |
painCave.isFatal = 1; |
830 |
> |
simError(); |
831 |
> |
} |
832 |
> |
|
833 |
> |
// stop reading at end of file, or at next section |
834 |
> |
while( readLine[0] != '#' && eof_test != NULL ){ |
835 |
> |
|
836 |
> |
// toss comment lines |
837 |
> |
if( readLine[0] != '!' ){ |
838 |
> |
|
839 |
> |
// the parser returns 0 if the line was blank |
840 |
> |
if( parseBond( readLine, lineNum, bondInfo ) ){ |
841 |
> |
headBondType->add( bondInfo ); |
842 |
> |
} |
843 |
> |
} |
844 |
> |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
845 |
> |
lineNum++; |
846 |
> |
} |
847 |
> |
|
848 |
> |
#ifdef IS_MPI |
849 |
> |
|
850 |
> |
// send out the linked list to all the other processes |
851 |
> |
|
852 |
> |
sprintf( checkPointMsg, |
853 |
> |
"TraPPE_Ex bond structures read successfully." ); |
854 |
> |
MPIcheckPoint(); |
855 |
> |
|
856 |
> |
currentBondType = headBondType->next; |
857 |
> |
while( currentBondType != NULL ){ |
858 |
> |
currentBondType->duplicate( bondInfo ); |
859 |
> |
sendFrcStruct( &bondInfo, mpiBondStructType ); |
860 |
> |
currentBondType = currentBondType->next; |
861 |
> |
} |
862 |
> |
bondInfo.last = 1; |
863 |
> |
sendFrcStruct( &bondInfo, mpiBondStructType ); |
864 |
> |
|
865 |
> |
} |
866 |
|
|
867 |
+ |
else{ |
868 |
+ |
|
869 |
+ |
// listen for node 0 to send out the force params |
870 |
+ |
|
871 |
+ |
MPIcheckPoint(); |
872 |
+ |
|
873 |
+ |
headBondType = new LinkedBondType; |
874 |
+ |
recieveFrcStruct( &bondInfo, mpiBondStructType ); |
875 |
+ |
while( !bondInfo.last ){ |
876 |
+ |
|
877 |
+ |
headBondType->add( bondInfo ); |
878 |
+ |
recieveFrcStruct( &bondInfo, mpiBondStructType ); |
879 |
+ |
} |
880 |
+ |
} |
881 |
+ |
#endif // is_mpi |
882 |
|
|
883 |
+ |
|
884 |
+ |
// read in the bends |
885 |
+ |
|
886 |
+ |
#ifdef IS_MPI |
887 |
+ |
if( worldRank == 0 ){ |
888 |
+ |
#endif |
889 |
+ |
|
890 |
+ |
// read in the bend types. |
891 |
+ |
|
892 |
+ |
headBendType = new LinkedBendType; |
893 |
+ |
|
894 |
+ |
fastForward( "BendTypes", "initializeBends" ); |
895 |
+ |
|
896 |
+ |
// we are now at the bendTypes section |
897 |
+ |
|
898 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
899 |
+ |
lineNum++; |
900 |
+ |
|
901 |
+ |
// read a line, and start parseing out the bend types |
902 |
+ |
|
903 |
+ |
if( eof_test == NULL ){ |
904 |
+ |
sprintf( painCave.errMsg, |
905 |
+ |
"Error in reading bends from force file at line %d.\n", |
906 |
+ |
lineNum ); |
907 |
+ |
painCave.isFatal = 1; |
908 |
+ |
simError(); |
909 |
+ |
} |
910 |
+ |
|
911 |
+ |
// stop reading at end of file, or at next section |
912 |
+ |
while( readLine[0] != '#' && eof_test != NULL ){ |
913 |
+ |
|
914 |
+ |
// toss comment lines |
915 |
+ |
if( readLine[0] != '!' ){ |
916 |
+ |
|
917 |
+ |
// the parser returns 0 if the line was blank |
918 |
+ |
if( parseBend( readLine, lineNum, bendInfo ) ){ |
919 |
+ |
headBendType->add( bendInfo ); |
920 |
+ |
} |
921 |
+ |
} |
922 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
923 |
+ |
lineNum++; |
924 |
+ |
} |
925 |
+ |
|
926 |
+ |
#ifdef IS_MPI |
927 |
+ |
|
928 |
+ |
// send out the linked list to all the other processes |
929 |
+ |
|
930 |
+ |
sprintf( checkPointMsg, |
931 |
+ |
"TraPPE_Ex bend structures read successfully." ); |
932 |
+ |
MPIcheckPoint(); |
933 |
+ |
|
934 |
+ |
currentBendType = headBendType->next; |
935 |
+ |
while( currentBendType != NULL ){ |
936 |
+ |
currentBendType->duplicate( bendInfo ); |
937 |
+ |
sendFrcStruct( &bendInfo, mpiBendStructType ); |
938 |
+ |
currentBendType = currentBendType->next; |
939 |
+ |
} |
940 |
+ |
bendInfo.last = 1; |
941 |
+ |
sendFrcStruct( &bendInfo, mpiBendStructType ); |
942 |
+ |
|
943 |
+ |
} |
944 |
|
|
945 |
+ |
else{ |
946 |
+ |
|
947 |
+ |
// listen for node 0 to send out the force params |
948 |
+ |
|
949 |
+ |
MPIcheckPoint(); |
950 |
|
|
951 |
+ |
headBendType = new LinkedBendType; |
952 |
+ |
recieveFrcStruct( &bendInfo, mpiBendStructType ); |
953 |
+ |
while( !bendInfo.last ){ |
954 |
+ |
|
955 |
+ |
headBendType->add( bendInfo ); |
956 |
+ |
recieveFrcStruct( &bendInfo, mpiBendStructType ); |
957 |
+ |
} |
958 |
+ |
} |
959 |
+ |
#endif // is_mpi |
960 |
+ |
|
961 |
+ |
|
962 |
+ |
// read in the torsions |
963 |
+ |
|
964 |
+ |
#ifdef IS_MPI |
965 |
+ |
if( worldRank == 0 ){ |
966 |
+ |
#endif |
967 |
+ |
|
968 |
+ |
// read in the torsion types. |
969 |
+ |
|
970 |
+ |
headTorsionType = new LinkedTorsionType; |
971 |
+ |
|
972 |
+ |
fastForward( "TorsionTypes", "initializeTorsions" ); |
973 |
+ |
|
974 |
+ |
// we are now at the torsionTypes section |
975 |
+ |
|
976 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
977 |
+ |
lineNum++; |
978 |
+ |
|
979 |
+ |
|
980 |
+ |
// read a line, and start parseing out the atom types |
981 |
+ |
|
982 |
+ |
if( eof_test == NULL ){ |
983 |
+ |
sprintf( painCave.errMsg, |
984 |
+ |
"Error in reading torsions from force file at line %d.\n", |
985 |
+ |
lineNum ); |
986 |
+ |
painCave.isFatal = 1; |
987 |
+ |
simError(); |
988 |
+ |
} |
989 |
+ |
|
990 |
+ |
// stop reading at end of file, or at next section |
991 |
+ |
while( readLine[0] != '#' && eof_test != NULL ){ |
992 |
+ |
|
993 |
+ |
// toss comment lines |
994 |
+ |
if( readLine[0] != '!' ){ |
995 |
+ |
|
996 |
+ |
// the parser returns 0 if the line was blank |
997 |
+ |
if( parseTorsion( readLine, lineNum, torsionInfo ) ){ |
998 |
+ |
headTorsionType->add( torsionInfo ); |
999 |
+ |
|
1000 |
+ |
} |
1001 |
+ |
} |
1002 |
+ |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
1003 |
+ |
lineNum++; |
1004 |
+ |
} |
1005 |
+ |
|
1006 |
+ |
#ifdef IS_MPI |
1007 |
+ |
|
1008 |
+ |
// send out the linked list to all the other processes |
1009 |
+ |
|
1010 |
+ |
sprintf( checkPointMsg, |
1011 |
+ |
"TraPPE_Ex torsion structures read successfully." ); |
1012 |
+ |
MPIcheckPoint(); |
1013 |
+ |
|
1014 |
+ |
currentTorsionType = headTorsionType->next; |
1015 |
+ |
while( currentTorsionType != NULL ){ |
1016 |
+ |
currentTorsionType->duplicate( torsionInfo ); |
1017 |
+ |
sendFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1018 |
+ |
currentTorsionType = currentTorsionType->next; |
1019 |
+ |
} |
1020 |
+ |
torsionInfo.last = 1; |
1021 |
+ |
sendFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1022 |
+ |
|
1023 |
+ |
} |
1024 |
+ |
|
1025 |
+ |
else{ |
1026 |
+ |
|
1027 |
+ |
// listen for node 0 to send out the force params |
1028 |
+ |
|
1029 |
+ |
MPIcheckPoint(); |
1030 |
+ |
|
1031 |
+ |
headTorsionType = new LinkedTorsionType; |
1032 |
+ |
recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1033 |
+ |
while( !torsionInfo.last ){ |
1034 |
+ |
|
1035 |
+ |
headTorsionType->add( torsionInfo ); |
1036 |
+ |
recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1037 |
+ |
} |
1038 |
+ |
} |
1039 |
+ |
#endif // is_mpi |
1040 |
+ |
|
1041 |
+ |
entry_plug->useLJ = 1; |
1042 |
+ |
} |
1043 |
+ |
|
1044 |
+ |
|
1045 |
+ |
|
1046 |
+ |
void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
1047 |
|
|
805 |
– |
Atom** the_atoms; |
806 |
– |
int nAtoms; |
807 |
– |
the_atoms = entry_plug->atoms; |
808 |
– |
nAtoms = entry_plug->n_atoms; |
1048 |
|
|
1049 |
|
////////////////////////////////////////////////// |
1050 |
|
// a quick water fix |
1076 |
|
headI[2][1] = 0.0; |
1077 |
|
headI[2][2] = 250; |
1078 |
|
|
840 |
– |
|
841 |
– |
|
1079 |
|
////////////////////////////////////////////////// |
1080 |
|
|
844 |
– |
|
845 |
– |
|
1081 |
|
|
1082 |
|
// initialize the atoms |
1083 |
|
|
849 |
– |
double bigSigma = 0.0; |
1084 |
|
DirectionalAtom* dAtom; |
1085 |
|
|
1086 |
< |
for( i=0; i<nAtoms; i++ ){ |
1086 |
> |
for(int i=0; i<nAtoms; i++ ){ |
1087 |
|
|
854 |
– |
|
1088 |
|
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
1089 |
|
if( currentAtomType == NULL ){ |
1090 |
|
sprintf( painCave.errMsg, |
1150 |
|
} |
1151 |
|
} |
1152 |
|
} |
920 |
– |
|
921 |
– |
#ifdef IS_MPI |
922 |
– |
double tempBig = bigSigma; |
923 |
– |
MPI::COMM_WORLD.Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX ); |
924 |
– |
#endif //is_mpi |
925 |
– |
|
926 |
– |
//calc rCut and rList |
927 |
– |
|
928 |
– |
entry_plug->rCut = 2.5 * bigSigma; |
929 |
– |
|
930 |
– |
if(entry_plug->rCut > (entry_plug->box_x / 2.0)) |
931 |
– |
entry_plug->rCut = entry_plug->box_x / 2.0; |
932 |
– |
|
933 |
– |
if(entry_plug->rCut > (entry_plug->box_y / 2.0)) |
934 |
– |
entry_plug->rCut = entry_plug->box_y / 2.0; |
935 |
– |
|
936 |
– |
if(entry_plug->rCut > (entry_plug->box_z / 2.0)) |
937 |
– |
entry_plug->rCut = entry_plug->box_z / 2.0; |
938 |
– |
|
939 |
– |
entry_plug->rList = entry_plug->rCut + 1.0; |
940 |
– |
|
941 |
– |
entry_plug->useLJ = 1; // use Lennard Jones is on by default |
942 |
– |
|
943 |
– |
// clean up the memory |
944 |
– |
|
945 |
– |
delete headAtomType; |
946 |
– |
|
947 |
– |
#ifdef IS_MPI |
948 |
– |
sprintf( checkPointMsg, "TraPPE_Ex atoms initialized succesfully" ); |
949 |
– |
MPIcheckPoint(); |
950 |
– |
#endif // is_mpi |
951 |
– |
|
1153 |
|
} |
1154 |
|
|
1155 |
< |
void TraPPE_ExFF::initializeBonds( bond_pair* the_bonds ){ |
1155 |
> |
void TraPPE_ExFF::initializeBonds( int nBonds, Bond** bondArray, |
1156 |
> |
bond_pair* the_bonds ){ |
1157 |
> |
int i,a,b; |
1158 |
> |
char* atomA; |
1159 |
> |
char* atomB; |
1160 |
|
|
956 |
– |
|
957 |
– |
|
958 |
– |
|
959 |
– |
|
960 |
– |
|
961 |
– |
|
962 |
– |
info.last = 1; // initialize last to have the last set. |
963 |
– |
// if things go well, last will be set to 0 |
964 |
– |
|
965 |
– |
SRI **the_sris; |
1161 |
|
Atom** the_atoms; |
967 |
– |
int nBonds; |
968 |
– |
the_sris = entry_plug->sr_interactions; |
1162 |
|
the_atoms = entry_plug->atoms; |
970 |
– |
nBonds = entry_plug->n_bonds; |
971 |
– |
|
972 |
– |
int i, a, b; |
973 |
– |
char* atomA; |
974 |
– |
char* atomB; |
1163 |
|
|
976 |
– |
#ifdef IS_MPI |
977 |
– |
if( worldRank == 0 ){ |
978 |
– |
#endif |
979 |
– |
|
980 |
– |
// read in the bond types. |
981 |
– |
|
982 |
– |
headBondType = new LinkedType; |
983 |
– |
|
984 |
– |
fastForward( "BondTypes", "initializeBonds" ); |
1164 |
|
|
986 |
– |
// we are now at the bondTypes section |
987 |
– |
|
988 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
989 |
– |
lineNum++; |
990 |
– |
|
991 |
– |
|
992 |
– |
// read a line, and start parseing out the atom types |
993 |
– |
|
994 |
– |
if( eof_test == NULL ){ |
995 |
– |
sprintf( painCave.errMsg, |
996 |
– |
"Error in reading bonds from force file at line %d.\n", |
997 |
– |
lineNum ); |
998 |
– |
painCave.isFatal = 1; |
999 |
– |
simError(); |
1000 |
– |
} |
1001 |
– |
|
1002 |
– |
// stop reading at end of file, or at next section |
1003 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
1004 |
– |
|
1005 |
– |
// toss comment lines |
1006 |
– |
if( readLine[0] != '!' ){ |
1007 |
– |
|
1008 |
– |
// the parser returns 0 if the line was blank |
1009 |
– |
if( parseBond( readLine, lineNum, info ) ){ |
1010 |
– |
headBondType->add( info ); |
1011 |
– |
} |
1012 |
– |
} |
1013 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
1014 |
– |
lineNum++; |
1015 |
– |
} |
1016 |
– |
|
1017 |
– |
#ifdef IS_MPI |
1018 |
– |
|
1019 |
– |
// send out the linked list to all the other processes |
1020 |
– |
|
1021 |
– |
sprintf( checkPointMsg, |
1022 |
– |
"TraPPE_Ex bond structures read successfully." ); |
1023 |
– |
MPIcheckPoint(); |
1024 |
– |
|
1025 |
– |
currentBondType = headBondType; |
1026 |
– |
while( currentBondType != NULL ){ |
1027 |
– |
currentBondType->duplicate( info ); |
1028 |
– |
sendFrcStruct( &info, mpiBondStructType ); |
1029 |
– |
currentBondType = currentBondType->next; |
1030 |
– |
} |
1031 |
– |
info.last = 1; |
1032 |
– |
sendFrcStruct( &info, mpiBondStructType ); |
1033 |
– |
|
1034 |
– |
} |
1035 |
– |
|
1036 |
– |
else{ |
1037 |
– |
|
1038 |
– |
// listen for node 0 to send out the force params |
1039 |
– |
|
1040 |
– |
MPIcheckPoint(); |
1041 |
– |
|
1042 |
– |
headBondType = new LinkedType; |
1043 |
– |
recieveFrcStruct( &info, mpiBondStructType ); |
1044 |
– |
while( !info.last ){ |
1045 |
– |
|
1046 |
– |
headBondType->add( info ); |
1047 |
– |
recieveFrcStruct( &info, mpiBondStructType ); |
1048 |
– |
} |
1049 |
– |
} |
1050 |
– |
#endif // is_mpi |
1051 |
– |
|
1052 |
– |
|
1165 |
|
// initialize the Bonds |
1166 |
|
|
1055 |
– |
|
1167 |
|
for( i=0; i<nBonds; i++ ){ |
1168 |
|
|
1169 |
|
a = the_bonds[i].a; |
1182 |
|
|
1183 |
|
if( !strcmp( currentBondType->type, "fixed" ) ){ |
1184 |
|
|
1185 |
< |
the_sris[i] = new ConstrainedBond( *the_atoms[a], |
1186 |
< |
*the_atoms[b], |
1187 |
< |
currentBondType->d0 ); |
1185 |
> |
bondArray[i] = new ConstrainedBond( *the_atoms[a], |
1186 |
> |
*the_atoms[b], |
1187 |
> |
currentBondType->d0 ); |
1188 |
|
entry_plug->n_constraints++; |
1189 |
|
} |
1190 |
|
} |
1080 |
– |
|
1081 |
– |
|
1082 |
– |
// clean up the memory |
1083 |
– |
|
1084 |
– |
delete headBondType; |
1085 |
– |
|
1086 |
– |
#ifdef IS_MPI |
1087 |
– |
sprintf( checkPointMsg, "TraPPE_Ex bonds initialized succesfully" ); |
1088 |
– |
MPIcheckPoint(); |
1089 |
– |
#endif // is_mpi |
1090 |
– |
|
1191 |
|
} |
1192 |
|
|
1193 |
< |
void TraPPE_ExFF::initializeBends( bend_set* the_bends ){ |
1193 |
> |
void TraPPE_ExFF::initializeBends( int nBends, Bend** bendArray, |
1194 |
> |
bend_set* the_bends ){ |
1195 |
|
|
1095 |
– |
|
1096 |
– |
|
1097 |
– |
|
1098 |
– |
bendStruct info; |
1099 |
– |
info.last = 1; // initialize last to have the last set. |
1100 |
– |
// if things go well, last will be set to 0 |
1101 |
– |
|
1196 |
|
QuadraticBend* qBend; |
1197 |
|
GhostBend* gBend; |
1104 |
– |
SRI **the_sris; |
1198 |
|
Atom** the_atoms; |
1106 |
– |
int nBends; |
1107 |
– |
the_sris = entry_plug->sr_interactions; |
1199 |
|
the_atoms = entry_plug->atoms; |
1200 |
< |
nBends = entry_plug->n_bends; |
1110 |
< |
|
1200 |
> |
|
1201 |
|
int i, a, b, c; |
1202 |
|
char* atomA; |
1203 |
|
char* atomB; |
1204 |
|
char* atomC; |
1115 |
– |
|
1116 |
– |
|
1117 |
– |
#ifdef IS_MPI |
1118 |
– |
if( worldRank == 0 ){ |
1119 |
– |
#endif |
1120 |
– |
|
1121 |
– |
// read in the bend types. |
1122 |
– |
|
1123 |
– |
headBendType = new LinkedType; |
1124 |
– |
|
1125 |
– |
fastForward( "BendTypes", "initializeBends" ); |
1126 |
– |
|
1127 |
– |
// we are now at the bendTypes section |
1128 |
– |
|
1129 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
1130 |
– |
lineNum++; |
1131 |
– |
|
1132 |
– |
// read a line, and start parseing out the bend types |
1133 |
– |
|
1134 |
– |
if( eof_test == NULL ){ |
1135 |
– |
sprintf( painCave.errMsg, |
1136 |
– |
"Error in reading bends from force file at line %d.\n", |
1137 |
– |
lineNum ); |
1138 |
– |
painCave.isFatal = 1; |
1139 |
– |
simError(); |
1140 |
– |
} |
1141 |
– |
|
1142 |
– |
// stop reading at end of file, or at next section |
1143 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
1144 |
– |
|
1145 |
– |
// toss comment lines |
1146 |
– |
if( readLine[0] != '!' ){ |
1147 |
– |
|
1148 |
– |
// the parser returns 0 if the line was blank |
1149 |
– |
if( parseBend( readLine, lineNum, info ) ){ |
1150 |
– |
headBendType->add( info ); |
1151 |
– |
} |
1152 |
– |
} |
1153 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
1154 |
– |
lineNum++; |
1155 |
– |
} |
1156 |
– |
|
1157 |
– |
#ifdef IS_MPI |
1158 |
– |
|
1159 |
– |
// send out the linked list to all the other processes |
1160 |
– |
|
1161 |
– |
sprintf( checkPointMsg, |
1162 |
– |
"TraPPE_Ex bend structures read successfully." ); |
1163 |
– |
MPIcheckPoint(); |
1164 |
– |
|
1165 |
– |
currentBendType = headBendType; |
1166 |
– |
while( currentBendType != NULL ){ |
1167 |
– |
currentBendType->duplicate( info ); |
1168 |
– |
sendFrcStruct( &info, mpiBendStructType ); |
1169 |
– |
currentBendType = currentBendType->next; |
1170 |
– |
} |
1171 |
– |
info.last = 1; |
1172 |
– |
sendFrcStruct( &info, mpiBendStructType ); |
1173 |
– |
|
1174 |
– |
} |
1175 |
– |
|
1176 |
– |
else{ |
1177 |
– |
|
1178 |
– |
// listen for node 0 to send out the force params |
1179 |
– |
|
1180 |
– |
MPIcheckPoint(); |
1181 |
– |
|
1182 |
– |
headBendType = new LinkedType; |
1183 |
– |
recieveFrcStruct( &info, mpiBendStructType ); |
1184 |
– |
while( !info.last ){ |
1185 |
– |
|
1186 |
– |
headBendType->add( info ); |
1187 |
– |
recieveFrcStruct( &info, mpiBendStructType ); |
1188 |
– |
} |
1189 |
– |
} |
1190 |
– |
#endif // is_mpi |
1205 |
|
|
1206 |
|
// initialize the Bends |
1193 |
– |
|
1194 |
– |
int index; |
1207 |
|
|
1208 |
|
for( i=0; i<nBends; i++ ){ |
1209 |
|
|
1228 |
|
|
1229 |
|
if( !strcmp( currentBendType->type, "quadratic" ) ){ |
1230 |
|
|
1219 |
– |
index = i + entry_plug->n_bonds; |
1220 |
– |
|
1231 |
|
if( the_bends[i].isGhost){ |
1232 |
|
|
1233 |
|
if( the_bends[i].ghost == b ){ |
1255 |
|
currentBendType->k2, |
1256 |
|
currentBendType->k3, |
1257 |
|
currentBendType->t0 ); |
1258 |
< |
the_sris[index] = gBend; |
1258 |
> |
bendArray[i] = gBend; |
1259 |
|
} |
1260 |
|
else{ |
1261 |
|
qBend = new QuadraticBend( *the_atoms[a], |
1265 |
|
currentBendType->k2, |
1266 |
|
currentBendType->k3, |
1267 |
|
currentBendType->t0 ); |
1268 |
< |
the_sris[index] = qBend; |
1268 |
> |
bendArray[i] = qBend; |
1269 |
|
} |
1270 |
|
} |
1271 |
|
} |
1262 |
– |
|
1263 |
– |
|
1264 |
– |
// clean up the memory |
1265 |
– |
|
1266 |
– |
delete headBendType; |
1267 |
– |
|
1268 |
– |
#ifdef IS_MPI |
1269 |
– |
sprintf( checkPointMsg, "TraPPE_Ex bends initialized succesfully" ); |
1270 |
– |
MPIcheckPoint(); |
1271 |
– |
#endif // is_mpi |
1272 |
– |
|
1272 |
|
} |
1273 |
|
|
1274 |
< |
void TraPPE_ExFF::initializeTorsions( torsion_set* the_torsions ){ |
1274 |
> |
void TraPPE_ExFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
1275 |
> |
torsion_set* the_torsions ){ |
1276 |
|
|
1277 |
< |
|
1278 |
< |
|
1279 |
< |
|
1280 |
< |
torsionStruct info; |
1281 |
< |
info.last = 1; // initialize last to have the last set. |
1282 |
< |
// if things go well, last will be set to 0 |
1283 |
< |
|
1284 |
< |
int i, a, b, c, d, index; |
1277 |
> |
int i, a, b, c, d; |
1278 |
|
char* atomA; |
1279 |
|
char* atomB; |
1280 |
|
char* atomC; |
1281 |
|
char* atomD; |
1289 |
– |
CubicTorsion* cTors; |
1282 |
|
|
1283 |
< |
SRI **the_sris; |
1283 |
> |
CubicTorsion* cTors; |
1284 |
|
Atom** the_atoms; |
1293 |
– |
int nTorsions; |
1294 |
– |
the_sris = entry_plug->sr_interactions; |
1285 |
|
the_atoms = entry_plug->atoms; |
1296 |
– |
nTorsions = entry_plug->n_torsions; |
1286 |
|
|
1298 |
– |
#ifdef IS_MPI |
1299 |
– |
if( worldRank == 0 ){ |
1300 |
– |
#endif |
1301 |
– |
|
1302 |
– |
// read in the torsion types. |
1303 |
– |
|
1304 |
– |
headTorsionType = new LinkedType; |
1305 |
– |
|
1306 |
– |
fastForward( "TorsionTypes", "initializeTorsions" ); |
1307 |
– |
|
1308 |
– |
// we are now at the torsionTypes section |
1309 |
– |
|
1310 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
1311 |
– |
lineNum++; |
1312 |
– |
|
1313 |
– |
|
1314 |
– |
// read a line, and start parseing out the atom types |
1315 |
– |
|
1316 |
– |
if( eof_test == NULL ){ |
1317 |
– |
sprintf( painCave.errMsg, |
1318 |
– |
"Error in reading torsions from force file at line %d.\n", |
1319 |
– |
lineNum ); |
1320 |
– |
painCave.isFatal = 1; |
1321 |
– |
simError(); |
1322 |
– |
} |
1323 |
– |
|
1324 |
– |
// stop reading at end of file, or at next section |
1325 |
– |
while( readLine[0] != '#' && eof_test != NULL ){ |
1326 |
– |
|
1327 |
– |
// toss comment lines |
1328 |
– |
if( readLine[0] != '!' ){ |
1329 |
– |
|
1330 |
– |
// the parser returns 0 if the line was blank |
1331 |
– |
if( parseTorsion( readLine, lineNum, info ) ){ |
1332 |
– |
headTorsionType->add( info ); |
1333 |
– |
|
1334 |
– |
} |
1335 |
– |
} |
1336 |
– |
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
1337 |
– |
lineNum++; |
1338 |
– |
} |
1339 |
– |
|
1340 |
– |
#ifdef IS_MPI |
1341 |
– |
|
1342 |
– |
// send out the linked list to all the other processes |
1343 |
– |
|
1344 |
– |
sprintf( checkPointMsg, |
1345 |
– |
"TraPPE_Ex torsion structures read successfully." ); |
1346 |
– |
MPIcheckPoint(); |
1347 |
– |
|
1348 |
– |
currentTorsionType = headTorsionType; |
1349 |
– |
while( currentTorsionType != NULL ){ |
1350 |
– |
currentTorsionType->duplicate( info ); |
1351 |
– |
sendFrcStruct( &info, mpiTorsionStructType ); |
1352 |
– |
currentTorsionType = currentTorsionType->next; |
1353 |
– |
} |
1354 |
– |
info.last = 1; |
1355 |
– |
sendFrcStruct( &info, mpiTorsionStructType ); |
1356 |
– |
|
1357 |
– |
} |
1358 |
– |
|
1359 |
– |
else{ |
1360 |
– |
|
1361 |
– |
// listen for node 0 to send out the force params |
1362 |
– |
|
1363 |
– |
MPIcheckPoint(); |
1364 |
– |
|
1365 |
– |
headTorsionType = new LinkedType; |
1366 |
– |
recieveFrcStruct( &info, mpiTorsionStructType ); |
1367 |
– |
while( !info.last ){ |
1368 |
– |
|
1369 |
– |
headTorsionType->add( info ); |
1370 |
– |
recieveFrcStruct( &info, mpiTorsionStructType ); |
1371 |
– |
} |
1372 |
– |
} |
1373 |
– |
#endif // is_mpi |
1374 |
– |
|
1287 |
|
// initialize the Torsions |
1288 |
|
|
1289 |
|
for( i=0; i<nTorsions; i++ ){ |
1308 |
|
} |
1309 |
|
|
1310 |
|
if( !strcmp( currentTorsionType->type, "cubic" ) ){ |
1399 |
– |
index = i + entry_plug->n_bonds + entry_plug->n_bends; |
1311 |
|
|
1312 |
|
cTors = new CubicTorsion( *the_atoms[a], *the_atoms[b], |
1313 |
|
*the_atoms[c], *the_atoms[d] ); |
1314 |
|
cTors->setConstants( currentTorsionType->k1, currentTorsionType->k2, |
1315 |
|
currentTorsionType->k3, currentTorsionType->k4 ); |
1316 |
< |
the_sris[index] = cTors; |
1316 |
> |
torsionArray[i] = cTors; |
1317 |
|
} |
1318 |
|
} |
1408 |
– |
|
1409 |
– |
|
1410 |
– |
// clean up the memory |
1411 |
– |
|
1412 |
– |
delete headTorsionType; |
1413 |
– |
|
1414 |
– |
#ifdef IS_MPI |
1415 |
– |
sprintf( checkPointMsg, "TraPPE_Ex torsions initialized succesfully" ); |
1416 |
– |
MPIcheckPoint(); |
1417 |
– |
#endif // is_mpi |
1418 |
– |
|
1319 |
|
} |
1320 |
|
|
1321 |
|
void TraPPE_ExFF::fastForward( char* stopText, char* searchOwner ){ |