9 |
|
|
10 |
|
#include "fortranWrappers.hpp" |
11 |
|
|
12 |
+ |
#ifdef IS_MPI |
13 |
+ |
#include "mpiSimulation.hpp" |
14 |
+ |
#endif |
15 |
+ |
|
16 |
|
SimInfo* currentInfo; |
17 |
|
|
18 |
|
SimInfo::SimInfo(){ |
39 |
|
} |
40 |
|
|
41 |
|
void SimInfo::setBox(double newBox[3]) { |
42 |
+ |
double smallestBox, maxCutoff; |
43 |
+ |
int status; |
44 |
|
box_x = newBox[0]; |
45 |
|
box_y = newBox[1]; |
46 |
|
box_z = newBox[2]; |
47 |
|
setFortranBoxSize(newBox); |
48 |
+ |
|
49 |
+ |
smallestBox = box_x; |
50 |
+ |
if (box_y < smallestBox) smallestBox = box_y; |
51 |
+ |
if (box_z < smallestBox) smallestBox = box_z; |
52 |
+ |
|
53 |
+ |
maxCutoff = smallestBox / 2.0; |
54 |
+ |
|
55 |
+ |
if (rList > maxCutoff) { |
56 |
+ |
sprintf( painCave.errMsg, |
57 |
+ |
"New Box size is forcing neighborlist radius down to %lf\n", |
58 |
+ |
maxCutoff ); |
59 |
+ |
painCave.isFatal = 0; |
60 |
+ |
simError(); |
61 |
+ |
|
62 |
+ |
rList = maxCutoff; |
63 |
+ |
|
64 |
+ |
sprintf( painCave.errMsg, |
65 |
+ |
"New Box size is forcing cutoff radius down to %lf\n", |
66 |
+ |
maxCutoff - 1.0 ); |
67 |
+ |
painCave.isFatal = 0; |
68 |
+ |
simError(); |
69 |
+ |
|
70 |
+ |
rCut = rList - 1.0; |
71 |
+ |
|
72 |
+ |
// list radius changed so we have to refresh the simulation structure. |
73 |
+ |
refreshSim(); |
74 |
+ |
} |
75 |
+ |
|
76 |
+ |
if (rCut > maxCutoff) { |
77 |
+ |
sprintf( painCave.errMsg, |
78 |
+ |
"New Box size is forcing cutoff radius down to %lf\n", |
79 |
+ |
maxCutoff ); |
80 |
+ |
painCave.isFatal = 0; |
81 |
+ |
simError(); |
82 |
+ |
|
83 |
+ |
status = 0; |
84 |
+ |
LJ_new_rcut(&rCut, &status); |
85 |
+ |
if (status != 0) { |
86 |
+ |
sprintf( painCave.errMsg, |
87 |
+ |
"Error in recomputing LJ shifts based on new rcut\n"); |
88 |
+ |
painCave.isFatal = 1; |
89 |
+ |
simError(); |
90 |
+ |
} |
91 |
+ |
} |
92 |
|
} |
93 |
|
|
94 |
|
void SimInfo::getBox(double theBox[3]) { |
132 |
|
|
133 |
|
simtype fInfo; |
134 |
|
int isError; |
135 |
+ |
int n_global; |
136 |
|
int* excl; |
137 |
+ |
|
138 |
+ |
fInfo.rrf = 0.0; |
139 |
+ |
fInfo.rt = 0.0; |
140 |
+ |
fInfo.dielect = 0.0; |
141 |
|
|
142 |
|
fInfo.box[0] = box_x; |
143 |
|
fInfo.box[1] = box_y; |
145 |
|
|
146 |
|
fInfo.rlist = rList; |
147 |
|
fInfo.rcut = rCut; |
93 |
– |
fInfo.rrf = ecr; |
94 |
– |
fInfo.rt = ecr - est; |
95 |
– |
fInfo.dielect = dielectric; |
148 |
|
|
149 |
+ |
if( useDipole ){ |
150 |
+ |
fInfo.rrf = ecr; |
151 |
+ |
fInfo.rt = ecr - est; |
152 |
+ |
if( useReactionField )fInfo.dielect = dielectric; |
153 |
+ |
} |
154 |
+ |
|
155 |
|
fInfo.SIM_uses_PBC = usePBC; |
156 |
|
//fInfo.SIM_uses_LJ = 0; |
157 |
|
fInfo.SIM_uses_LJ = useLJ; |
166 |
|
|
167 |
|
excl = Exclude::getArray(); |
168 |
|
|
169 |
+ |
#ifdef IS_MPI |
170 |
+ |
n_global = mpiSim->getTotAtoms(); |
171 |
+ |
#else |
172 |
+ |
n_global = n_atoms; |
173 |
+ |
#endif |
174 |
+ |
|
175 |
|
isError = 0; |
176 |
|
|
177 |
< |
// fInfo; |
178 |
< |
// n_atoms; |
179 |
< |
// identArray; |
116 |
< |
// n_exclude; |
117 |
< |
// excludes; |
118 |
< |
// nGlobalExcludes; |
119 |
< |
// globalExcludes; |
120 |
< |
// isError; |
177 |
> |
setFsimulation( &fInfo, &n_global, &n_atoms, identArray, &n_exclude, excl, |
178 |
> |
&nGlobalExcludes, globalExcludes, molMembershipArray, |
179 |
> |
&isError ); |
180 |
|
|
122 |
– |
setFsimulation( &fInfo, &n_atoms, identArray, &n_exclude, excl, |
123 |
– |
&nGlobalExcludes, globalExcludes, &isError ); |
124 |
– |
|
181 |
|
if( isError ){ |
182 |
|
|
183 |
|
sprintf( painCave.errMsg, |
192 |
|
MPIcheckPoint(); |
193 |
|
#endif // is_mpi |
194 |
|
|
195 |
< |
ndf = this->getNDF(); |
196 |
< |
ndfRaw = this->getNDFraw(); |
195 |
> |
this->ndf = this->getNDF(); |
196 |
> |
this->ndfRaw = this->getNDFraw(); |
197 |
|
|
198 |
|
} |
199 |
|
|