52 |
|
} |
53 |
|
~LinkedAtomType(){ if( next != NULL ) delete next; } |
54 |
|
|
55 |
< |
LinkedAtomType* find(char* key){ |
55 |
> |
LinkedAtomType* find(const char* key){ |
56 |
|
if( !strcmp(name, key) ) return this; |
57 |
|
if( next != NULL ) return next->find(key); |
58 |
|
return NULL; |
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 |
< |
|
181 |
< |
|
182 |
< |
strcpy( temp, ffPath ); |
183 |
< |
strcat( temp, "/" ); |
184 |
< |
strcat( temp, fileName ); |
185 |
< |
strcpy( fileName, temp ); |
173 |
> |
|
174 |
> |
tempString = ffPath + "/" + fileName; |
175 |
> |
fileName = tempString; |
176 |
|
|
177 |
< |
frcFile = fopen( fileName, "r" ); |
177 |
> |
frcFile = fopen( fileName.c_str(), "r" ); |
178 |
|
|
179 |
|
if( frcFile == NULL ){ |
180 |
|
|
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(); |
346 |
|
|
347 |
|
AtomType* at = new AtomType(); |
348 |
|
at->setIdent(currentAtomType->ident); |
349 |
+ |
printf ("currentName = %s\n", currentAtomType->name); |
350 |
|
at->setName(currentAtomType->name); |
351 |
+ |
printf("Did setName\n"); |
352 |
|
at->setLennardJones(); |
353 |
+ |
printf("Did setLennardJones\n"); |
354 |
|
at->complete(); |
355 |
+ |
printf("Did complete\n"); |
356 |
|
|
357 |
|
} |
358 |
|
currentAtomType = currentAtomType->next; |
377 |
|
currentAtomType = currentAtomType->next; |
378 |
|
} |
379 |
|
|
380 |
< |
entry_plug->useLJ = 1; |
380 |
> |
entry_plug->useLennardJones = 1; |
381 |
|
|
382 |
|
#ifdef IS_MPI |
383 |
|
sprintf( checkPointMsg, |
384 |
|
"LJFF atom structures successfully sent to fortran\n" ); |
385 |
|
MPIcheckPoint(); |
386 |
|
#endif // is_mpi |
393 |
– |
|
394 |
– |
} |
395 |
– |
|
396 |
– |
double LJFF::getAtomTypeMass (char* atomType) { |
387 |
|
|
398 |
– |
currentAtomType = headAtomType->find( atomType ); |
399 |
– |
if( currentAtomType == NULL ){ |
400 |
– |
sprintf( painCave.errMsg, |
401 |
– |
"AtomType error, %s not found in force file.\n", |
402 |
– |
atomType ); |
403 |
– |
painCave.isFatal = 1; |
404 |
– |
simError(); |
405 |
– |
} |
406 |
– |
|
407 |
– |
return currentAtomType->mass; |
388 |
|
} |
389 |
|
|
390 |
|
void LJFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ |
396 |
|
|
397 |
|
for( i=0; i<nAtoms; i++ ){ |
398 |
|
|
399 |
< |
currentAtomType = headAtomType->find( the_atoms[i]->getType() ); |
399 |
> |
currentAtomType = headAtomType->find(the_atoms[i]->getType().c_str() ); |
400 |
|
if( currentAtomType == NULL ){ |
401 |
|
sprintf( painCave.errMsg, |
402 |
|
"AtomType error, %s not found in force file.\n", |
403 |
< |
the_atoms[i]->getType() ); |
403 |
> |
the_atoms[i]->getType().c_str() ); |
404 |
|
painCave.isFatal = 1; |
405 |
|
simError(); |
406 |
|
} |