| 1 |
|
#include <cstdlib> |
| 2 |
+ |
#include <cstring> |
| 3 |
|
|
| 4 |
+ |
|
| 5 |
|
#include "SimInfo.hpp" |
| 6 |
+ |
#define __C |
| 7 |
+ |
#include "fSimulation.h" |
| 8 |
+ |
#include "simError.h" |
| 9 |
|
|
| 10 |
< |
extern "C"{ |
| 6 |
< |
void wrapsimmod_( void (*wrapFunction)(void (*fSub)( int*, double*, |
| 7 |
< |
double*, double*))); |
| 8 |
< |
} |
| 10 |
> |
#include <fortranWrappers.hpp> |
| 11 |
|
|
| 10 |
– |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)); |
| 11 |
– |
|
| 12 |
|
SimInfo* currentInfo; |
| 13 |
|
|
| 14 |
|
SimInfo::SimInfo(){ |
| 20 |
|
setTemp = 0; |
| 21 |
|
thermalTime = 0.0; |
| 22 |
|
|
| 23 |
< |
currentInfo = this; |
| 24 |
< |
wrapMe(); |
| 25 |
< |
} |
| 23 |
> |
usePBC = 0; |
| 24 |
> |
useLJ = 0; |
| 25 |
> |
useSticky = 0; |
| 26 |
> |
useDipole = 0; |
| 27 |
> |
useReactionField = 0; |
| 28 |
> |
useGB = 0; |
| 29 |
> |
useEAM = 0; |
| 30 |
|
|
| 31 |
|
|
| 28 |
– |
void SimInfo::wrapMe(){ |
| 32 |
|
|
| 33 |
< |
wrapsimmod_( wrapSimInfo ); |
| 33 |
> |
wrapMeSimInfo( this ); |
| 34 |
|
} |
| 35 |
|
|
| 33 |
– |
|
| 36 |
|
void SimInfo::refreshSim(){ |
| 35 |
– |
|
| 36 |
– |
double box[3]; |
| 37 |
– |
|
| 38 |
– |
box[0] = box_x; |
| 39 |
– |
box[1] = box_y; |
| 40 |
– |
box[2] = box_z; |
| 37 |
|
|
| 38 |
< |
setFsimulation( &n_atoms, box, &rList, &rCut ); |
| 39 |
< |
} |
| 38 |
> |
simtype fInfo; |
| 39 |
> |
int isError; |
| 40 |
|
|
| 41 |
+ |
fInfo.box[0] = box_x; |
| 42 |
+ |
fInfo.box[1] = box_y; |
| 43 |
+ |
fInfo.box[2] = box_z; |
| 44 |
|
|
| 45 |
< |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)){ |
| 46 |
< |
|
| 47 |
< |
currentInfo->setInternal(fSub); |
| 45 |
> |
fInfo.rlist = rList; |
| 46 |
> |
fInfo.rcut = rCut; |
| 47 |
> |
fInfo.rrf = rRF; |
| 48 |
> |
fInfo.rt = 0.95 * rRF; |
| 49 |
> |
fInfo.dielect = dielectric; |
| 50 |
> |
|
| 51 |
> |
|
| 52 |
> |
fInfo.SIM_uses_PBC = usePBC; |
| 53 |
> |
fInfo.SIM_uses_LJ = useLJ; |
| 54 |
> |
fInfo.SIM_uses_sticky = useSticky; |
| 55 |
> |
fInfo.SIM_uses_dipoles = useDipole; |
| 56 |
> |
fInfo.SIM_uses_RF = useReactionField; |
| 57 |
> |
fInfo.SIM_uses_GB = useGB; |
| 58 |
> |
fInfo.SIM_uses_EAM = useEAM; |
| 59 |
> |
|
| 60 |
> |
|
| 61 |
> |
isError = 0; |
| 62 |
> |
|
| 63 |
> |
fInfo; |
| 64 |
> |
n_atoms; |
| 65 |
> |
identArray; |
| 66 |
> |
n_exclude; |
| 67 |
> |
excludes; |
| 68 |
> |
nGlobalExcludes; |
| 69 |
> |
globalExcludes; |
| 70 |
> |
isError; |
| 71 |
> |
|
| 72 |
> |
setFsimulation( &fInfo, &n_atoms, identArray, &n_exclude, excludes, &nGlobalExcludes, globalExcludes, &isError ); |
| 73 |
> |
|
| 74 |
> |
if( isError ){ |
| 75 |
> |
|
| 76 |
> |
sprintf( painCave.errMsg, |
| 77 |
> |
"There was an error setting the simulation information in fortran.\n" ); |
| 78 |
> |
painCave.isFatal = 1; |
| 79 |
> |
simError(); |
| 80 |
> |
} |
| 81 |
> |
|
| 82 |
> |
#ifdef IS_MPI |
| 83 |
> |
sprintf( checkPointMsg, |
| 84 |
> |
"succesfully sent the simulation information to fortran.\n"); |
| 85 |
> |
MPIcheckPoint(); |
| 86 |
> |
#endif // is_mpi |
| 87 |
|
} |
| 88 |
+ |
|