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)( simtype*, int* ))); |
12 |
} |
13 |
|
14 |
void wrapSimInfo(void (*fSub)( simtype*, int* )); |
15 |
|
16 |
SimInfo* currentInfo; |
17 |
|
18 |
SimInfo::SimInfo(){ |
19 |
excludes = NULL; |
20 |
n_constraints = 0; |
21 |
n_oriented = 0; |
22 |
n_dipoles = 0; |
23 |
the_integrator = NULL; |
24 |
setTemp = 0; |
25 |
thermalTime = 0.0; |
26 |
|
27 |
currentInfo = this; |
28 |
wrapMe(); |
29 |
} |
30 |
|
31 |
|
32 |
void SimInfo::wrapMe(){ |
33 |
|
34 |
wrapsimmod_( wrapSimInfo ); |
35 |
} |
36 |
|
37 |
|
38 |
void SimInfo::refreshSim(){ |
39 |
|
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 |
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 |
} |