1 |
< |
#include <cstdlib> |
2 |
< |
#include <cstdio> |
3 |
< |
#include <cstring> |
1 |
> |
#include <stdlib.h> |
2 |
> |
#include <stdio.h> |
3 |
> |
#include <string.h> |
4 |
|
|
5 |
|
#include <iostream> |
6 |
|
using namespace std; |
22 |
|
#define HARMONIC_BOND 1 |
23 |
|
|
24 |
|
|
25 |
< |
namespace TPE { // restrict the access of the folowing to this file only. |
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 |
32 |
|
double mass; |
33 |
|
double epslon; |
34 |
|
double sigma; |
35 |
+ |
double charge; |
36 |
|
double dipole; |
37 |
|
double w0; |
38 |
|
double v0; |
39 |
+ |
double v0p; |
40 |
+ |
double rl; |
41 |
+ |
double ru; |
42 |
+ |
double rlp; |
43 |
+ |
double rup; |
44 |
|
int isSSD; |
45 |
+ |
int isCharge; |
46 |
|
int isDipole; |
47 |
|
int ident; |
48 |
|
int last; // 0 -> default |
116 |
|
void printMe( void ){ |
117 |
|
|
118 |
|
std::cerr << "LinkedAtype " << name << ": ident = " << ident << "\n"; |
119 |
< |
if( next != NULL ) next->printMe(); |
119 |
> |
// if( next != NULL ) next->printMe(); |
120 |
|
|
121 |
|
} |
122 |
|
|
145 |
|
next->dipole = info.dipole; |
146 |
|
next->w0 = info.w0; |
147 |
|
next->v0 = info.v0; |
148 |
+ |
next->v0p = info.v0p; |
149 |
+ |
next->rl = info.rl; |
150 |
+ |
next->ru = info.ru; |
151 |
+ |
next->rlp = info.rlp; |
152 |
+ |
next->rup = info.rup; |
153 |
|
next->ident = info.ident; |
154 |
|
} |
155 |
|
} |
166 |
|
info.dipole = dipole; |
167 |
|
info.w0 = w0; |
168 |
|
info.v0 = v0; |
169 |
+ |
info.v0p = v0p; |
170 |
+ |
info.rl = rl; |
171 |
+ |
info.ru = ru; |
172 |
+ |
info.rlp = rlp; |
173 |
+ |
info.rup = rup; |
174 |
|
info.ident = ident; |
175 |
|
info.last = 0; |
176 |
|
} |
187 |
|
double dipole; |
188 |
|
double w0; |
189 |
|
double v0; |
190 |
+ |
double v0p; |
191 |
+ |
double rl; |
192 |
+ |
double ru; |
193 |
+ |
double rlp; |
194 |
+ |
double rup; |
195 |
|
int ident; |
196 |
|
LinkedAtomType* next; |
197 |
|
}; |
442 |
|
|
443 |
|
} // namespace |
444 |
|
|
445 |
< |
using namespace TPE; |
445 |
> |
using namespace DUFF_NS; |
446 |
|
|
447 |
|
|
448 |
|
//**************************************************************** |
456 |
|
char* ffPath_env = "FORCE_PARAM_PATH"; |
457 |
|
char* ffPath; |
458 |
|
char temp[200]; |
437 |
– |
char errMsg[1000]; |
459 |
|
|
460 |
|
headAtomType = NULL; |
461 |
|
currentAtomType = NULL; |
477 |
|
// Init the atomStruct mpi type |
478 |
|
|
479 |
|
atomStruct atomProto; // mpiPrototype |
480 |
< |
int atomBC[3] = {15,6,4}; // block counts |
480 |
> |
int atomBC[3] = {15,12,5}; // block counts |
481 |
|
MPI_Aint atomDspls[3]; // displacements |
482 |
|
MPI_Datatype atomMbrTypes[3]; // member mpi types |
483 |
|
|
595 |
|
if( frcFile == NULL ){ |
596 |
|
|
597 |
|
sprintf( painCave.errMsg, |
598 |
< |
"Error opening the force field parameter file: %s\n" |
599 |
< |
"Have you tried setting the FORCE_PARAM_PATH environment " |
600 |
< |
"vairable?\n", |
598 |
> |
"Error opening the force field parameter file:\n" |
599 |
> |
"\t%s\n" |
600 |
> |
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
601 |
> |
"variable?\n", |
602 |
|
fileName ); |
603 |
+ |
painCave.severity = OOPSE_ERROR; |
604 |
|
painCave.isFatal = 1; |
605 |
|
simError(); |
606 |
|
} |
661 |
|
|
662 |
|
void DUFF::readParams( void ){ |
663 |
|
|
641 |
– |
int i, a, b, c, d; |
664 |
|
int identNum; |
643 |
– |
char* atomA; |
644 |
– |
char* atomB; |
645 |
– |
char* atomC; |
646 |
– |
char* atomD; |
665 |
|
|
666 |
|
atomStruct atomInfo; |
667 |
|
bondStruct bondInfo; |
733 |
|
while( currentAtomType != NULL ){ |
734 |
|
currentAtomType->duplicate( atomInfo ); |
735 |
|
|
718 |
– |
|
719 |
– |
|
736 |
|
sendFrcStruct( &atomInfo, mpiAtomStructType ); |
737 |
|
|
738 |
|
sprintf( checkPointMsg, |
750 |
|
else{ |
751 |
|
|
752 |
|
// listen for node 0 to send out the force params |
753 |
< |
|
753 |
> |
|
754 |
|
MPIcheckPoint(); |
755 |
|
|
756 |
|
headAtomType = new LinkedAtomType; |
757 |
< |
recieveFrcStruct( &atomInfo, mpiAtomStructType ); |
757 |
> |
receiveFrcStruct( &atomInfo, mpiAtomStructType ); |
758 |
|
|
759 |
|
while( !atomInfo.last ){ |
760 |
|
|
745 |
– |
|
746 |
– |
|
761 |
|
headAtomType->add( atomInfo ); |
762 |
|
|
763 |
|
MPIcheckPoint(); |
764 |
|
|
765 |
< |
recieveFrcStruct( &atomInfo, mpiAtomStructType ); |
765 |
> |
receiveFrcStruct( &atomInfo, mpiAtomStructType ); |
766 |
|
} |
767 |
|
} |
768 |
|
|
778 |
|
|
779 |
|
int isGB = 0; |
780 |
|
int isLJ = 1; |
781 |
< |
double GB_dummy = 0.0; |
782 |
< |
|
783 |
< |
|
781 |
> |
int isEAM =0; |
782 |
> |
int isCharge = 0; |
783 |
> |
double charge=0.0; |
784 |
> |
|
785 |
|
currentAtomType = headAtomType->next;; |
786 |
|
while( currentAtomType != NULL ){ |
787 |
|
|
788 |
< |
if(currentAtomType->isDipole) entry_plug->useDipole = 1; |
788 |
> |
if(currentAtomType->isDipole) entry_plug->useDipoles = 1; |
789 |
|
if(currentAtomType->isSSD) { |
790 |
|
entry_plug->useSticky = 1; |
791 |
< |
set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0)); |
791 |
> |
set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0), |
792 |
> |
&(currentAtomType->v0p), |
793 |
> |
&(currentAtomType->rl), &(currentAtomType->ru), |
794 |
> |
&(currentAtomType->rlp), &(currentAtomType->rup)); |
795 |
|
} |
796 |
|
|
797 |
|
if( currentAtomType->name[0] != '\0' ){ |
801 |
|
&(currentAtomType->isSSD), |
802 |
|
&(currentAtomType->isDipole), |
803 |
|
&isGB, |
804 |
+ |
&isEAM, |
805 |
+ |
&isCharge, |
806 |
|
&(currentAtomType->epslon), |
807 |
|
&(currentAtomType->sigma), |
808 |
+ |
&charge, |
809 |
|
&(currentAtomType->dipole), |
810 |
|
&isError ); |
811 |
|
if( isError ){ |
896 |
|
MPIcheckPoint(); |
897 |
|
|
898 |
|
headBondType = new LinkedBondType; |
899 |
< |
recieveFrcStruct( &bondInfo, mpiBondStructType ); |
899 |
> |
receiveFrcStruct( &bondInfo, mpiBondStructType ); |
900 |
|
while( !bondInfo.last ){ |
901 |
|
|
902 |
|
headBondType->add( bondInfo ); |
903 |
< |
recieveFrcStruct( &bondInfo, mpiBondStructType ); |
903 |
> |
receiveFrcStruct( &bondInfo, mpiBondStructType ); |
904 |
|
} |
905 |
|
} |
906 |
|
|
924 |
|
fastForward( "BendTypes", "initializeBends" ); |
925 |
|
|
926 |
|
// we are now at the bendTypes section |
927 |
< |
|
927 |
> |
|
928 |
|
eof_test = fgets( readLine, sizeof(readLine), frcFile ); |
929 |
|
lineNum++; |
930 |
|
|
979 |
|
MPIcheckPoint(); |
980 |
|
|
981 |
|
headBendType = new LinkedBendType; |
982 |
< |
recieveFrcStruct( &bendInfo, mpiBendStructType ); |
982 |
> |
receiveFrcStruct( &bendInfo, mpiBendStructType ); |
983 |
|
while( !bendInfo.last ){ |
984 |
|
|
985 |
|
headBendType->add( bendInfo ); |
986 |
< |
recieveFrcStruct( &bendInfo, mpiBendStructType ); |
986 |
> |
receiveFrcStruct( &bendInfo, mpiBendStructType ); |
987 |
|
} |
988 |
|
} |
989 |
|
|
1064 |
|
MPIcheckPoint(); |
1065 |
|
|
1066 |
|
headTorsionType = new LinkedTorsionType; |
1067 |
< |
recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1067 |
> |
receiveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1068 |
|
while( !torsionInfo.last ){ |
1069 |
|
|
1070 |
|
headTorsionType->add( torsionInfo ); |
1071 |
< |
recieveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1071 |
> |
receiveFrcStruct( &torsionInfo, mpiTorsionStructType ); |
1072 |
|
} |
1073 |
|
} |
1074 |
|
|
1122 |
|
// initialize the atoms |
1123 |
|
|
1124 |
|
DirectionalAtom* dAtom; |
1125 |
+ |
double ji[3]; |
1126 |
|
|
1127 |
|
for(int i=0; i<nAtoms; i++ ){ |
1128 |
|
|
1136 |
|
} |
1137 |
|
|
1138 |
|
the_atoms[i]->setMass( currentAtomType->mass ); |
1117 |
– |
the_atoms[i]->setEpslon( currentAtomType->epslon ); |
1118 |
– |
the_atoms[i]->setSigma( currentAtomType->sigma ); |
1139 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
1120 |
– |
the_atoms[i]->setLJ(); |
1140 |
|
|
1141 |
|
if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; |
1142 |
|
|
1144 |
|
if( the_atoms[i]->isDirectional() ){ |
1145 |
|
|
1146 |
|
dAtom = (DirectionalAtom *) the_atoms[i]; |
1128 |
– |
dAtom->setMu( currentAtomType->dipole ); |
1147 |
|
dAtom->setHasDipole( 1 ); |
1148 |
< |
dAtom->setJx( 0.0 ); |
1149 |
< |
dAtom->setJy( 0.0 ); |
1150 |
< |
dAtom->setJz( 0.0 ); |
1148 |
> |
|
1149 |
> |
ji[0] = 0.0; |
1150 |
> |
ji[1] = 0.0; |
1151 |
> |
ji[2] = 0.0; |
1152 |
> |
|
1153 |
> |
dAtom->setJ( ji ); |
1154 |
|
|
1155 |
|
if(!strcmp("SSD",the_atoms[i]->getType())){ |
1156 |
|
dAtom->setI( waterI ); |
1136 |
– |
dAtom->setSSD( 1 ); |
1157 |
|
} |
1158 |
|
else if(!strcmp("HEAD",the_atoms[i]->getType())){ |
1159 |
|
dAtom->setI( headI ); |
1140 |
– |
dAtom->setSSD( 0 ); |
1160 |
|
} |
1161 |
|
else{ |
1162 |
|
sprintf(painCave.errMsg, |
1180 |
|
else{ |
1181 |
|
if( the_atoms[i]->isDirectional() ){ |
1182 |
|
sprintf( painCave.errMsg, |
1183 |
< |
"DUFF error: Atom \"%s\" was given a standard" |
1183 |
> |
"DUFF error: Atom \"%s\" was given a standard " |
1184 |
|
"orientation in the BASS file, yet it is not a dipole.\n", |
1185 |
|
currentAtomType->name); |
1186 |
|
painCave.isFatal = 1; |
1304 |
|
} |
1305 |
|
|
1306 |
|
gBend = new GhostBend( *the_atoms[a], |
1307 |
< |
*the_atoms[b] ); |
1307 |
> |
*the_atoms[b]); |
1308 |
> |
|
1309 |
|
gBend->setConstants( currentBendType->k1, |
1310 |
|
currentBendType->k2, |
1311 |
|
currentBendType->k3, |
1321 |
|
currentBendType->k3, |
1322 |
|
currentBendType->t0 ); |
1323 |
|
bendArray[i] = qBend; |
1324 |
< |
} |
1324 |
> |
} |
1325 |
|
} |
1326 |
|
} |
1327 |
|
} |
1428 |
|
} |
1429 |
|
|
1430 |
|
|
1431 |
< |
int TPE::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){ |
1431 |
> |
int DUFF_NS::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){ |
1432 |
|
|
1433 |
|
char* the_token; |
1434 |
|
|
1514 |
|
} |
1515 |
|
|
1516 |
|
info.v0 = atof( the_token ); |
1517 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1518 |
+ |
sprintf( painCave.errMsg, |
1519 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1520 |
+ |
painCave.isFatal = 1; |
1521 |
+ |
simError(); |
1522 |
+ |
} |
1523 |
+ |
|
1524 |
+ |
info.v0p = atof( the_token ); |
1525 |
+ |
|
1526 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1527 |
+ |
sprintf( painCave.errMsg, |
1528 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1529 |
+ |
painCave.isFatal = 1; |
1530 |
+ |
simError(); |
1531 |
+ |
} |
1532 |
+ |
|
1533 |
+ |
info.rl = atof( the_token ); |
1534 |
+ |
|
1535 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1536 |
+ |
sprintf( painCave.errMsg, |
1537 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1538 |
+ |
painCave.isFatal = 1; |
1539 |
+ |
simError(); |
1540 |
+ |
} |
1541 |
+ |
|
1542 |
+ |
info.ru = atof( the_token ); |
1543 |
+ |
|
1544 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1545 |
+ |
sprintf( painCave.errMsg, |
1546 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1547 |
+ |
painCave.isFatal = 1; |
1548 |
+ |
simError(); |
1549 |
+ |
} |
1550 |
+ |
|
1551 |
+ |
info.rlp = atof( the_token ); |
1552 |
+ |
|
1553 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1554 |
+ |
sprintf( painCave.errMsg, |
1555 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1556 |
+ |
painCave.isFatal = 1; |
1557 |
+ |
simError(); |
1558 |
+ |
} |
1559 |
+ |
|
1560 |
+ |
info.rup = atof( the_token ); |
1561 |
|
} |
1562 |
< |
else info.v0 = info.w0 = 0.0; |
1562 |
> |
else info.v0 = info.w0 = info.v0p = info.rl = info.ru = info.rlp = info.rup = 0.0; |
1563 |
|
|
1564 |
|
return 1; |
1565 |
|
} |
1566 |
|
else return 0; |
1567 |
|
} |
1568 |
|
|
1569 |
< |
int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1569 |
> |
int DUFF_NS::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1570 |
|
|
1571 |
|
char* the_token; |
1572 |
|
char bondType[30]; |
1605 |
|
} |
1606 |
|
|
1607 |
|
info.d0 = atof( the_token ); |
1608 |
+ |
|
1609 |
+ |
info.k0=0.0; |
1610 |
|
} |
1611 |
|
else if( !strcmp( bondType, "harmonic" ) ){ |
1612 |
|
info.type = HARMONIC_BOND; |
1633 |
|
else{ |
1634 |
|
sprintf( painCave.errMsg, |
1635 |
|
"Unknown DUFF bond type \"%s\" at line %d\n", |
1636 |
< |
info.type, |
1636 |
> |
bondType, |
1637 |
|
lineNum ); |
1638 |
|
painCave.isFatal = 1; |
1639 |
|
simError(); |
1645 |
|
} |
1646 |
|
|
1647 |
|
|
1648 |
< |
int TPE::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){ |
1648 |
> |
int DUFF_NS::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){ |
1649 |
|
|
1650 |
|
char* the_token; |
1651 |
|
|
1733 |
|
else return 0; |
1734 |
|
} |
1735 |
|
|
1736 |
< |
int TPE::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){ |
1736 |
> |
int DUFF_NS::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){ |
1737 |
|
|
1738 |
|
char* the_token; |
1739 |
|
|