1 |
mmeineke |
270 |
#include <cstdlib> |
2 |
chuckv |
290 |
#include <cstring> |
3 |
mmeineke |
270 |
|
4 |
chuckv |
290 |
|
5 |
mmeineke |
270 |
#include "SimInfo.hpp" |
6 |
mmeineke |
285 |
#define __C |
7 |
|
|
#include "fSimulation.h" |
8 |
chuckv |
290 |
#include "simError.h" |
9 |
|
|
|
10 |
mmeineke |
270 |
extern "C"{ |
11 |
chuckv |
290 |
void wrapsimmod_( void (*wrapFunction)(void (*fSub)( simtype*, int* ))); |
12 |
mmeineke |
270 |
} |
13 |
|
|
|
14 |
chuckv |
290 |
void wrapSimInfo(void (*fSub)( simtype*, int* )); |
15 |
mmeineke |
270 |
|
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 |
chuckv |
290 |
simtype fInfo; |
41 |
|
|
int isError; |
42 |
mmeineke |
285 |
|
43 |
chuckv |
290 |
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 |
mmeineke |
270 |
} |
74 |
|
|
|
75 |
chuckv |
290 |
void wrapSimInfo(void (*fSub)( simtype*, int* )){ |
76 |
mmeineke |
270 |
|
77 |
|
|
currentInfo->setInternal(fSub); |
78 |
|
|
} |