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 |
324 |
< |
|
325 |
< |
ffPath = getenv( ffPath_env ); |
326 |
< |
if( ffPath == NULL ) { |
327 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
328 |
< |
} |
329 |
< |
|
323 |
> |
tempString = ffPath + "/" + fileName; |
324 |
> |
fileName = tempString; |
325 |
|
|
326 |
< |
strcpy( temp, ffPath ); |
332 |
< |
strcat( temp, "/" ); |
333 |
< |
strcat( temp, fileName ); |
334 |
< |
strcpy( fileName, temp ); |
326 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
327 |
|
|
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(); |
562 |
|
entry_plug->useDipoles = 1; |
563 |
|
} |