ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/UseTheForce/WATER.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/UseTheForce/WATER.cpp (file contents):
Revision 1650 by gezelter, Tue Oct 26 22:24:52 2004 UTC vs.
Revision 1654 by gezelter, Wed Oct 27 02:16:34 2004 UTC

# Line 246 | Line 246 | WATER::WATER(){
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;
# Line 308 | Line 306 | WATER::WATER(){
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,
# Line 342 | Line 331 | WATER::WATER(){
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();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines