22 |
|
|
23 |
|
|
24 |
|
|
25 |
< |
namespace { |
25 |
> |
namespace LJ_NS{ |
26 |
|
|
27 |
|
// Declare the structures that will be passed by the parser and MPI |
28 |
|
|
45 |
|
#endif |
46 |
|
} |
47 |
|
|
48 |
+ |
using namespace LJ_NS; |
49 |
|
|
50 |
|
//**************************************************************** |
51 |
|
// begins the actual forcefield stuff. |
107 |
|
|
108 |
|
ffPath = getenv( ffPath_env ); |
109 |
|
if( ffPath == NULL ) { |
110 |
< |
sprintf( painCave.errMsg, |
110 |
< |
"Error opening the force field parameter file: %s\n" |
111 |
< |
"Have you tried setting the FORCE_PARAM_PATH environment " |
112 |
< |
"vairable?\n", |
113 |
< |
fileName ); |
114 |
< |
painCave.isFatal = 1; |
115 |
< |
simError(); |
110 |
> |
STR_DEFINE(ffPath, FRC_PATH ); |
111 |
|
} |
112 |
|
|
113 |
|
|
268 |
|
if( readLine[0] != '!' ){ |
269 |
|
|
270 |
|
// the parser returns 0 if the line was blank |
271 |
< |
if( parseAtomLJ( readLine, lineNum, info ) ){ |
271 |
> |
if( parseAtom( readLine, lineNum, info ) ){ |
272 |
|
info.ident = identNum; |
273 |
|
headAtomType->add( info );; |
274 |
|
identNum++; |
347 |
|
|
348 |
|
if( currentAtomType->name[0] != '\0' ){ |
349 |
|
isError = 0; |
350 |
< |
newAtype( &(currentAtomType->ident), |
350 |
> |
makeAtype( &(currentAtomType->ident), |
351 |
|
&(currentAtomType->mass), |
352 |
|
&(currentAtomType->epslon), |
353 |
|
&(currentAtomType->sigma), |
421 |
|
MPIcheckPoint(); |
422 |
|
#endif // is_mpi |
423 |
|
|
424 |
< |
initFortran(); |
424 |
> |
this->initFortran(); |
425 |
|
entry_plug->refreshSim(); |
426 |
|
|
427 |
|
} |
462 |
|
painCave.isFatal = 1; |
463 |
|
simError(); |
464 |
|
} |
470 |
– |
#ifdef IS_MPI |
471 |
– |
MPIcheckPoint(); |
472 |
– |
#endif // is_mpi |
473 |
– |
|
474 |
– |
} |
475 |
– |
|
476 |
– |
void LJ_FF::doForces( int calcPot ){ |
477 |
– |
|
478 |
– |
int i, isError; |
479 |
– |
double* frc; |
480 |
– |
double* pos; |
481 |
– |
double* trq; |
482 |
– |
double* tau; |
483 |
– |
short int passedCalcPot = (short int)calcPot; |
484 |
– |
|
485 |
– |
// forces are zeroed here, before any are acumulated. |
486 |
– |
// NOTE: do not rezero the forces in Fortran. |
487 |
– |
|
488 |
– |
for(i=0; i<entry_plug->n_atoms; i++){ |
489 |
– |
entry_plug->atoms[i]->zeroForces(); |
490 |
– |
} |
491 |
– |
|
492 |
– |
frc = Atom::getFrcArray(); |
493 |
– |
pos = Atom::getPosArray(); |
494 |
– |
trq = Atom::getTrqArray(); |
495 |
– |
tau = entry_plug->tau; |
496 |
– |
|
497 |
– |
// dummy variables |
498 |
– |
// NOTE: THIS IS A MAJOR POTENTIAL BUG!!!!!! be careful. |
499 |
– |
// that said, here we go anyway. |
500 |
– |
|
501 |
– |
double* A = NULL; |
502 |
– |
double* mu = NULL; |
503 |
– |
double* u_l = NULL; |
504 |
– |
|
505 |
– |
isError = 0; |
506 |
– |
fortranForceLoop( pos, A, mu, u_l, frc, trq, tau, &(entry_plug->lrPot), |
507 |
– |
&passedCalcPot, &isError ); |
508 |
– |
|
509 |
– |
|
510 |
– |
if( isError ){ |
511 |
– |
sprintf( painCave.errMsg, |
512 |
– |
"Error returned from the fortran force calculation.\n" ); |
513 |
– |
painCave.isFatal = 1; |
514 |
– |
simError(); |
515 |
– |
} |
516 |
– |
|
465 |
|
#ifdef IS_MPI |
518 |
– |
sprintf( checkPointMsg, |
519 |
– |
"returned from the force calculation.\n" ); |
466 |
|
MPIcheckPoint(); |
467 |
|
#endif // is_mpi |
468 |
|
|
469 |
|
} |
524 |
– |
|
525 |
– |
void LJ_FF::initFortran( void ){ |
526 |
– |
|
527 |
– |
int nLocal = entry_plug->n_atoms; |
528 |
– |
int *ident; |
529 |
– |
int isError; |
530 |
– |
int i; |
470 |
|
|
532 |
– |
ident = new int[nLocal]; |
533 |
– |
|
534 |
– |
for(i=0; i<nLocal; i++){ |
535 |
– |
ident[i] = entry_plug->atoms[i]->getIdent(); |
536 |
– |
} |
537 |
– |
|
538 |
– |
isError = 0; |
539 |
– |
initfortran( &nLocal, ident, &isError ); |
540 |
– |
|
541 |
– |
if(isError){ |
542 |
– |
sprintf( painCave.errMsg, |
543 |
– |
"LJ_FF error: There was an error initializing the component list in fortran.\n" ); |
544 |
– |
painCave.isFatal = 1; |
545 |
– |
simError(); |
546 |
– |
} |
547 |
– |
|
548 |
– |
|
549 |
– |
#ifdef IS_MPI |
550 |
– |
sprintf( checkPointMsg, "LJ_FF successfully initialized the fortran component list.\n" ); |
551 |
– |
MPIcheckPoint(); |
552 |
– |
#endif // is_mpi |
553 |
– |
|
554 |
– |
delete[] ident; |
555 |
– |
|
556 |
– |
} |
557 |
– |
|
558 |
– |
|
471 |
|
void LJ_FF::fastForward( char* stopText, char* searchOwner ){ |
472 |
|
|
473 |
|
int foundText = 0; |