| 118 |
|
//**************************************************************** |
| 119 |
|
|
| 120 |
|
|
| 121 |
< |
LJFF::LJFF(){ |
| 121 |
> |
LJFF::LJFF() : ForceFields() { |
| 122 |
|
|
| 123 |
< |
char fileName[200]; |
| 124 |
< |
char* ffPath_env = "FORCE_PARAM_PATH"; |
| 125 |
< |
char* ffPath; |
| 126 |
< |
char temp[200]; |
| 127 |
< |
|
| 123 |
> |
string fileName; |
| 124 |
> |
string tempString; |
| 125 |
> |
|
| 126 |
|
headAtomType = NULL; |
| 127 |
|
currentAtomType = NULL; |
| 128 |
|
|
| 158 |
|
if( worldRank == 0 ){ |
| 159 |
|
#endif |
| 160 |
|
|
| 161 |
< |
// generate the force file name |
| 162 |
< |
|
| 163 |
< |
strcpy( fileName, "LJFF.frc" ); |
| 161 |
> |
// generate the force file name |
| 162 |
> |
|
| 163 |
> |
fileName = "LJFF.frc"; |
| 164 |
|
// fprintf( stderr,"Trying to open %s\n", fileName ); |
| 165 |
|
|
| 166 |
|
// attempt to open the file in the current directory first. |
| 167 |
|
|
| 168 |
< |
frcFile = fopen( fileName, "r" ); |
| 168 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
| 169 |
|
|
| 170 |
|
if( frcFile == NULL ){ |
| 171 |
|
|
| 172 |
|
// next see if the force path enviorment variable is set |
| 173 |
< |
|
| 174 |
< |
ffPath = getenv( ffPath_env ); |
| 175 |
< |
if( ffPath == NULL ) { |
| 178 |
< |
STR_DEFINE(ffPath, FRC_PATH ); |
| 179 |
< |
} |
| 180 |
< |
|
| 173 |
> |
|
| 174 |
> |
tempString = ffPath + "/" + fileName; |
| 175 |
> |
fileName = tempString; |
| 176 |
|
|
| 177 |
< |
strcpy( temp, ffPath ); |
| 183 |
< |
strcat( temp, "/" ); |
| 184 |
< |
strcat( temp, fileName ); |
| 185 |
< |
strcpy( fileName, temp ); |
| 177 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
| 178 |
|
|
| 187 |
– |
frcFile = fopen( fileName, "r" ); |
| 188 |
– |
|
| 179 |
|
if( frcFile == NULL ){ |
| 180 |
|
|
| 181 |
|
sprintf( painCave.errMsg, |
| 183 |
|
"\t%s\n" |
| 184 |
|
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
| 185 |
|
"variable?\n", |
| 186 |
< |
fileName ); |
| 186 |
> |
fileName.c_str() ); |
| 187 |
|
painCave.severity = OOPSE_ERROR; |
| 188 |
|
painCave.isFatal = 1; |
| 189 |
|
simError(); |
| 384 |
|
"LJFF atom structures successfully sent to fortran\n" ); |
| 385 |
|
MPIcheckPoint(); |
| 386 |
|
#endif // is_mpi |
| 397 |
– |
|
| 398 |
– |
} |
| 399 |
– |
|
| 400 |
– |
double LJFF::getAtomTypeMass (char* atomType) { |
| 387 |
|
|
| 402 |
– |
currentAtomType = headAtomType->find( atomType ); |
| 403 |
– |
if( currentAtomType == NULL ){ |
| 404 |
– |
sprintf( painCave.errMsg, |
| 405 |
– |
"AtomType error, %s not found in force file.\n", |
| 406 |
– |
atomType ); |
| 407 |
– |
painCave.isFatal = 1; |
| 408 |
– |
simError(); |
| 409 |
– |
} |
| 410 |
– |
|
| 411 |
– |
return currentAtomType->mass; |
| 388 |
|
} |
| 389 |
|
|
| 390 |
|
void LJFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |