43 |
|
double* epslon, |
44 |
|
double* sigma, |
45 |
|
int* status ), |
46 |
< |
void (*p2)( void ), |
46 |
> |
void (*p2)( int *nLocal, |
47 |
> |
int *identArray, |
48 |
> |
int *isError ), |
49 |
|
void (*p3)( double* positionArray, |
50 |
|
double* forceArray, |
51 |
|
double* potentialEnergy, |
56 |
|
|
57 |
|
void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, |
58 |
|
double* sigma, int* status ), |
59 |
< |
void (*p2)( void ), |
59 |
> |
void (*p2)( int *nLocal, int *identArray, int *isError ), |
60 |
|
void (*p3)( double* positionArray,double* forceArray, |
61 |
|
double* potentialEnergy, |
62 |
|
short int* doPotentialCalc ) ); |
64 |
|
void (*newLJtype)( int* ident, double* mass, double* epslon, double* sigma, |
65 |
|
int* status ); |
66 |
|
|
67 |
< |
void (*initLJfortran)( void ); |
67 |
> |
void (*initLJfortran) ( int *nLocal, int *identArray, int *isError ) |
68 |
|
|
69 |
|
LJ_FF* currentLJwrap; |
70 |
|
|
379 |
|
#endif // is_mpi |
380 |
|
|
381 |
|
// call new A_types in fortran |
382 |
+ |
|
383 |
+ |
int isError; |
384 |
+ |
currentAtomType = headAtomType; |
385 |
+ |
while( currentAtomType != NULL ){ |
386 |
+ |
|
387 |
+ |
if( currentAtomType->name[0] != '\0' ){ |
388 |
+ |
isError = 0; |
389 |
+ |
newLJtype( &(currentAtomType->ident), |
390 |
+ |
&(currentAtomType->mass), |
391 |
+ |
&(currentAtomType->epslon), |
392 |
+ |
&(currentAtomType->sigma), |
393 |
+ |
&isError ); |
394 |
+ |
if( isError ){ |
395 |
+ |
sprintf( painCave.errMsg, |
396 |
+ |
"Error initializing the \"%s\" atom type in fortran\n", |
397 |
+ |
currentAtomType->name ); |
398 |
+ |
painCave.isFatal = 1; |
399 |
+ |
simError(); |
400 |
+ |
} |
401 |
+ |
} |
402 |
+ |
currentAtomType = currentAtomType->next; |
403 |
+ |
} |
404 |
+ |
|
405 |
+ |
#ifdef IS_MPI |
406 |
+ |
sprintf( checkPointMsg, |
407 |
+ |
"LJ_FF atom structures successfully sent to fortran\n" ); |
408 |
+ |
MPIcheckPoint(); |
409 |
+ |
#endif // is_mpi |
410 |
|
|
411 |
+ |
|
412 |
|
|
413 |
|
// initialize the atoms |
414 |
|
|
442 |
|
MPIcheckPoint(); |
443 |
|
#endif // is_mpi |
444 |
|
|
445 |
+ |
initFortran(); |
446 |
+ |
|
447 |
|
} |
448 |
|
|
449 |
|
void LJ_FF::initializeBonds( bond_pair* the_bonds ){ |
585 |
|
} |
586 |
|
else return 0; |
587 |
|
} |
588 |
+ |
|
589 |
+ |
|
590 |
+ |
void LJ_FF::doForces( void ){ |
591 |
+ |
|
592 |
+ |
int i; |
593 |
+ |
double* frc; |
594 |
+ |
double* pos; |
595 |
+ |
double potE; |
596 |
+ |
short int calcPot = 0; |
597 |
+ |
|
598 |
+ |
// forces are zeroed here, before any are acumulated. |
599 |
+ |
// NOTE: do not rezero the forces in Fortran. |
600 |
+ |
|
601 |
+ |
for(i=0; i<entry_plug->n_atoms; i++){ |
602 |
+ |
entry_plug->atoms[i]->zeroForces(); |
603 |
+ |
} |
604 |
+ |
|
605 |
+ |
frc = Atom::getFrcArray(); |
606 |
+ |
pos = Atom::getPosArray(); |
607 |
+ |
|
608 |
+ |
doLJfortran( pos, frc, potE, calcPot ); |
609 |
+ |
} |
610 |
+ |
|
611 |
+ |
void LJ_FF::initFortran( void ){ |
612 |
+ |
|
613 |
+ |
int nLocal = entry_plug->n_atoms; |
614 |
+ |
int *ident; |
615 |
+ |
int isError; |
616 |
+ |
int i; |
617 |
+ |
|
618 |
+ |
ident = new int[nLocal]; |
619 |
+ |
|
620 |
+ |
for(i=0; i<nLocal; i++){ |
621 |
+ |
ident[i] = entryplug->atoms[i]->getIdent(); |
622 |
+ |
} |
623 |
+ |
|
624 |
+ |
isError = 0; |
625 |
+ |
initLJfortran( &nLocal, ident, &isError ); |
626 |
+ |
|
627 |
+ |
if(isError){ |
628 |
+ |
sprintf( painCave.errMsg, |
629 |
+ |
"LJ_FF error: There was an error initializing the component list in fortran.\n" ); |
630 |
+ |
painCave.isFatal = 1; |
631 |
+ |
simError(); |
632 |
+ |
} |
633 |
+ |
|
634 |
+ |
|
635 |
+ |
#ifdef IS_MPI |
636 |
+ |
sprintf( checkPointMsg, "LJ_FF successfully initialized the fortran component list.\n" ); |
637 |
+ |
MPIcheckPoint(); |
638 |
+ |
#endif // is_mpi |
639 |
+ |
|
640 |
+ |
delete[] ident; |
641 |
+ |
|
642 |
+ |
} |
643 |
+ |
|