| 12 |
|
#include "UseTheForce/ForceFields.hpp" |
| 13 |
|
#include "primitives/SRI.hpp" |
| 14 |
|
#include "utils/simError.h" |
| 15 |
+ |
#include "types/AtomType.hpp" |
| 16 |
|
#include "types/DirectionalAtomType.hpp" |
| 17 |
|
#include "UseTheForce/DarkSide/lj_interface.h" |
| 18 |
|
#include "UseTheForce/DarkSide/charge_interface.h" |
| 247 |
|
|
| 248 |
|
WATER::WATER(){ |
| 249 |
|
|
| 250 |
< |
char fileName[200]; |
| 251 |
< |
char* ffPath_env = "FORCE_PARAM_PATH"; |
| 251 |
< |
char* ffPath; |
| 252 |
< |
char temp[200]; |
| 250 |
> |
string fileName; |
| 251 |
> |
string tempString; |
| 252 |
|
|
| 253 |
|
headAtomType = NULL; |
| 254 |
|
currentAtomType = NULL; |
| 308 |
|
if( worldRank == 0 ){ |
| 309 |
|
#endif |
| 310 |
|
|
| 311 |
< |
// generate the force file name |
| 312 |
< |
|
| 313 |
< |
strcpy( fileName, "WATER.frc" ); |
| 311 |
> |
// generate the force file name |
| 312 |
> |
|
| 313 |
> |
fileName = "WATER.frc"; |
| 314 |
> |
|
| 315 |
|
// fprintf( stderr,"Trying to open %s\n", fileName ); |
| 316 |
|
|
| 317 |
|
// attempt to open the file in the current directory first. |
| 318 |
|
|
| 319 |
< |
frcFile = fopen( fileName, "r" ); |
| 319 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
| 320 |
|
|
| 321 |
|
if( frcFile == NULL ){ |
| 322 |
|
|
| 323 |
< |
// next see if the force path enviorment variable is set |
| 323 |
> |
tempString = ffPath + "/" + fileName; |
| 324 |
> |
fileName = tempString; |
| 325 |
|
|
| 326 |
< |
ffPath = getenv( ffPath_env ); |
| 326 |
< |
if( ffPath == NULL ) { |
| 327 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
| 328 |
< |
} |
| 326 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
| 327 |
|
|
| 330 |
– |
|
| 331 |
– |
strcpy( temp, ffPath ); |
| 332 |
– |
strcat( temp, "/" ); |
| 333 |
– |
strcat( temp, fileName ); |
| 334 |
– |
strcpy( fileName, temp ); |
| 335 |
– |
|
| 336 |
– |
frcFile = fopen( fileName, "r" ); |
| 337 |
– |
|
| 328 |
|
if( frcFile == NULL ){ |
| 329 |
|
|
| 330 |
|
sprintf( painCave.errMsg, |
| 332 |
|
"\t%s\n" |
| 333 |
|
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
| 334 |
|
"variable?\n", |
| 335 |
< |
fileName ); |
| 335 |
> |
fileName.c_str() ); |
| 336 |
|
painCave.severity = OOPSE_ERROR; |
| 337 |
|
painCave.isFatal = 1; |
| 338 |
|
simError(); |
| 396 |
|
atomStruct atomInfo; |
| 397 |
|
directionalStruct directionalInfo; |
| 398 |
|
fpos_t *atomPos; |
| 409 |
– |
|
| 399 |
|
AtomType* at; |
| 400 |
|
|
| 401 |
|
atomInfo.last = 1; // initialize last to have the last set. |
| 544 |
|
while( currentAtomType != NULL ){ |
| 545 |
|
if( currentAtomType->name[0] != '\0' ){ |
| 546 |
|
if (currentAtomType->isDirectional) |
| 547 |
< |
DirectionalAtomType* at = new DirectionalAtomType(); |
| 547 |
> |
at = new DirectionalAtomType(); |
| 548 |
|
else |
| 549 |
< |
AtomType* at = new AtomType(); |
| 550 |
< |
|
| 549 |
> |
at = new AtomType(); |
| 550 |
> |
|
| 551 |
|
if (currentAtomType->isLJ) { |
| 552 |
|
at->setLennardJones(); |
| 553 |
|
} |
| 557 |
|
} |
| 558 |
|
|
| 559 |
|
if (currentAtomType->isDirectional) { |
| 560 |
< |
if (currentDirectionalType->isSticky) { |
| 560 |
> |
if (currentDirectionalType->isDipole) { |
| 561 |
|
((DirectionalAtomType*)at)->setDipole(); |
| 573 |
– |
entry_plug->useDipoles = 1; |
| 562 |
|
} |
| 563 |
|
|
| 564 |
|
if (currentDirectionalType->isSticky) { |
| 565 |
|
((DirectionalAtomType*)at)->setSticky(); |
| 578 |
– |
entry_plug->useSticky = 1; |
| 566 |
|
} |
| 567 |
|
} |
| 568 |
|
|
| 578 |
|
|
| 579 |
|
while( currentAtomType != NULL ){ |
| 580 |
|
|
| 581 |
+ |
currentDirectionalType = headDirectionalType->find(currentAtomType->name); |
| 582 |
+ |
|
| 583 |
|
if( currentAtomType->isLJ ){ |
| 584 |
|
isError = 0; |
| 585 |
|
newLJtype( &(currentAtomType->ident), &(currentAtomType->sigma), |
| 662 |
|
} |
| 663 |
|
the_atoms[i]->setMass( currentAtomType->mass ); |
| 664 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
| 665 |
+ |
|
| 666 |
+ |
if (currentAtomType->isLJ) entry_plug->useLennardJones = 1; |
| 667 |
+ |
if (currentAtomType->isCharge) entry_plug->useCharges = 1; |
| 668 |
+ |
if (currentAtomType->isDirectional) { |
| 669 |
+ |
if (currentDirectionalType->isDipole) entry_plug->useDipoles = 1; |
| 670 |
+ |
if (currentDirectionalType->isSticky) entry_plug->useSticky = 1; |
| 671 |
+ |
} |
| 672 |
|
|
| 673 |
|
if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; |
| 674 |
|
|
| 1085 |
|
} |
| 1086 |
|
else return 0; |
| 1087 |
|
} |
| 1092 |
– |
double WATER::getAtomTypeMass (char* atomType) { |
| 1093 |
– |
|
| 1094 |
– |
currentAtomType = headAtomType->find( atomType ); |
| 1095 |
– |
if( currentAtomType == NULL ){ |
| 1096 |
– |
sprintf( painCave.errMsg, |
| 1097 |
– |
"AtomType error, %s not found in force file.\n", |
| 1098 |
– |
atomType ); |
| 1099 |
– |
painCave.isFatal = 1; |
| 1100 |
– |
simError(); |
| 1101 |
– |
} |
| 1102 |
– |
|
| 1103 |
– |
return currentAtomType->mass; |
| 1104 |
– |
} |