15 |
|
#include "mpiForceField.h" |
16 |
|
#endif // is_mpi |
17 |
|
|
18 |
+ |
|
19 |
+ |
// define some bond Types |
20 |
+ |
|
21 |
+ |
#define FIXED_BOND 0 |
22 |
+ |
#define HARMONIC_BOND 1 |
23 |
+ |
|
24 |
+ |
|
25 |
|
namespace TPE { // restrict the access of the folowing to this file only. |
26 |
|
|
27 |
|
|
46 |
|
typedef struct{ |
47 |
|
char nameA[15]; |
48 |
|
char nameB[15]; |
42 |
– |
char type[30]; |
49 |
|
double d0; |
50 |
+ |
double k0; |
51 |
|
int last; // 0 -> default |
52 |
|
// 1 -> tells nodes to stop listening |
53 |
+ |
int type; |
54 |
|
} bondStruct; |
55 |
|
|
56 |
|
|
119 |
|
|
120 |
|
if( !strcmp( info.name, name ) ){ |
121 |
|
sprintf( painCave.errMsg, |
122 |
< |
"Duplicate TraPPE_Ex atom type \"%s\" found in " |
123 |
< |
"the TraPPE_ExFF param file./n", |
122 |
> |
"Duplicate DUFF atom type \"%s\" found in " |
123 |
> |
"the DUFF param file./n", |
124 |
|
name ); |
125 |
|
painCave.isFatal = 1; |
126 |
|
simError(); |
180 |
|
next = NULL; |
181 |
|
nameA[0] = '\0'; |
182 |
|
nameB[0] = '\0'; |
175 |
– |
type[0] = '\0'; |
183 |
|
} |
184 |
|
~LinkedBondType(){ if( next != NULL ) delete next; } |
185 |
|
|
201 |
|
|
202 |
|
if(dup){ |
203 |
|
sprintf( painCave.errMsg, |
204 |
< |
"Duplicate TraPPE_Ex bond type \"%s - %s\" found in " |
205 |
< |
"the TraPPE_ExFF param file./n", |
204 |
> |
"Duplicate DUFF bond type \"%s - %s\" found in " |
205 |
> |
"the DUFF param file./n", |
206 |
|
nameA, nameB ); |
207 |
|
painCave.isFatal = 1; |
208 |
|
simError(); |
214 |
|
next = new LinkedBondType(); |
215 |
|
strcpy(next->nameA, info.nameA); |
216 |
|
strcpy(next->nameB, info.nameB); |
217 |
< |
strcpy(next->type, info.type); |
217 |
> |
next->type = info.type; |
218 |
|
next->d0 = info.d0; |
219 |
+ |
next->k0 = info.k0; |
220 |
|
} |
221 |
|
} |
222 |
|
|
224 |
|
void duplicate( bondStruct &info ){ |
225 |
|
strcpy(info.nameA, nameA); |
226 |
|
strcpy(info.nameB, nameB); |
227 |
< |
strcpy(info.type, type); |
227 |
> |
info.type = type; |
228 |
|
info.d0 = d0; |
229 |
+ |
info.k0 = k0; |
230 |
|
info.last = 0; |
231 |
|
} |
232 |
|
|
235 |
|
|
236 |
|
char nameA[15]; |
237 |
|
char nameB[15]; |
238 |
< |
char type[30]; |
238 |
> |
int type; |
239 |
|
double d0; |
240 |
+ |
double k0; |
241 |
|
|
242 |
|
LinkedBondType* next; |
243 |
|
}; |
274 |
|
|
275 |
|
if(dup){ |
276 |
|
sprintf( painCave.errMsg, |
277 |
< |
"Duplicate TraPPE_Ex bend type \"%s - %s - %s\" found in " |
278 |
< |
"the TraPPE_ExFF param file./n", |
277 |
> |
"Duplicate DUFF bend type \"%s - %s - %s\" found in " |
278 |
> |
"the DUFF param file./n", |
279 |
|
nameA, nameB, nameC ); |
280 |
|
painCave.isFatal = 1; |
281 |
|
simError(); |
359 |
|
|
360 |
|
if(dup){ |
361 |
|
sprintf( painCave.errMsg, |
362 |
< |
"Duplicate TraPPE_Ex torsion type \"%s - %s - %s - %s\" found in " |
363 |
< |
"the TraPPE_ExFF param file./n", nameA, nameB, nameC, nameD ); |
362 |
> |
"Duplicate DUFF torsion type \"%s - %s - %s - %s\" found in " |
363 |
> |
"the DUFF param file./n", nameA, nameB, nameC, nameD ); |
364 |
|
painCave.isFatal = 1; |
365 |
|
simError(); |
366 |
|
} |
428 |
|
//**************************************************************** |
429 |
|
|
430 |
|
|
431 |
< |
TraPPE_ExFF::TraPPE_ExFF(){ |
431 |
> |
DUFF::DUFF(){ |
432 |
|
|
433 |
|
char fileName[200]; |
434 |
|
char* ffPath_env = "FORCE_PARAM_PATH"; |
478 |
|
// Init the bondStruct mpi type |
479 |
|
|
480 |
|
bondStruct bondProto; // mpiPrototype |
481 |
< |
int bondBC[3] = {60,1,1}; // block counts |
481 |
> |
int bondBC[3] = {30,2,2}; // block counts |
482 |
|
MPI_Aint bondDspls[3]; // displacements |
483 |
|
MPI_Datatype bondMbrTypes[3]; // member mpi types |
484 |
|
|
547 |
|
|
548 |
|
// generate the force file name |
549 |
|
|
550 |
< |
strcpy( fileName, "TraPPE_Ex.frc" ); |
550 |
> |
strcpy( fileName, "DUFF.frc" ); |
551 |
|
// fprintf( stderr,"Trying to open %s\n", fileName ); |
552 |
|
|
553 |
|
// attempt to open the file in the current directory first. |
586 |
|
#ifdef IS_MPI |
587 |
|
} |
588 |
|
|
589 |
< |
sprintf( checkPointMsg, "TraPPE_ExFF file opened sucessfully." ); |
589 |
> |
sprintf( checkPointMsg, "DUFF file opened sucessfully." ); |
590 |
|
MPIcheckPoint(); |
591 |
|
|
592 |
|
#endif // is_mpi |
593 |
|
} |
594 |
|
|
595 |
|
|
596 |
< |
TraPPE_ExFF::~TraPPE_ExFF(){ |
596 |
> |
DUFF::~DUFF(){ |
597 |
|
|
598 |
|
if( headAtomType != NULL ) delete headAtomType; |
599 |
|
if( headBondType != NULL ) delete headBondType; |
611 |
|
#endif // is_mpi |
612 |
|
} |
613 |
|
|
614 |
< |
void TraPPE_ExFF::cleanMe( void ){ |
614 |
> |
void DUFF::cleanMe( void ){ |
615 |
|
|
616 |
|
#ifdef IS_MPI |
617 |
|
|
630 |
|
} |
631 |
|
|
632 |
|
|
633 |
< |
void TraPPE_ExFF::initForceField( int ljMixRule ){ |
633 |
> |
void DUFF::initForceField( int ljMixRule ){ |
634 |
|
|
635 |
|
initFortran( ljMixRule, entry_plug->useReactionField ); |
636 |
|
} |
637 |
|
|
638 |
|
|
639 |
< |
void TraPPE_ExFF::readParams( void ){ |
639 |
> |
void DUFF::readParams( void ){ |
640 |
|
|
641 |
|
int i, a, b, c, d; |
642 |
|
int identNum; |
708 |
|
// send out the linked list to all the other processes |
709 |
|
|
710 |
|
sprintf( checkPointMsg, |
711 |
< |
"TraPPE_ExFF atom structures read successfully." ); |
711 |
> |
"DUFF atom structures read successfully." ); |
712 |
|
MPIcheckPoint(); |
713 |
|
|
714 |
|
currentAtomType = headAtomType->next; //skip the first element who is a place holder. |
720 |
|
sendFrcStruct( &atomInfo, mpiAtomStructType ); |
721 |
|
|
722 |
|
sprintf( checkPointMsg, |
723 |
< |
"successfully sent TraPPE_Ex force type: \"%s\"\n", |
723 |
> |
"successfully sent DUFF force type: \"%s\"\n", |
724 |
|
atomInfo.name ); |
725 |
|
MPIcheckPoint(); |
726 |
|
|
800 |
|
|
801 |
|
#ifdef IS_MPI |
802 |
|
sprintf( checkPointMsg, |
803 |
< |
"TraPPE_ExFF atom structures successfully sent to fortran\n" ); |
803 |
> |
"DUFF atom structures successfully sent to fortran\n" ); |
804 |
|
MPIcheckPoint(); |
805 |
|
#endif // is_mpi |
806 |
|
|
854 |
|
// send out the linked list to all the other processes |
855 |
|
|
856 |
|
sprintf( checkPointMsg, |
857 |
< |
"TraPPE_Ex bond structures read successfully." ); |
857 |
> |
"DUFF bond structures read successfully." ); |
858 |
|
MPIcheckPoint(); |
859 |
|
|
860 |
|
currentBondType = headBondType->next; |
884 |
|
} |
885 |
|
|
886 |
|
sprintf( checkPointMsg, |
887 |
< |
"TraPPE_ExFF bond structures broadcast successfully." ); |
887 |
> |
"DUFF bond structures broadcast successfully." ); |
888 |
|
MPIcheckPoint(); |
889 |
|
|
890 |
|
#endif // is_mpi |
937 |
|
// send out the linked list to all the other processes |
938 |
|
|
939 |
|
sprintf( checkPointMsg, |
940 |
< |
"TraPPE_Ex bend structures read successfully." ); |
940 |
> |
"DUFF bend structures read successfully." ); |
941 |
|
MPIcheckPoint(); |
942 |
|
|
943 |
|
currentBendType = headBendType->next; |
967 |
|
} |
968 |
|
|
969 |
|
sprintf( checkPointMsg, |
970 |
< |
"TraPPE_ExFF bend structures broadcast successfully." ); |
970 |
> |
"DUFF bend structures broadcast successfully." ); |
971 |
|
MPIcheckPoint(); |
972 |
|
|
973 |
|
#endif // is_mpi |
1022 |
|
// send out the linked list to all the other processes |
1023 |
|
|
1024 |
|
sprintf( checkPointMsg, |
1025 |
< |
"TraPPE_Ex torsion structures read successfully." ); |
1025 |
> |
"DUFF torsion structures read successfully." ); |
1026 |
|
MPIcheckPoint(); |
1027 |
|
|
1028 |
|
currentTorsionType = headTorsionType->next; |
1052 |
|
} |
1053 |
|
|
1054 |
|
sprintf( checkPointMsg, |
1055 |
< |
"TraPPE_ExFF torsion structures broadcast successfully." ); |
1055 |
> |
"DUFF torsion structures broadcast successfully." ); |
1056 |
|
MPIcheckPoint(); |
1057 |
|
|
1058 |
|
#endif // is_mpi |
1062 |
|
|
1063 |
|
|
1064 |
|
|
1065 |
< |
void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
1065 |
> |
void DUFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
1066 |
|
|
1067 |
|
|
1068 |
|
////////////////////////////////////////////////// |
1151 |
|
else{ |
1152 |
|
|
1153 |
|
sprintf( painCave.errMsg, |
1154 |
< |
"TraPPE_ExFF error: Atom \"%s\" is a dipole, yet no standard" |
1154 |
> |
"DUFF error: Atom \"%s\" is a dipole, yet no standard" |
1155 |
|
" orientation was specifed in the BASS file.\n", |
1156 |
|
currentAtomType->name ); |
1157 |
|
painCave.isFatal = 1; |
1161 |
|
else{ |
1162 |
|
if( the_atoms[i]->isDirectional() ){ |
1163 |
|
sprintf( painCave.errMsg, |
1164 |
< |
"TraPPE_ExFF error: Atom \"%s\" was given a standard" |
1164 |
> |
"DUFF error: Atom \"%s\" was given a standard" |
1165 |
|
"orientation in the BASS file, yet it is not a dipole.\n", |
1166 |
|
currentAtomType->name); |
1167 |
|
painCave.isFatal = 1; |
1171 |
|
} |
1172 |
|
} |
1173 |
|
|
1174 |
< |
void TraPPE_ExFF::initializeBonds( int nBonds, Bond** bondArray, |
1174 |
> |
void DUFF::initializeBonds( int nBonds, Bond** bondArray, |
1175 |
|
bond_pair* the_bonds ){ |
1176 |
|
int i,a,b; |
1177 |
|
char* atomA; |
1199 |
|
simError(); |
1200 |
|
} |
1201 |
|
|
1202 |
< |
if( !strcmp( currentBondType->type, "fixed" ) ){ |
1203 |
< |
|
1202 |
> |
switch( currentBondType->type ){ |
1203 |
> |
|
1204 |
> |
case FIXED_BOND: |
1205 |
> |
|
1206 |
|
bondArray[i] = new ConstrainedBond( *the_atoms[a], |
1207 |
|
*the_atoms[b], |
1208 |
|
currentBondType->d0 ); |
1209 |
|
entry_plug->n_constraints++; |
1210 |
+ |
break; |
1211 |
+ |
|
1212 |
+ |
case HARMONIC_BOND: |
1213 |
+ |
|
1214 |
+ |
bondArray[i] = new HarmonicBond( *the_atoms[a], |
1215 |
+ |
*the_atoms[b], |
1216 |
+ |
currentBondType->d0, |
1217 |
+ |
currentBondType->k0 ); |
1218 |
+ |
break; |
1219 |
+ |
|
1220 |
+ |
default: |
1221 |
+ |
|
1222 |
+ |
break; |
1223 |
+ |
// do nothing |
1224 |
|
} |
1225 |
|
} |
1226 |
|
} |
1227 |
|
|
1228 |
< |
void TraPPE_ExFF::initializeBends( int nBends, Bend** bendArray, |
1228 |
> |
void DUFF::initializeBends( int nBends, Bend** bendArray, |
1229 |
|
bend_set* the_bends ){ |
1230 |
|
|
1231 |
|
QuadraticBend* qBend; |
1306 |
|
} |
1307 |
|
} |
1308 |
|
|
1309 |
< |
void TraPPE_ExFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
1309 |
> |
void DUFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
1310 |
|
torsion_set* the_torsions ){ |
1311 |
|
|
1312 |
|
int i, a, b, c, d; |
1353 |
|
} |
1354 |
|
} |
1355 |
|
|
1356 |
< |
void TraPPE_ExFF::fastForward( char* stopText, char* searchOwner ){ |
1356 |
> |
void DUFF::fastForward( char* stopText, char* searchOwner ){ |
1357 |
|
|
1358 |
|
int foundText = 0; |
1359 |
|
char* the_token; |
1505 |
|
int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1506 |
|
|
1507 |
|
char* the_token; |
1508 |
+ |
char bondType[30]; |
1509 |
|
|
1510 |
|
the_token = strtok( lineBuffer, " \n\t,;" ); |
1511 |
|
if( the_token != NULL ){ |
1528 |
|
simError(); |
1529 |
|
} |
1530 |
|
|
1531 |
< |
strcpy( info.type, the_token ); |
1531 |
> |
strcpy( bondType, the_token ); |
1532 |
|
|
1533 |
< |
if( !strcmp( info.type, "fixed" ) ){ |
1533 |
> |
if( !strcmp( bondType, "fixed" ) ){ |
1534 |
> |
info.type = FIXED_BOND; |
1535 |
> |
|
1536 |
|
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1537 |
|
sprintf( painCave.errMsg, |
1538 |
|
"Error parseing BondTypes: line %d\n", lineNum ); |
1542 |
|
|
1543 |
|
info.d0 = atof( the_token ); |
1544 |
|
} |
1545 |
+ |
else if( !strcmp( bondType, "harmonic" ) ){ |
1546 |
+ |
info.type = HARMONIC_BOND; |
1547 |
+ |
|
1548 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1549 |
+ |
sprintf( painCave.errMsg, |
1550 |
+ |
"Error parseing BondTypes: line %d\n", lineNum ); |
1551 |
+ |
painCave.isFatal = 1; |
1552 |
+ |
simError(); |
1553 |
+ |
} |
1554 |
+ |
|
1555 |
+ |
info.d0 = atof( the_token ); |
1556 |
+ |
|
1557 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1558 |
+ |
sprintf( painCave.errMsg, |
1559 |
+ |
"Error parseing BondTypes: line %d\n", lineNum ); |
1560 |
+ |
painCave.isFatal = 1; |
1561 |
+ |
simError(); |
1562 |
+ |
} |
1563 |
+ |
|
1564 |
+ |
info.k0 = atof( the_token ); |
1565 |
+ |
} |
1566 |
+ |
|
1567 |
|
else{ |
1568 |
|
sprintf( painCave.errMsg, |
1569 |
< |
"Unknown TraPPE_Ex bond type \"%s\" at line %d\n", |
1569 |
> |
"Unknown DUFF bond type \"%s\" at line %d\n", |
1570 |
|
info.type, |
1571 |
|
lineNum ); |
1572 |
|
painCave.isFatal = 1; |
1655 |
|
|
1656 |
|
else{ |
1657 |
|
sprintf( painCave.errMsg, |
1658 |
< |
"Unknown TraPPE_Ex bend type \"%s\" at line %d\n", |
1658 |
> |
"Unknown DUFF bend type \"%s\" at line %d\n", |
1659 |
|
info.type, |
1660 |
|
lineNum ); |
1661 |
|
painCave.isFatal = 1; |
1753 |
|
|
1754 |
|
else{ |
1755 |
|
sprintf( painCave.errMsg, |
1756 |
< |
"Unknown TraPPE_Ex torsion type \"%s\" at line %d\n", |
1756 |
> |
"Unknown DUFF torsion type \"%s\" at line %d\n", |
1757 |
|
info.type, |
1758 |
|
lineNum ); |
1759 |
|
painCave.isFatal = 1; |