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{ |
35 |
|
double dipole; |
36 |
|
double w0; |
37 |
|
double v0; |
38 |
+ |
double v0p; |
39 |
+ |
double rl; |
40 |
+ |
double ru; |
41 |
+ |
double rlp; |
42 |
+ |
double rup; |
43 |
|
int isSSD; |
44 |
|
int isDipole; |
45 |
|
int ident; |
51 |
|
typedef struct{ |
52 |
|
char nameA[15]; |
53 |
|
char nameB[15]; |
42 |
– |
char type[30]; |
54 |
|
double d0; |
55 |
+ |
double k0; |
56 |
|
int last; // 0 -> default |
57 |
|
// 1 -> tells nodes to stop listening |
58 |
+ |
int type; |
59 |
|
} bondStruct; |
60 |
|
|
61 |
|
|
143 |
|
next->dipole = info.dipole; |
144 |
|
next->w0 = info.w0; |
145 |
|
next->v0 = info.v0; |
146 |
+ |
next->v0p = info.v0p; |
147 |
+ |
next->rl = info.rl; |
148 |
+ |
next->ru = info.ru; |
149 |
+ |
next->rlp = info.rlp; |
150 |
+ |
next->rup = info.rup; |
151 |
|
next->ident = info.ident; |
152 |
|
} |
153 |
|
} |
164 |
|
info.dipole = dipole; |
165 |
|
info.w0 = w0; |
166 |
|
info.v0 = v0; |
167 |
+ |
info.v0p = v0p; |
168 |
+ |
info.rl = rl; |
169 |
+ |
info.ru = ru; |
170 |
+ |
info.rlp = rlp; |
171 |
+ |
info.rup = rup; |
172 |
|
info.ident = ident; |
173 |
|
info.last = 0; |
174 |
|
} |
185 |
|
double dipole; |
186 |
|
double w0; |
187 |
|
double v0; |
188 |
+ |
double v0p; |
189 |
+ |
double rl; |
190 |
+ |
double ru; |
191 |
+ |
double rlp; |
192 |
+ |
double rup; |
193 |
|
int ident; |
194 |
|
LinkedAtomType* next; |
195 |
|
}; |
200 |
|
next = NULL; |
201 |
|
nameA[0] = '\0'; |
202 |
|
nameB[0] = '\0'; |
175 |
– |
type[0] = '\0'; |
203 |
|
} |
204 |
|
~LinkedBondType(){ if( next != NULL ) delete next; } |
205 |
|
|
234 |
|
next = new LinkedBondType(); |
235 |
|
strcpy(next->nameA, info.nameA); |
236 |
|
strcpy(next->nameB, info.nameB); |
237 |
< |
strcpy(next->type, info.type); |
237 |
> |
next->type = info.type; |
238 |
|
next->d0 = info.d0; |
239 |
+ |
next->k0 = info.k0; |
240 |
|
} |
241 |
|
} |
242 |
|
|
244 |
|
void duplicate( bondStruct &info ){ |
245 |
|
strcpy(info.nameA, nameA); |
246 |
|
strcpy(info.nameB, nameB); |
247 |
< |
strcpy(info.type, type); |
247 |
> |
info.type = type; |
248 |
|
info.d0 = d0; |
249 |
+ |
info.k0 = k0; |
250 |
|
info.last = 0; |
251 |
|
} |
252 |
|
|
255 |
|
|
256 |
|
char nameA[15]; |
257 |
|
char nameB[15]; |
258 |
< |
char type[30]; |
258 |
> |
int type; |
259 |
|
double d0; |
260 |
+ |
double k0; |
261 |
|
|
262 |
|
LinkedBondType* next; |
263 |
|
}; |
440 |
|
|
441 |
|
} // namespace |
442 |
|
|
443 |
< |
using namespace TPE; |
443 |
> |
using namespace DUFF_NS; |
444 |
|
|
445 |
|
|
446 |
|
//**************************************************************** |
498 |
|
// Init the bondStruct mpi type |
499 |
|
|
500 |
|
bondStruct bondProto; // mpiPrototype |
501 |
< |
int bondBC[3] = {60,1,1}; // block counts |
501 |
> |
int bondBC[3] = {30,2,2}; // block counts |
502 |
|
MPI_Aint bondDspls[3]; // displacements |
503 |
|
MPI_Datatype bondMbrTypes[3]; // member mpi types |
504 |
|
|
784 |
|
|
785 |
|
int isGB = 0; |
786 |
|
int isLJ = 1; |
787 |
+ |
int isEAM =0; |
788 |
|
double GB_dummy = 0.0; |
789 |
|
|
790 |
|
|
794 |
|
if(currentAtomType->isDipole) entry_plug->useDipole = 1; |
795 |
|
if(currentAtomType->isSSD) { |
796 |
|
entry_plug->useSticky = 1; |
797 |
< |
set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0)); |
797 |
> |
set_sticky_params( &(currentAtomType->w0), &(currentAtomType->v0), |
798 |
> |
&(currentAtomType->v0p), |
799 |
> |
&(currentAtomType->rl), &(currentAtomType->ru), |
800 |
> |
&(currentAtomType->rlp), &(currentAtomType->rup)); |
801 |
|
} |
802 |
|
|
803 |
|
if( currentAtomType->name[0] != '\0' ){ |
807 |
|
&(currentAtomType->isSSD), |
808 |
|
&(currentAtomType->isDipole), |
809 |
|
&isGB, |
810 |
+ |
&isEAM, |
811 |
|
&(currentAtomType->epslon), |
812 |
|
&(currentAtomType->sigma), |
813 |
|
&(currentAtomType->dipole), |
1224 |
|
simError(); |
1225 |
|
} |
1226 |
|
|
1227 |
< |
if( !strcmp( currentBondType->type, "fixed" ) ){ |
1228 |
< |
|
1227 |
> |
switch( currentBondType->type ){ |
1228 |
> |
|
1229 |
> |
case FIXED_BOND: |
1230 |
> |
|
1231 |
|
bondArray[i] = new ConstrainedBond( *the_atoms[a], |
1232 |
|
*the_atoms[b], |
1233 |
|
currentBondType->d0 ); |
1234 |
|
entry_plug->n_constraints++; |
1235 |
+ |
break; |
1236 |
+ |
|
1237 |
+ |
case HARMONIC_BOND: |
1238 |
+ |
|
1239 |
+ |
bondArray[i] = new HarmonicBond( *the_atoms[a], |
1240 |
+ |
*the_atoms[b], |
1241 |
+ |
currentBondType->d0, |
1242 |
+ |
currentBondType->k0 ); |
1243 |
+ |
break; |
1244 |
+ |
|
1245 |
+ |
default: |
1246 |
+ |
|
1247 |
+ |
break; |
1248 |
+ |
// do nothing |
1249 |
|
} |
1250 |
|
} |
1251 |
|
} |
1433 |
|
} |
1434 |
|
|
1435 |
|
|
1436 |
< |
int TPE::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){ |
1436 |
> |
int DUFF_NS::parseAtom( char *lineBuffer, int lineNum, atomStruct &info ){ |
1437 |
|
|
1438 |
|
char* the_token; |
1439 |
|
|
1519 |
|
} |
1520 |
|
|
1521 |
|
info.v0 = atof( the_token ); |
1522 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1523 |
+ |
sprintf( painCave.errMsg, |
1524 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1525 |
+ |
painCave.isFatal = 1; |
1526 |
+ |
simError(); |
1527 |
+ |
} |
1528 |
+ |
|
1529 |
+ |
info.v0p = atof( the_token ); |
1530 |
+ |
|
1531 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1532 |
+ |
sprintf( painCave.errMsg, |
1533 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1534 |
+ |
painCave.isFatal = 1; |
1535 |
+ |
simError(); |
1536 |
+ |
} |
1537 |
+ |
|
1538 |
+ |
info.rl = atof( the_token ); |
1539 |
+ |
|
1540 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1541 |
+ |
sprintf( painCave.errMsg, |
1542 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1543 |
+ |
painCave.isFatal = 1; |
1544 |
+ |
simError(); |
1545 |
+ |
} |
1546 |
+ |
|
1547 |
+ |
info.ru = atof( the_token ); |
1548 |
+ |
|
1549 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1550 |
+ |
sprintf( painCave.errMsg, |
1551 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1552 |
+ |
painCave.isFatal = 1; |
1553 |
+ |
simError(); |
1554 |
+ |
} |
1555 |
+ |
|
1556 |
+ |
info.rlp = atof( the_token ); |
1557 |
+ |
|
1558 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1559 |
+ |
sprintf( painCave.errMsg, |
1560 |
+ |
"Error parseing AtomTypes: line %d\n", lineNum ); |
1561 |
+ |
painCave.isFatal = 1; |
1562 |
+ |
simError(); |
1563 |
+ |
} |
1564 |
+ |
|
1565 |
+ |
info.rup = atof( the_token ); |
1566 |
|
} |
1567 |
< |
else info.v0 = info.w0 = 0.0; |
1567 |
> |
else info.v0 = info.w0 = info.v0p = info.rl = info.ru = info.rlp = info.rup = 0.0; |
1568 |
|
|
1569 |
|
return 1; |
1570 |
|
} |
1571 |
|
else return 0; |
1572 |
|
} |
1573 |
|
|
1574 |
< |
int TPE::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1574 |
> |
int DUFF_NS::parseBond( char *lineBuffer, int lineNum, bondStruct &info ){ |
1575 |
|
|
1576 |
|
char* the_token; |
1577 |
+ |
char bondType[30]; |
1578 |
|
|
1579 |
|
the_token = strtok( lineBuffer, " \n\t,;" ); |
1580 |
|
if( the_token != NULL ){ |
1597 |
|
simError(); |
1598 |
|
} |
1599 |
|
|
1600 |
< |
strcpy( info.type, the_token ); |
1600 |
> |
strcpy( bondType, the_token ); |
1601 |
|
|
1602 |
< |
if( !strcmp( info.type, "fixed" ) ){ |
1602 |
> |
if( !strcmp( bondType, "fixed" ) ){ |
1603 |
> |
info.type = FIXED_BOND; |
1604 |
> |
|
1605 |
|
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1606 |
|
sprintf( painCave.errMsg, |
1607 |
|
"Error parseing BondTypes: line %d\n", lineNum ); |
1610 |
|
} |
1611 |
|
|
1612 |
|
info.d0 = atof( the_token ); |
1613 |
+ |
|
1614 |
+ |
info.k0=0.0; |
1615 |
|
} |
1616 |
+ |
else if( !strcmp( bondType, "harmonic" ) ){ |
1617 |
+ |
info.type = HARMONIC_BOND; |
1618 |
+ |
|
1619 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1620 |
+ |
sprintf( painCave.errMsg, |
1621 |
+ |
"Error parseing BondTypes: line %d\n", lineNum ); |
1622 |
+ |
painCave.isFatal = 1; |
1623 |
+ |
simError(); |
1624 |
+ |
} |
1625 |
+ |
|
1626 |
+ |
info.d0 = atof( the_token ); |
1627 |
+ |
|
1628 |
+ |
if( ( the_token = strtok( NULL, " \n\t,;" ) ) == NULL ){ |
1629 |
+ |
sprintf( painCave.errMsg, |
1630 |
+ |
"Error parseing BondTypes: line %d\n", lineNum ); |
1631 |
+ |
painCave.isFatal = 1; |
1632 |
+ |
simError(); |
1633 |
+ |
} |
1634 |
+ |
|
1635 |
+ |
info.k0 = atof( the_token ); |
1636 |
+ |
} |
1637 |
+ |
|
1638 |
|
else{ |
1639 |
|
sprintf( painCave.errMsg, |
1640 |
|
"Unknown DUFF bond type \"%s\" at line %d\n", |
1650 |
|
} |
1651 |
|
|
1652 |
|
|
1653 |
< |
int TPE::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){ |
1653 |
> |
int DUFF_NS::parseBend( char *lineBuffer, int lineNum, bendStruct &info ){ |
1654 |
|
|
1655 |
|
char* the_token; |
1656 |
|
|
1738 |
|
else return 0; |
1739 |
|
} |
1740 |
|
|
1741 |
< |
int TPE::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){ |
1741 |
> |
int DUFF_NS::parseTorsion( char *lineBuffer, int lineNum, torsionStruct &info ){ |
1742 |
|
|
1743 |
|
char* the_token; |
1744 |
|
|