15 |
|
#include "mpiForceField.h" |
16 |
|
#endif // is_mpi |
17 |
|
|
18 |
– |
namespace TPE { // restrict the access of the folowing to this file only. |
18 |
|
|
19 |
+ |
// define some bond Types |
20 |
|
|
21 |
+ |
#define FIXED_BOND 0 |
22 |
+ |
#define HARMONIC_BOND 1 |
23 |
+ |
|
24 |
+ |
|
25 |
+ |
namespace DUFF_NS { // restrict the access of the folowing to this file only. |
26 |
+ |
|
27 |
+ |
|
28 |
|
// Declare the structures that will be passed by MPI |
29 |
|
|
30 |
|
typedef struct{ |
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 |
|
} |
420 |
|
|
421 |
|
} // namespace |
422 |
|
|
423 |
< |
using namespace TPE; |
423 |
> |
using namespace DUFF_NS; |
424 |
|
|
425 |
|
|
426 |
|
//**************************************************************** |
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 |
|
|
764 |
|
|
765 |
|
int isGB = 0; |
766 |
|
int isLJ = 1; |
767 |
+ |
int isEAM =0; |
768 |
|
double GB_dummy = 0.0; |
769 |
|
|
770 |
|
|
784 |
|
&(currentAtomType->isSSD), |
785 |
|
&(currentAtomType->isDipole), |
786 |
|
&isGB, |
787 |
+ |
&isEAM, |
788 |
|
&(currentAtomType->epslon), |
789 |
|
&(currentAtomType->sigma), |
790 |
|
&(currentAtomType->dipole), |
802 |
|
|
803 |
|
#ifdef IS_MPI |
804 |
|
sprintf( checkPointMsg, |
805 |
< |
"TraPPE_ExFF atom structures successfully sent to fortran\n" ); |
805 |
> |
"DUFF atom structures successfully sent to fortran\n" ); |
806 |
|
MPIcheckPoint(); |
807 |
|
#endif // is_mpi |
808 |
|
|
856 |
|
// send out the linked list to all the other processes |
857 |
|
|
858 |
|
sprintf( checkPointMsg, |
859 |
< |
"TraPPE_Ex bond structures read successfully." ); |
859 |
> |
"DUFF bond structures read successfully." ); |
860 |
|
MPIcheckPoint(); |
861 |
|
|
862 |
|
currentBondType = headBondType->next; |
886 |
|
} |
887 |
|
|
888 |
|
sprintf( checkPointMsg, |
889 |
< |
"TraPPE_ExFF bond structures broadcast successfully." ); |
889 |
> |
"DUFF bond structures broadcast successfully." ); |
890 |
|
MPIcheckPoint(); |
891 |
|
|
892 |
|
#endif // is_mpi |
939 |
|
// send out the linked list to all the other processes |
940 |
|
|
941 |
|
sprintf( checkPointMsg, |
942 |
< |
"TraPPE_Ex bend structures read successfully." ); |
942 |
> |
"DUFF bend structures read successfully." ); |
943 |
|
MPIcheckPoint(); |
944 |
|
|
945 |
|
currentBendType = headBendType->next; |
969 |
|
} |
970 |
|
|
971 |
|
sprintf( checkPointMsg, |
972 |
< |
"TraPPE_ExFF bend structures broadcast successfully." ); |
972 |
> |
"DUFF bend structures broadcast successfully." ); |
973 |
|
MPIcheckPoint(); |
974 |
|
|
975 |
|
#endif // is_mpi |
1024 |
|
// send out the linked list to all the other processes |
1025 |
|
|
1026 |
|
sprintf( checkPointMsg, |
1027 |
< |
"TraPPE_Ex torsion structures read successfully." ); |
1027 |
> |
"DUFF torsion structures read successfully." ); |
1028 |
|
MPIcheckPoint(); |
1029 |
|
|
1030 |
|
currentTorsionType = headTorsionType->next; |
1054 |
|
} |
1055 |
|
|
1056 |
|
sprintf( checkPointMsg, |
1057 |
< |
"TraPPE_ExFF torsion structures broadcast successfully." ); |
1057 |
> |
"DUFF torsion structures broadcast successfully." ); |
1058 |
|
MPIcheckPoint(); |
1059 |
|
|
1060 |
|
#endif // is_mpi |
1064 |
|
|
1065 |
|
|
1066 |
|
|
1067 |
< |
void TraPPE_ExFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
1067 |
> |
void DUFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
1068 |
|
|
1069 |
|
|
1070 |
|
////////////////////////////////////////////////// |
1153 |
|
else{ |
1154 |
|
|
1155 |
|
sprintf( painCave.errMsg, |
1156 |
< |
"TraPPE_ExFF error: Atom \"%s\" is a dipole, yet no standard" |
1156 |
> |
"DUFF error: Atom \"%s\" is a dipole, yet no standard" |
1157 |
|
" orientation was specifed in the BASS file.\n", |
1158 |
|
currentAtomType->name ); |
1159 |
|
painCave.isFatal = 1; |
1163 |
|
else{ |
1164 |
|
if( the_atoms[i]->isDirectional() ){ |
1165 |
|
sprintf( painCave.errMsg, |
1166 |
< |
"TraPPE_ExFF error: Atom \"%s\" was given a standard" |
1166 |
> |
"DUFF error: Atom \"%s\" was given a standard" |
1167 |
|
"orientation in the BASS file, yet it is not a dipole.\n", |
1168 |
|
currentAtomType->name); |
1169 |
|
painCave.isFatal = 1; |
1173 |
|
} |
1174 |
|
} |
1175 |
|
|
1176 |
< |
void TraPPE_ExFF::initializeBonds( int nBonds, Bond** bondArray, |
1176 |
> |
void DUFF::initializeBonds( int nBonds, Bond** bondArray, |
1177 |
|
bond_pair* the_bonds ){ |
1178 |
|
int i,a,b; |
1179 |
|
char* atomA; |
1201 |
|
simError(); |
1202 |
|
} |
1203 |
|
|
1204 |
< |
if( !strcmp( currentBondType->type, "fixed" ) ){ |
1205 |
< |
|
1204 |
> |
switch( currentBondType->type ){ |
1205 |
> |
|
1206 |
> |
case FIXED_BOND: |
1207 |
> |
|
1208 |
|
bondArray[i] = new ConstrainedBond( *the_atoms[a], |
1209 |
|
*the_atoms[b], |
1210 |
|
currentBondType->d0 ); |
1211 |
|
entry_plug->n_constraints++; |
1212 |
+ |
break; |
1213 |
+ |
|
1214 |
+ |
case HARMONIC_BOND: |
1215 |
+ |
|
1216 |
+ |
bondArray[i] = new HarmonicBond( *the_atoms[a], |
1217 |
+ |
*the_atoms[b], |
1218 |
+ |
currentBondType->d0, |
1219 |
+ |
currentBondType->k0 ); |
1220 |
+ |
break; |
1221 |
+ |
|
1222 |
+ |
default: |
1223 |
+ |
|
1224 |
+ |
break; |
1225 |
+ |
// do nothing |
1226 |
|
} |
1227 |
|
} |
1228 |
|
} |
1229 |
|
|
1230 |
< |
void TraPPE_ExFF::initializeBends( int nBends, Bend** bendArray, |
1230 |
> |
void DUFF::initializeBends( int nBends, Bend** bendArray, |
1231 |
|
bend_set* the_bends ){ |
1232 |
|
|
1233 |
|
QuadraticBend* qBend; |
1308 |
|
} |
1309 |
|
} |
1310 |
|
|
1311 |
< |
void TraPPE_ExFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
1311 |
> |
void DUFF::initializeTorsions( int nTorsions, Torsion** torsionArray, |
1312 |
|
torsion_set* the_torsions ){ |
1313 |
|
|
1314 |
|
int i, a, b, c, d; |
1355 |
|
} |
1356 |
|
} |
1357 |
|
|
1358 |
< |
void TraPPE_ExFF::fastForward( char* stopText, char* searchOwner ){ |
1358 |
> |
void DUFF::fastForward( char* stopText, char* searchOwner ){ |
1359 |
|
|
1360 |
|
int foundText = 0; |
1361 |
|
char* the_token; |
1410 |
|
} |
1411 |
|
|
1412 |
|
|
1413 |
< |
int TPE::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){ |
1413 |
> |
int DUFF_NS::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){ |
1414 |
|
|
1415 |
|
char* the_token; |
1416 |
|
|
1504 |
|
else return 0; |
1505 |
|
} |
1506 |
|
|
1507 |
< |
int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1507 |
> |
int DUFF_NS::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1508 |
|
|
1509 |
|
char* the_token; |
1510 |
+ |
char bondType[30]; |
1511 |
|
|
1512 |
|
the_token = strtok( lineBuffer, " \n\t,;" ); |
1513 |
|
if( the_token != NULL ){ |
1530 |
|
simError(); |
1531 |
|
} |
1532 |
|
|
1533 |
< |
strcpy( info.type, the_token ); |
1533 |
> |
strcpy( bondType, the_token ); |
1534 |
|
|
1535 |
< |
if( !strcmp( info.type, "fixed" ) ){ |
1535 |
> |
if( !strcmp( bondType, "fixed" ) ){ |
1536 |
> |
info.type = FIXED_BOND; |
1537 |
> |
|
1538 |
|
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1539 |
|
sprintf( painCave.errMsg, |
1540 |
|
"Error parseing BondTypes: line %d\n", lineNum ); |
1544 |
|
|
1545 |
|
info.d0 = atof( the_token ); |
1546 |
|
} |
1547 |
+ |
else if( !strcmp( bondType, "harmonic" ) ){ |
1548 |
+ |
info.type = HARMONIC_BOND; |
1549 |
+ |
|
1550 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1551 |
+ |
sprintf( painCave.errMsg, |
1552 |
+ |
"Error parseing BondTypes: line %d\n", lineNum ); |
1553 |
+ |
painCave.isFatal = 1; |
1554 |
+ |
simError(); |
1555 |
+ |
} |
1556 |
+ |
|
1557 |
+ |
info.d0 = atof( the_token ); |
1558 |
+ |
|
1559 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1560 |
+ |
sprintf( painCave.errMsg, |
1561 |
+ |
"Error parseing BondTypes: line %d\n", lineNum ); |
1562 |
+ |
painCave.isFatal = 1; |
1563 |
+ |
simError(); |
1564 |
+ |
} |
1565 |
+ |
|
1566 |
+ |
info.k0 = atof( the_token ); |
1567 |
+ |
} |
1568 |
+ |
|
1569 |
|
else{ |
1570 |
|
sprintf( painCave.errMsg, |
1571 |
< |
"Unknown TraPPE_Ex bond type \"%s\" at line %d\n", |
1571 |
> |
"Unknown DUFF bond type \"%s\" at line %d\n", |
1572 |
|
info.type, |
1573 |
|
lineNum ); |
1574 |
|
painCave.isFatal = 1; |
1581 |
|
} |
1582 |
|
|
1583 |
|
|
1584 |
< |
int TPE::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){ |
1584 |
> |
int DUFF_NS::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){ |
1585 |
|
|
1586 |
|
char* the_token; |
1587 |
|
|
1657 |
|
|
1658 |
|
else{ |
1659 |
|
sprintf( painCave.errMsg, |
1660 |
< |
"Unknown TraPPE_Ex bend type \"%s\" at line %d\n", |
1660 |
> |
"Unknown DUFF bend type \"%s\" at line %d\n", |
1661 |
|
info.type, |
1662 |
|
lineNum ); |
1663 |
|
painCave.isFatal = 1; |
1669 |
|
else return 0; |
1670 |
|
} |
1671 |
|
|
1672 |
< |
int TPE::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){ |
1672 |
> |
int DUFF_NS::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){ |
1673 |
|
|
1674 |
|
char* the_token; |
1675 |
|
|
1755 |
|
|
1756 |
|
else{ |
1757 |
|
sprintf( painCave.errMsg, |
1758 |
< |
"Unknown TraPPE_Ex torsion type \"%s\" at line %d\n", |
1758 |
> |
"Unknown DUFF torsion type \"%s\" at line %d\n", |
1759 |
|
info.type, |
1760 |
|
lineNum ); |
1761 |
|
painCave.isFatal = 1; |