14 |
|
#include "SRI.hpp" |
15 |
|
#include "simError.h" |
16 |
|
|
17 |
+ |
#include <fortranWrappers.hpp> |
18 |
+ |
|
19 |
|
#ifdef IS_MPI |
20 |
|
#include "mpiForceField.h" |
21 |
|
#endif // is_mpi |
44 |
|
|
45 |
|
#endif |
46 |
|
} |
45 |
– |
|
46 |
– |
// declaration of functions needed to wrap the fortran module |
47 |
– |
|
48 |
– |
extern "C" { |
49 |
– |
void forcefactory_( char* forceName, |
50 |
– |
int* status, |
51 |
– |
void (*wrapFunction)( void (*p1)( int* ident, |
52 |
– |
double* mass, |
53 |
– |
double* epslon, |
54 |
– |
double* sigma, |
55 |
– |
int* status ), |
56 |
– |
void (*p2)( int *nLocal, |
57 |
– |
int *identArray, |
58 |
– |
int *isError ), |
59 |
– |
void (*p3)( double* positionArray, |
60 |
– |
double* forceArray, |
61 |
– |
double* potentialEnergy, |
62 |
– |
double* tau, |
63 |
– |
short int* doPotentialCalc, |
64 |
– |
int* isError)), |
65 |
– |
int forceNameLength ); |
66 |
– |
} |
67 |
– |
|
68 |
– |
|
69 |
– |
void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, |
70 |
– |
double* sigma, int* status ), |
71 |
– |
void (*p2)( int *nLocal, int *identArray, int *isError ), |
72 |
– |
void (*p3)( double* positionArray,double* forceArray, |
73 |
– |
double* potentialEnergy, double* tau, |
74 |
– |
short int* doPotentialCalc, int* isError ) ); |
75 |
– |
|
76 |
– |
void (*newLJtype)( int* ident, double* mass, double* epslon, double* sigma, |
77 |
– |
int* status ); |
78 |
– |
|
79 |
– |
void (*initLJfortran) ( int *nLocal, int *identArray, int *isError ); |
80 |
– |
|
81 |
– |
LJ_FF* currentLJwrap; |
47 |
|
|
48 |
|
|
49 |
|
//**************************************************************** |
60 |
|
char errMsg[1000]; |
61 |
|
|
62 |
|
// do the funtion wrapping |
63 |
< |
currentLJwrap = this; |
99 |
< |
wrapMe(); |
63 |
> |
wrapMeFF( this ); |
64 |
|
|
65 |
|
#ifdef IS_MPI |
66 |
|
int i; |
159 |
|
} |
160 |
|
|
161 |
|
|
198 |
– |
void LJ_FF::wrapMe( void ){ |
199 |
– |
|
200 |
– |
char* currentFF = "LJ"; |
201 |
– |
int isError = 0; |
202 |
– |
|
203 |
– |
forcefactory_( currentFF, &isError, LJfunctionWrapper, strlen(currentFF) ); |
162 |
|
|
205 |
– |
if( isError ){ |
206 |
– |
|
207 |
– |
sprintf( painCave.errMsg, |
208 |
– |
"LJ_FF error: an error was returned from fortran when the " |
209 |
– |
"the functions were being wrapped.\n" ); |
210 |
– |
painCave.isFatal = 1; |
211 |
– |
simError(); |
212 |
– |
} |
213 |
– |
|
214 |
– |
#ifdef IS_MPI |
215 |
– |
sprintf( checkPointMsg, "LJ_FF functions succesfully wrapped." ); |
216 |
– |
MPIcheckPoint(); |
217 |
– |
#endif // is_mpi |
218 |
– |
} |
219 |
– |
|
220 |
– |
|
221 |
– |
void LJfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, |
222 |
– |
double* sigma, int* status ), |
223 |
– |
void (*p2)( int*, int*, int* ), |
224 |
– |
void (*p3)( double*,double*,double*,double*, |
225 |
– |
short int*, int* ) ){ |
226 |
– |
|
227 |
– |
|
228 |
– |
newLJtype = p1; |
229 |
– |
initLJfortran = p2; |
230 |
– |
currentLJwrap->setLJfortran( p3 ); |
231 |
– |
} |
232 |
– |
|
233 |
– |
|
234 |
– |
|
163 |
|
void LJ_FF::initializeAtoms( void ){ |
164 |
|
|
165 |
|
class LinkedType { |