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(){ |
16 |
|
n_constraints = 0; |
17 |
|
n_oriented = 0; |
18 |
|
n_dipoles = 0; |
19 |
– |
longRange = NULL; |
19 |
|
the_integrator = NULL; |
20 |
|
setTemp = 0; |
21 |
|
thermalTime = 0.0; |
22 |
|
|
23 |
< |
currentInfo = this; |
25 |
< |
wrapMe(); |
23 |
> |
wrapMeSimInfo( this ); |
24 |
|
} |
25 |
|
|
26 |
+ |
void SimInfo::refreshSim(){ |
27 |
|
|
28 |
< |
void SimInfo::wrapMe(){ |
28 |
> |
simtype fInfo; |
29 |
> |
int isError; |
30 |
|
|
31 |
< |
wrapsimmod_( wrapSimInfo ); |
32 |
< |
} |
31 |
> |
fInfo.box[0] = box_x; |
32 |
> |
fInfo.box[1] = box_y; |
33 |
> |
fInfo.box[2] = box_z; |
34 |
|
|
35 |
+ |
fInfo.rlist = rList; |
36 |
+ |
fInfo.rcut = rCut; |
37 |
+ |
fInfo.rlistsq = rlist * rlist; |
38 |
+ |
fInfo.rcutsq = rCut * rCut; |
39 |
+ |
fInfo.rcut6 = fInfo.rcutsq * fInfo.rcutsq * fInfo.rcutsq; |
40 |
+ |
fInfo.natoms = n_atoms; |
41 |
+ |
fInfo.usePBC = usePBC; |
42 |
+ |
strcpy( fInfo.ensemble, ensemble ); |
43 |
+ |
strcpy( fInfo.mixingRule, mixingRule ); |
44 |
|
|
45 |
< |
void SimInfo::refreshSim(){ |
46 |
< |
|
37 |
< |
double box[3]; |
38 |
< |
|
39 |
< |
box[0] = box_x; |
40 |
< |
box[1] = box_y; |
41 |
< |
box[2] = box_z; |
45 |
> |
isError = 0; |
46 |
> |
setFsimulation( &fInfo, &isError ); |
47 |
|
|
48 |
< |
setFsimulation( &n_atoms, box, &rList, &rCut ); |
44 |
< |
} |
48 |
> |
if( isError ){ |
49 |
|
|
50 |
+ |
sprintf( painCave.errMsg, |
51 |
+ |
"There was an error setting the simulation information in fortran.\n" ); |
52 |
+ |
painCave.isFatal = 1; |
53 |
+ |
simError(); |
54 |
+ |
} |
55 |
|
|
56 |
< |
void wrapSimInfo(void (*fSub)( int*, double*, double*, double*)){ |
57 |
< |
|
58 |
< |
currentInfo->setInternal(fSub); |
56 |
> |
#ifdef IS_MPI |
57 |
> |
sprintf( checkPointMsg, |
58 |
> |
"succesfully sent the simulation information to fortran.\n"); |
59 |
> |
MPIcheckPoint(); |
60 |
> |
#endif // is_mpi |
61 |
|
} |
62 |
+ |
|