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"{ |
11 |
< |
void wrapsimmod_( void (*wrapFunction)(void (*fSub)( int*, double*, |
7 |
< |
double*, double*))); |
11 |
> |
void wrapsimmod_( void (*wrapFunction)(void (*fSub)( simtype*, int* ))); |
12 |
|
} |
13 |
|
|
14 |
< |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)); |
14 |
> |
void wrapSimInfo(void (*fSub)( simtype*, int* )); |
15 |
|
|
16 |
|
SimInfo* currentInfo; |
17 |
|
|
36 |
|
|
37 |
|
|
38 |
|
void SimInfo::refreshSim(){ |
35 |
– |
|
36 |
– |
double box[3]; |
37 |
– |
|
38 |
– |
box[0] = box_x; |
39 |
– |
box[1] = box_y; |
40 |
– |
box[2] = box_z; |
39 |
|
|
40 |
< |
setFsimulation( &n_atoms, box, &rList, &rCut ); |
41 |
< |
} |
40 |
> |
simtype fInfo; |
41 |
> |
int isError; |
42 |
|
|
43 |
+ |
fInfo.box[0] = box_x; |
44 |
+ |
fInfo.box[1] = box_y; |
45 |
+ |
fInfo.box[2] = box_z; |
46 |
|
|
47 |
< |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)){ |
47 |
> |
fInfo.rlist = rList; |
48 |
> |
fInfo.rcut = rCut; |
49 |
> |
fInfo.rlistsq = rlist * rlist; |
50 |
> |
fInfo.rcutsq = rCut * rCut; |
51 |
> |
fInfo.rcut6 = fInfo.rcutsq * fInfo.rcutsq * fInfo.rcutsq; |
52 |
> |
fInfo.natoms = n_atoms; |
53 |
> |
fInfo.usePBC = usePBC; |
54 |
> |
strcpy( fInfo.ensemble, ensemble ); |
55 |
> |
strcpy( fInfo.mixingRule, mixingRule ); |
56 |
> |
|
57 |
> |
isError = 0; |
58 |
> |
setFsimulation( &fInfo, &isError ); |
59 |
> |
|
60 |
> |
if( isError ){ |
61 |
> |
|
62 |
> |
sprintf( painCave.errMsg, |
63 |
> |
"There was an error setting the simulation information in fortran.\n" ); |
64 |
> |
painCave.isFatal = 1; |
65 |
> |
simError(); |
66 |
> |
} |
67 |
> |
|
68 |
> |
#ifdef IS_MPI |
69 |
> |
sprintf( checkPointMsg, |
70 |
> |
"succesfully sent the simulation information to fortran.\n"); |
71 |
> |
MPIcheckPoint(); |
72 |
> |
#endif // is_mpi |
73 |
> |
} |
74 |
> |
|
75 |
> |
void wrapSimInfo(void (*fSub)( simtype*, int* )){ |
76 |
|
|
77 |
|
currentInfo->setInternal(fSub); |
78 |
|
} |