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; |
306 |
|
|
307 |
|
if( worldRank == 0 ){ |
308 |
|
#endif |
311 |
– |
|
312 |
– |
// generate the force file name |
309 |
|
|
310 |
< |
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 |
322 |
> |
tempString = ffPath + "/" + fileName; |
323 |
> |
fileName = tempString; |
324 |
|
|
325 |
< |
ffPath = getenv( ffPath_env ); |
326 |
< |
if( ffPath == NULL ) { |
327 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
328 |
< |
} |
329 |
< |
|
330 |
< |
|
331 |
< |
strcpy( temp, ffPath ); |
332 |
< |
strcat( temp, "/" ); |
333 |
< |
strcat( temp, fileName ); |
334 |
< |
strcpy( fileName, temp ); |
325 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
326 |
|
|
336 |
– |
frcFile = fopen( fileName, "r" ); |
337 |
– |
|
327 |
|
if( frcFile == NULL ){ |
328 |
|
|
329 |
|
sprintf( painCave.errMsg, |
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(); |