64 |
|
void (*newLJtype)( int* ident, double* mass, double* epslon, double* sigma, |
65 |
|
int* status ); |
66 |
|
|
67 |
< |
void (*initLJfortran) ( int *nLocal, int *identArray, int *isError ) |
67 |
> |
void (*initLJfortran) ( int *nLocal, int *identArray, int *isError ); |
68 |
|
|
69 |
|
LJ_FF* currentLJwrap; |
70 |
|
|
207 |
|
|
208 |
|
void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, |
209 |
|
double* sigma, int* status ), |
210 |
< |
void (*p2)( void ), |
210 |
> |
void (*p2)( int*, int*, int* ), |
211 |
|
void (*p3)( double* positionArray,double* forceArray, |
212 |
|
double* potentialEnergy, |
213 |
|
short int* doPotentialCalc ) ){ |
215 |
|
|
216 |
|
p1 = newLJtype; |
217 |
|
p2 = initLJfortran; |
218 |
< |
this->setLJfortran( p3 ); |
218 |
> |
currentLJwrap->setLJfortran( p3 ); |
219 |
|
} |
220 |
|
|
221 |
|
|
242 |
|
// check for duplicates |
243 |
|
|
244 |
|
if( !strcmp( info.name, name ) ){ |
245 |
< |
sprintf( simError.painCave, |
245 |
> |
sprintf( painCave.errMsg, |
246 |
|
"Duplicate LJ atom type \"%s\" found in " |
247 |
|
"the LJ_FF param file./n", |
248 |
|
name ); |
307 |
|
|
308 |
|
headAtomType = new LinkedType; |
309 |
|
|
310 |
< |
fastFoward( "AtomTypes", "initializeAtoms" ); |
310 |
> |
fastForward( "AtomTypes", "initializeAtoms" ); |
311 |
|
|
312 |
|
// we are now at the AtomTypes section. |
313 |
|
|
412 |
|
|
413 |
|
// initialize the atoms |
414 |
|
|
415 |
+ |
double bigSigma = 0.0; |
416 |
|
Atom* thisAtom; |
417 |
|
|
418 |
|
for( i=0; i<nAtoms; i++ ){ |
431 |
|
the_atoms[i]->setSigma( currentAtomType->sigma ); |
432 |
|
the_atoms[i]->setIdent( currentAtomType->ident ); |
433 |
|
the_atoms[i]->setLJ(); |
434 |
+ |
|
435 |
+ |
if( bigSigma < currentAtomType->sigma ) bigSigma = currentAtomType->sigma; |
436 |
|
} |
437 |
|
|
438 |
+ |
|
439 |
+ |
#ifdef IS_MPI |
440 |
+ |
double tempBig = bigSigma; |
441 |
+ |
MPI::COMM_WORLD::Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX ); |
442 |
+ |
#endif //is_mpi |
443 |
|
|
444 |
+ |
//calc rCut and rList |
445 |
+ |
|
446 |
+ |
entry_plug->rCut = 2.5 * bigSigma; |
447 |
+ |
if(entry_plug->rCut > (entry_plug->box_x / 2.0)) entry_plug->rCut = entry_plug->box_x / 2.0; |
448 |
+ |
if(entry_plug->rCut > (entry_plug->box_y / 2.0)) entry_plug->rCut = entry_plug->box_y / 2.0; |
449 |
+ |
if(entry_plug->rCut > (entry_plug->box_z / 2.0)) entry_plug->rCut = entry_plug->box_z / 2.0; |
450 |
+ |
|
451 |
+ |
entry_plug->rList = entry_plug->rCut + 1.0; |
452 |
+ |
|
453 |
|
// clean up the memory |
454 |
|
|
455 |
|
delete headAtomType; |
460 |
|
#endif // is_mpi |
461 |
|
|
462 |
|
initFortran(); |
463 |
+ |
entry_plug->refreshSim(); |
464 |
|
|
465 |
|
} |
466 |
|
|
610 |
|
int i; |
611 |
|
double* frc; |
612 |
|
double* pos; |
613 |
< |
double potE; |
596 |
< |
short int calcPot = 0; |
613 |
> |
short int calcPot = 1; |
614 |
|
|
615 |
|
// forces are zeroed here, before any are acumulated. |
616 |
|
// NOTE: do not rezero the forces in Fortran. |
622 |
|
frc = Atom::getFrcArray(); |
623 |
|
pos = Atom::getPosArray(); |
624 |
|
|
625 |
< |
doLJfortran( pos, frc, potE, calcPot ); |
625 |
> |
doLJfortran( pos, frc, &(entry_plug->lrPot), &calcPot ); |
626 |
|
} |
627 |
|
|
628 |
|
void LJ_FF::initFortran( void ){ |
635 |
|
ident = new int[nLocal]; |
636 |
|
|
637 |
|
for(i=0; i<nLocal; i++){ |
638 |
< |
ident[i] = entryplug->atoms[i]->getIdent(); |
638 |
> |
ident[i] = entry_plug->atoms[i]->getIdent(); |
639 |
|
} |
640 |
|
|
641 |
|
isError = 0; |