# | Line 9 | Line 9 | using namespace std; | |
---|---|---|
9 | #include <mpi.h> | |
10 | #endif //is_mpi | |
11 | ||
12 | < | #include "ForceFields.hpp" |
13 | < | #include "SRI.hpp" |
14 | < | #include "simError.h" |
12 | > | #include "UseTheForce/ForceFields.hpp" |
13 | > | #include "primitives/SRI.hpp" |
14 | > | #include "utils/simError.h" |
15 | > | #include "types/AtomType.hpp" |
16 | > | #include "UseTheForce/DarkSide/lj_interface.h" |
17 | ||
16 | – | #include "fortranWrappers.hpp" |
18 | ||
19 | #ifdef IS_MPI | |
20 | < | #include "mpiForceField.h" |
20 | > | #include "UseTheForce/mpiForceField.h" |
21 | #endif // is_mpi | |
22 | ||
23 | ||
# | Line 117 | Line 118 | using namespace LJ_NS; | |
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; |
125 | < | char temp[200]; |
126 | < | |
123 | > | string fileName; |
124 | > | string tempString; |
125 | > | |
126 | headAtomType = NULL; | |
127 | currentAtomType = NULL; | |
128 | ||
129 | // do the funtion wrapping | |
130 | < | wrapMeFF( this ); |
130 | > | // wrapMeFF( this ); |
131 | ||
132 | #ifdef IS_MPI | |
133 | int i; | |
# | Line 159 | Line 158 | LJFF::LJFF(){ | |
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 | + | tempString = ffPath + "/" + fileName; |
175 | + | fileName = tempString; |
176 | ||
177 | < | ffPath = getenv( ffPath_env ); |
176 | < | if( ffPath == NULL ) { |
177 | < | STR_DEFINE(ffPath, FRC_PATH ); |
178 | < | } |
177 | > | frcFile = fopen( fileName.c_str(), "r" ); |
178 | ||
180 | – | |
181 | – | strcpy( temp, ffPath ); |
182 | – | strcat( temp, "/" ); |
183 | – | strcat( temp, fileName ); |
184 | – | strcpy( fileName, temp ); |
185 | – | |
186 | – | frcFile = fopen( fileName, "r" ); |
187 | – | |
179 | if( frcFile == NULL ){ | |
180 | ||
181 | sprintf( painCave.errMsg, | |
# | Line 192 | Line 183 | LJFF::LJFF(){ | |
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(); | |
# | Line 224 | Line 215 | LJFF::~LJFF(){ | |
215 | #endif // is_mpi | |
216 | } | |
217 | ||
218 | < | void LJFF::initForceField( int ljMixRule ){ |
218 | > | void LJFF::initForceField(){ |
219 | ||
220 | < | initFortran( ljMixRule, 0 ); |
220 | > | initFortran(0); |
221 | } | |
222 | ||
223 | void LJFF::cleanMe( void ){ | |
# | Line 251 | Line 242 | void LJFF::readParams( void ){ | |
242 | // if things go well, last will be set to 0 | |
243 | ||
244 | int identNum; | |
245 | < | |
245 | > | int isError; |
246 | ||
247 | bigSigma = 0.0; | |
248 | #ifdef IS_MPI | |
# | Line 347 | Line 338 | void LJFF::readParams( void ){ | |
338 | } | |
339 | } | |
340 | #endif // is_mpi | |
350 | – | |
351 | – | // call new A_types in fortran |
341 | ||
342 | < | int isError; |
342 | > | currentAtomType = headAtomType; |
343 | > | while( currentAtomType != NULL ){ |
344 | > | |
345 | > | if( currentAtomType->name[0] != '\0' ){ |
346 | ||
347 | < | // dummy variables |
348 | < | int isLJ = 1; |
349 | < | int isDipole = 0; |
350 | < | int isSSD = 0; |
351 | < | int isGB = 0; |
352 | < | int isEAM = 0; |
353 | < | int isCharge = 0; |
354 | < | double charge = 0.0; |
355 | < | double dipole = 0.0; |
356 | < | |
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; |
359 | > | } |
360 | > | |
361 | currentAtomType = headAtomType; | |
362 | while( currentAtomType != NULL ){ | |
363 | ||
364 | if( currentAtomType->name[0] != '\0' ){ | |
365 | isError = 0; | |
366 | < | makeAtype( &(currentAtomType->ident), |
367 | < | &isLJ, |
372 | < | &isSSD, |
373 | < | &isDipole, |
374 | < | &isGB, |
375 | < | &isEAM, |
376 | < | &isCharge, |
377 | < | &(currentAtomType->epslon), |
378 | < | &(currentAtomType->sigma), |
379 | < | &charge, |
380 | < | &dipole, |
381 | < | &isError ); |
366 | > | newLJtype( &(currentAtomType->ident), &(currentAtomType->sigma), |
367 | > | &(currentAtomType->epslon), &isError); |
368 | if( isError ){ | |
369 | < | sprintf( painCave.errMsg, |
370 | < | "Error initializing the \"%s\" atom type in fortran\n", |
371 | < | currentAtomType->name ); |
372 | < | painCave.isFatal = 1; |
373 | < | simError(); |
369 | > | sprintf( painCave.errMsg, |
370 | > | "Error initializing the \"%s\" LJ type in fortran\n", |
371 | > | currentAtomType->name ); |
372 | > | painCave.isFatal = 1; |
373 | > | simError(); |
374 | } | |
375 | } | |
376 | + | |
377 | currentAtomType = currentAtomType->next; | |
378 | } | |
379 | < | |
380 | < | entry_plug->useLJ = 1; |
379 | > | |
380 | > | entry_plug->useLennardJones = 1; |
381 | ||
382 | #ifdef IS_MPI | |
383 | sprintf( checkPointMsg, | |
# | Line 400 | Line 387 | void LJFF::readParams( void ){ | |
387 | ||
388 | } | |
389 | ||
403 | – | double LJFF::getAtomTypeMass (char* atomType) { |
404 | – | |
405 | – | currentAtomType = headAtomType->find( atomType ); |
406 | – | if( currentAtomType == NULL ){ |
407 | – | sprintf( painCave.errMsg, |
408 | – | "AtomType error, %s not found in force file.\n", |
409 | – | atomType ); |
410 | – | painCave.isFatal = 1; |
411 | – | simError(); |
412 | – | } |
413 | – | |
414 | – | return currentAtomType->mass; |
415 | – | } |
416 | – | |
390 | void LJFF::initializeAtoms( int nAtoms, Atom** the_atoms ){ | |
391 | ||
392 | int i; |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |