246 |
|
|
247 |
|
WATER::WATER(){ |
248 |
|
|
249 |
< |
char fileName[200]; |
250 |
< |
char* ffPath_env = "FORCE_PARAM_PATH"; |
251 |
< |
char* ffPath; |
252 |
< |
char temp[200]; |
249 |
> |
string fileName; |
250 |
> |
string tempString; |
251 |
|
|
252 |
|
headAtomType = NULL; |
253 |
|
currentAtomType = NULL; |
307 |
|
if( worldRank == 0 ){ |
308 |
|
#endif |
309 |
|
|
310 |
< |
// generate the force file name |
311 |
< |
|
312 |
< |
strcpy( fileName, "WATER.frc" ); |
310 |
> |
// generate the force file name |
311 |
> |
|
312 |
> |
fileName = "WATER.frc"; |
313 |
> |
|
314 |
|
// fprintf( stderr,"Trying to open %s\n", fileName ); |
315 |
|
|
316 |
|
// attempt to open the file in the current directory first. |
317 |
|
|
318 |
< |
frcFile = fopen( fileName, "r" ); |
318 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
319 |
|
|
320 |
|
if( frcFile == NULL ){ |
321 |
|
|
322 |
< |
// next see if the force path enviorment variable is set |
323 |
< |
|
325 |
< |
ffPath = getenv( ffPath_env ); |
326 |
< |
if( ffPath == NULL ) { |
327 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
328 |
< |
} |
329 |
< |
|
322 |
> |
tempString = ffPath + "/" + fileName; |
323 |
> |
fileName = tempString; |
324 |
|
|
325 |
< |
strcpy( temp, ffPath ); |
332 |
< |
strcat( temp, "/" ); |
333 |
< |
strcat( temp, fileName ); |
334 |
< |
strcpy( fileName, temp ); |
335 |
< |
|
336 |
< |
frcFile = fopen( fileName, "r" ); |
325 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
326 |
|
|
327 |
|
if( frcFile == NULL ){ |
328 |
|
|
331 |
|
"\t%s\n" |
332 |
|
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
333 |
|
"variable?\n", |
334 |
< |
fileName ); |
334 |
> |
fileName.c_str() ); |
335 |
|
painCave.severity = OOPSE_ERROR; |
336 |
|
painCave.isFatal = 1; |
337 |
|
simError(); |
1077 |
|
return 1; |
1078 |
|
} |
1079 |
|
else return 0; |
1091 |
– |
} |
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; |
1080 |
|
} |