9 |
|
#include "SRI.hpp" |
10 |
|
#include "simError.h" |
11 |
|
|
12 |
+ |
#include <fortranWrappers.hpp> |
13 |
+ |
|
14 |
|
#ifdef IS_MPI |
15 |
|
#include "mpiForceField.h" |
16 |
|
#endif // is_mpi |
86 |
|
|
87 |
|
} // namespace |
88 |
|
|
87 |
– |
|
88 |
– |
// declaration of functions needed to wrap the fortran module |
89 |
– |
|
90 |
– |
extern "C" { |
91 |
– |
|
92 |
– |
void forcefactory_( char* forceName, |
93 |
– |
int* status, |
94 |
– |
void (*wrapFunction)( void (*p1)( int* ident, |
95 |
– |
double* mass, |
96 |
– |
double* epslon, |
97 |
– |
double* sigma, |
98 |
– |
int* isDipole, |
99 |
– |
int* isSSd, |
100 |
– |
double* dipole, |
101 |
– |
double* w0, |
102 |
– |
double* v0, |
103 |
– |
int* status ), |
104 |
– |
void (*p2)( int *nLocal, |
105 |
– |
int *identArray, |
106 |
– |
int *isError ), |
107 |
– |
void (*p3)( double* positionArray, |
108 |
– |
double* forceArray, |
109 |
– |
double* potentialEnergy, |
110 |
– |
double* tau, |
111 |
– |
short int* doPotentialCalc, |
112 |
– |
int* isError)), |
113 |
– |
int forceNameLength ); |
114 |
– |
} |
115 |
– |
|
116 |
– |
|
117 |
– |
void TPEfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, |
118 |
– |
double* sigma, int* isDipole, int* isSSD, |
119 |
– |
double* dipole, double* w0, double* v0, |
120 |
– |
int* status ), |
121 |
– |
void (*p2)( int *nLocal, int *identArray, int *isError ), |
122 |
– |
void (*p3)( double* positionArray,double* forceArray, |
123 |
– |
double* potentialEnergy, double* tau, |
124 |
– |
short int* doPotentialCalc, int* isError ) ); |
125 |
– |
|
126 |
– |
void (*newTPEtype)( int* ident, double* mass, double* epslon, double* sigma, |
127 |
– |
int* isDipole, int* isSSD, double* dipole, double* w0, |
128 |
– |
double* v0, int* status ); |
129 |
– |
|
130 |
– |
void (*initTPEfortran) ( int *nLocal, int *identArray, int *isError ); |
131 |
– |
|
132 |
– |
TraPPE_ExFF* currentTPEwrap; |
133 |
– |
|
89 |
|
using namespace TPE; |
90 |
|
|
91 |
|
|
103 |
|
char errMsg[1000]; |
104 |
|
|
105 |
|
// do the funtion wrapping |
106 |
< |
currentTPEwrap = this; |
152 |
< |
wrapMe(); |
106 |
> |
wrapMeFF( this ); |
107 |
|
|
108 |
|
|
109 |
|
#ifdef IS_MPI |
270 |
|
} |
271 |
|
|
272 |
|
|
319 |
– |
void TraPPE_ExFF::wrapMe( void ){ |
320 |
– |
|
321 |
– |
char* currentFF = "TraPPE_Ex"; |
322 |
– |
int isError = 0; |
323 |
– |
|
324 |
– |
forcefactory_( currentFF, &isError, TPEfunctionWrapper, strlen(currentFF) ); |
325 |
– |
|
326 |
– |
if( isError ){ |
327 |
– |
|
328 |
– |
sprintf( painCave.errMsg, |
329 |
– |
"TraPPE_ExFF error: an error was returned from fortran when the " |
330 |
– |
"the functions were being wrapped.\n" ); |
331 |
– |
painCave.isFatal = 1; |
332 |
– |
simError(); |
333 |
– |
} |
334 |
– |
|
335 |
– |
#ifdef IS_MPI |
336 |
– |
sprintf( checkPointMsg, "TraPPE_ExFF functions succesfully wrapped." ); |
337 |
– |
MPIcheckPoint(); |
338 |
– |
#endif // is_mpi |
339 |
– |
} |
340 |
– |
|
341 |
– |
|
342 |
– |
void TPEfunctionWrapper( void (*p1)( int* ident, double* mass, double* epslon, |
343 |
– |
double* sigma, int* isDipole, |
344 |
– |
int* isSSD, double* dipole, double* w0, |
345 |
– |
double* v0, int* isError ), |
346 |
– |
void (*p2)( int*, int*, int* ), |
347 |
– |
void (*p3)( double*,double*,double*,double*, |
348 |
– |
short int*, int* ) ){ |
349 |
– |
|
350 |
– |
|
351 |
– |
newTPEtype = p1; |
352 |
– |
initTPEfortran = p2; |
353 |
– |
currentTPEwrap->setTPEfortran( p3 ); |
354 |
– |
} |
355 |
– |
|
356 |
– |
|
357 |
– |
|
273 |
|
void TraPPE_ExFF::initializeAtoms( void ){ |
274 |
|
|
275 |
|
class LinkedType { |