5 |
|
#include <iostream> |
6 |
|
using namespace std; |
7 |
|
|
8 |
+ |
#ifdef IS_MPI |
9 |
+ |
#include <mpi.h> |
10 |
+ |
#include <mpi++.h> |
11 |
+ |
#endif //is_mpi |
12 |
+ |
|
13 |
|
#include "ForceFields.hpp" |
14 |
|
#include "SRI.hpp" |
15 |
|
#include "simError.h" |
16 |
|
|
17 |
+ |
|
18 |
+ |
|
19 |
|
// Declare the structures that will be passed by the parser and MPI |
20 |
|
|
21 |
|
typedef struct{ |
54 |
|
void (*p3)( double* positionArray, |
55 |
|
double* forceArray, |
56 |
|
double* potentialEnergy, |
57 |
< |
short int* doPotentialCalc )), |
57 |
> |
double* tau, |
58 |
> |
short int* doPotentialCalc, |
59 |
> |
int* isError)), |
60 |
|
int forceNameLength ); |
61 |
|
} |
62 |
|
|
65 |
|
double* sigma, int* status ), |
66 |
|
void (*p2)( int *nLocal, int *identArray, int *isError ), |
67 |
|
void (*p3)( double* positionArray,double* forceArray, |
68 |
< |
double* potentialEnergy, |
69 |
< |
short int* doPotentialCalc ) ); |
68 |
> |
double* potentialEnergy, double* tau, |
69 |
> |
short int* doPotentialCalc, int* isError ) ); |
70 |
|
|
71 |
|
void (*newLJtype)( int* ident, double* mass, double* epslon, double* sigma, |
72 |
|
int* status ); |
630 |
|
|
631 |
|
void LJ_FF::doForces( int calcPot ){ |
632 |
|
|
633 |
< |
int i; |
633 |
> |
int i, isError; |
634 |
|
double* frc; |
635 |
|
double* pos; |
636 |
+ |
double* tau; |
637 |
|
short int passedCalcPot = (short int)calcPot; |
638 |
|
|
639 |
|
// forces are zeroed here, before any are acumulated. |
645 |
|
|
646 |
|
frc = Atom::getFrcArray(); |
647 |
|
pos = Atom::getPosArray(); |
648 |
< |
|
639 |
< |
// entry_plug->lrPot = -1; |
640 |
< |
doLJfortran( pos, frc, &(entry_plug->lrPot), &passedCalcPot ); |
648 |
> |
tau = entry_plug->tau; |
649 |
|
|
650 |
+ |
isError = 0; |
651 |
+ |
doLJfortran( pos, frc, &(entry_plug->lrPot), tau, &passedCalcPot, &isError ); |
652 |
|
|
653 |
< |
// fprintf( stderr, |
654 |
< |
// "lrPot = %lf\n", entry_plug->lrPot ); |
655 |
< |
|
653 |
> |
|
654 |
> |
if( isError ){ |
655 |
> |
sprintf( painCave.errMsg, |
656 |
> |
"Error returned from the fortran force calculation.\n" ); |
657 |
> |
painCave.isFatal = 1; |
658 |
> |
simError(); |
659 |
> |
} |
660 |
> |
|
661 |
> |
#ifdef IS_MPI |
662 |
> |
sprintf( checkPointMsg, |
663 |
> |
"returned from the force calculation.\n" ); |
664 |
> |
MPIcheckPoint(); |
665 |
> |
#endif // is_mpi |
666 |
> |
|
667 |
|
} |
668 |
|
|
669 |
|
void LJ_FF::initFortran( void ){ |