1 |
|
#include <algorithm> |
2 |
< |
#include <cstdlib> |
2 |
> |
#include <stdlib.h> |
3 |
|
#include <iostream> |
4 |
< |
#include <cmath> |
4 |
> |
#include <math.h> |
5 |
|
#include <string> |
6 |
< |
|
6 |
> |
#include <sprng.h> |
7 |
|
#include "SimSetup.hpp" |
8 |
+ |
#include "ReadWrite.hpp" |
9 |
|
#include "parse_me.h" |
10 |
|
#include "Integrator.hpp" |
11 |
|
#include "simError.h" |
12 |
+ |
#include "RigidBody.hpp" |
13 |
+ |
//#include "ConjugateMinimizer.hpp" |
14 |
+ |
#include "OOPSEMinimizer.hpp" |
15 |
|
|
16 |
|
#ifdef IS_MPI |
17 |
|
#include "mpiBASS.h" |
24 |
|
#define NVT_ENS 1 |
25 |
|
#define NPTi_ENS 2 |
26 |
|
#define NPTf_ENS 3 |
27 |
< |
#define NPTim_ENS 4 |
24 |
< |
#define NPTfm_ENS 5 |
27 |
> |
#define NPTxyz_ENS 4 |
28 |
|
|
26 |
– |
#define FF_DUFF 0 |
27 |
– |
#define FF_LJ 1 |
28 |
– |
#define FF_EAM 2 |
29 |
|
|
30 |
+ |
#define FF_DUFF 0 |
31 |
+ |
#define FF_LJ 1 |
32 |
+ |
#define FF_EAM 2 |
33 |
+ |
#define FF_H2O 3 |
34 |
+ |
|
35 |
|
using namespace std; |
36 |
|
|
37 |
+ |
/** |
38 |
+ |
* Check whether dividend is divisble by divisor or not |
39 |
+ |
*/ |
40 |
+ |
bool isDivisible(double dividend, double divisor){ |
41 |
+ |
double tolerance = 0.000001; |
42 |
+ |
double quotient; |
43 |
+ |
double diff; |
44 |
+ |
int intQuotient; |
45 |
+ |
|
46 |
+ |
quotient = dividend / divisor; |
47 |
+ |
|
48 |
+ |
if (quotient < 0) |
49 |
+ |
quotient = -quotient; |
50 |
+ |
|
51 |
+ |
intQuotient = int (quotient + tolerance); |
52 |
+ |
|
53 |
+ |
diff = fabs(fabs(dividend) - intQuotient * fabs(divisor)); |
54 |
+ |
|
55 |
+ |
if (diff <= tolerance) |
56 |
+ |
return true; |
57 |
+ |
else |
58 |
+ |
return false; |
59 |
+ |
} |
60 |
+ |
|
61 |
|
SimSetup::SimSetup(){ |
62 |
|
|
63 |
+ |
initSuspend = false; |
64 |
|
isInfoArray = 0; |
65 |
|
nInfo = 1; |
66 |
< |
|
66 |
> |
|
67 |
|
stamps = new MakeStamps(); |
68 |
|
globals = new Globals(); |
69 |
< |
|
70 |
< |
|
69 |
> |
|
70 |
> |
|
71 |
|
#ifdef IS_MPI |
72 |
< |
strcpy( checkPointMsg, "SimSetup creation successful" ); |
72 |
> |
strcpy(checkPointMsg, "SimSetup creation successful"); |
73 |
|
MPIcheckPoint(); |
74 |
|
#endif // IS_MPI |
75 |
|
} |
79 |
|
delete globals; |
80 |
|
} |
81 |
|
|
82 |
< |
void SimSetup::setSimInfo( SimInfo* the_info, int theNinfo ) { |
83 |
< |
info = the_info; |
84 |
< |
nInfo = theNinfo; |
85 |
< |
isInfoArray = 1; |
82 |
> |
void SimSetup::setSimInfo(SimInfo* the_info, int theNinfo){ |
83 |
> |
info = the_info; |
84 |
> |
nInfo = theNinfo; |
85 |
> |
isInfoArray = 1; |
86 |
> |
initSuspend = true; |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
< |
void SimSetup::parseFile( char* fileName ){ |
60 |
< |
|
90 |
> |
void SimSetup::parseFile(char* fileName){ |
91 |
|
#ifdef IS_MPI |
92 |
< |
if( worldRank == 0 ){ |
92 |
> |
if (worldRank == 0){ |
93 |
|
#endif // is_mpi |
94 |
< |
|
94 |
> |
|
95 |
|
inFileName = fileName; |
96 |
< |
set_interface_stamps( stamps, globals ); |
97 |
< |
|
96 |
> |
set_interface_stamps(stamps, globals); |
97 |
> |
|
98 |
|
#ifdef IS_MPI |
99 |
|
mpiEventInit(); |
100 |
|
#endif |
101 |
|
|
102 |
< |
yacc_BASS( fileName ); |
102 |
> |
yacc_BASS(fileName); |
103 |
|
|
104 |
|
#ifdef IS_MPI |
105 |
|
throwMPIEvent(NULL); |
106 |
|
} |
107 |
< |
else receiveParse(); |
107 |
> |
else{ |
108 |
> |
receiveParse(); |
109 |
> |
} |
110 |
|
#endif |
111 |
|
|
112 |
|
} |
113 |
|
|
114 |
|
#ifdef IS_MPI |
115 |
|
void SimSetup::receiveParse(void){ |
116 |
< |
|
117 |
< |
set_interface_stamps( stamps, globals ); |
118 |
< |
mpiEventInit(); |
119 |
< |
MPIcheckPoint(); |
88 |
< |
mpiEventLoop(); |
89 |
< |
|
116 |
> |
set_interface_stamps(stamps, globals); |
117 |
> |
mpiEventInit(); |
118 |
> |
MPIcheckPoint(); |
119 |
> |
mpiEventLoop(); |
120 |
|
} |
121 |
|
|
122 |
|
#endif // is_mpi |
123 |
|
|
124 |
|
void SimSetup::createSim(void){ |
125 |
|
|
96 |
– |
int i, j, k, globalAtomIndex; |
97 |
– |
|
126 |
|
// gather all of the information from the Bass file |
127 |
< |
|
127 |
> |
|
128 |
|
gatherInfo(); |
129 |
|
|
130 |
|
// creation of complex system objects |
132 |
|
sysObjectsCreation(); |
133 |
|
|
134 |
|
// check on the post processing info |
135 |
< |
|
135 |
> |
|
136 |
|
finalInfoCheck(); |
137 |
|
|
138 |
|
// initialize the system coordinates |
139 |
|
|
140 |
< |
if( !isInfoArray ) initSystemCoords(); |
140 |
> |
if ( !initSuspend ){ |
141 |
> |
initSystemCoords(); |
142 |
|
|
143 |
+ |
if( !(globals->getUseInitTime()) ) |
144 |
+ |
info[0].currentTime = 0.0; |
145 |
+ |
} |
146 |
+ |
|
147 |
|
// make the output filenames |
148 |
|
|
149 |
|
makeOutNames(); |
150 |
< |
|
151 |
< |
// make the integrator |
150 |
> |
|
151 |
> |
if (globals->haveMinimizer()) |
152 |
> |
// make minimizer |
153 |
> |
makeMinimizer(); |
154 |
> |
else |
155 |
> |
// make the integrator |
156 |
> |
makeIntegrator(); |
157 |
|
|
120 |
– |
makeIntegrator(); |
121 |
– |
|
158 |
|
#ifdef IS_MPI |
159 |
|
mpiSim->mpiRefresh(); |
160 |
|
#endif |
162 |
|
// initialize the Fortran |
163 |
|
|
164 |
|
initFortran(); |
129 |
– |
|
130 |
– |
|
131 |
– |
|
165 |
|
} |
166 |
|
|
167 |
|
|
168 |
< |
void SimSetup::makeMolecules( void ){ |
169 |
< |
|
170 |
< |
int k,l; |
171 |
< |
int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; |
168 |
> |
void SimSetup::makeMolecules(void){ |
169 |
> |
int i, j, k; |
170 |
> |
int exI, exJ, exK, exL, slI; |
171 |
> |
int tempI, tempJ, tempK, tempL; |
172 |
> |
int molI; |
173 |
> |
int stampID, atomOffset, rbOffset; |
174 |
|
molInit molInfo; |
175 |
|
DirectionalAtom* dAtom; |
176 |
+ |
RigidBody* myRB; |
177 |
+ |
StuntDouble* mySD; |
178 |
|
LinkedAssign* extras; |
179 |
|
LinkedAssign* current_extra; |
180 |
|
AtomStamp* currentAtom; |
181 |
|
BondStamp* currentBond; |
182 |
|
BendStamp* currentBend; |
183 |
|
TorsionStamp* currentTorsion; |
184 |
+ |
RigidBodyStamp* currentRigidBody; |
185 |
|
|
186 |
|
bond_pair* theBonds; |
187 |
|
bend_set* theBends; |
188 |
|
torsion_set* theTorsions; |
189 |
|
|
190 |
< |
|
190 |
> |
set<int> skipList; |
191 |
> |
|
192 |
> |
double phi, theta, psi; |
193 |
> |
|
194 |
|
//init the forceField paramters |
195 |
|
|
196 |
|
the_ff->readParams(); |
197 |
|
|
157 |
– |
|
198 |
|
// init the atoms |
199 |
|
|
200 |
< |
double ux, uy, uz, u, uSqr; |
161 |
< |
|
162 |
< |
for(k=0; k<nInfo; k++){ |
163 |
< |
|
164 |
< |
the_ff->setSimInfo( &(info[k]) ); |
200 |
> |
int nMembers, nNew, rb1, rb2; |
201 |
|
|
202 |
+ |
for (k = 0; k < nInfo; k++){ |
203 |
+ |
the_ff->setSimInfo(&(info[k])); |
204 |
+ |
|
205 |
|
atomOffset = 0; |
206 |
< |
excludeOffset = 0; |
207 |
< |
for(i=0; i<info[k].n_mol; i++){ |
169 |
< |
|
206 |
> |
|
207 |
> |
for (i = 0; i < info[k].n_mol; i++){ |
208 |
|
stampID = info[k].molecules[i].getStampID(); |
209 |
|
|
210 |
< |
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
211 |
< |
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
212 |
< |
molInfo.nBends = comp_stamps[stampID]->getNBends(); |
210 |
> |
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
211 |
> |
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
212 |
> |
molInfo.nBends = comp_stamps[stampID]->getNBends(); |
213 |
|
molInfo.nTorsions = comp_stamps[stampID]->getNTorsions(); |
214 |
< |
molInfo.nExcludes = molInfo.nBonds + molInfo.nBends + molInfo.nTorsions; |
214 |
> |
molInfo.nRigidBodies = comp_stamps[stampID]->getNRigidBodies(); |
215 |
|
|
216 |
|
molInfo.myAtoms = &(info[k].atoms[atomOffset]); |
179 |
– |
molInfo.myExcludes = &(info[k].excludes[excludeOffset]); |
180 |
– |
molInfo.myBonds = new Bond*[molInfo.nBonds]; |
181 |
– |
molInfo.myBends = new Bend*[molInfo.nBends]; |
182 |
– |
molInfo.myTorsions = new Torsion*[molInfo.nTorsions]; |
217 |
|
|
218 |
+ |
if (molInfo.nBonds > 0) |
219 |
+ |
molInfo.myBonds = new (Bond *) [molInfo.nBonds]; |
220 |
+ |
else |
221 |
+ |
molInfo.myBonds = NULL; |
222 |
+ |
|
223 |
+ |
if (molInfo.nBends > 0) |
224 |
+ |
molInfo.myBends = new (Bend *) [molInfo.nBends]; |
225 |
+ |
else |
226 |
+ |
molInfo.myBends = NULL; |
227 |
+ |
|
228 |
+ |
if (molInfo.nTorsions > 0) |
229 |
+ |
molInfo.myTorsions = new (Torsion *) [molInfo.nTorsions]; |
230 |
+ |
else |
231 |
+ |
molInfo.myTorsions = NULL; |
232 |
+ |
|
233 |
|
theBonds = new bond_pair[molInfo.nBonds]; |
234 |
|
theBends = new bend_set[molInfo.nBends]; |
235 |
|
theTorsions = new torsion_set[molInfo.nTorsions]; |
236 |
< |
|
236 |
> |
|
237 |
|
// make the Atoms |
238 |
< |
|
239 |
< |
for(j=0; j<molInfo.nAtoms; j++){ |
240 |
< |
|
241 |
< |
currentAtom = comp_stamps[stampID]->getAtom( j ); |
242 |
< |
if( currentAtom->haveOrientation() ){ |
243 |
< |
|
244 |
< |
dAtom = new DirectionalAtom( (j + atomOffset), |
245 |
< |
info[k].getConfiguration() ); |
246 |
< |
info[k].n_oriented++; |
247 |
< |
molInfo.myAtoms[j] = dAtom; |
248 |
< |
|
249 |
< |
ux = currentAtom->getOrntX(); |
250 |
< |
uy = currentAtom->getOrntY(); |
251 |
< |
uz = currentAtom->getOrntZ(); |
252 |
< |
|
253 |
< |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
254 |
< |
|
255 |
< |
u = sqrt( uSqr ); |
256 |
< |
ux = ux / u; |
257 |
< |
uy = uy / u; |
258 |
< |
uz = uz / u; |
259 |
< |
|
260 |
< |
dAtom->setSUx( ux ); |
261 |
< |
dAtom->setSUy( uy ); |
262 |
< |
dAtom->setSUz( uz ); |
263 |
< |
} |
264 |
< |
else{ |
265 |
< |
molInfo.myAtoms[j] = new GeneralAtom( (j + atomOffset), |
217 |
< |
info[k].getConfiguration() ); |
218 |
< |
} |
219 |
< |
molInfo.myAtoms[j]->setType( currentAtom->getType() ); |
220 |
< |
|
238 |
> |
|
239 |
> |
for (j = 0; j < molInfo.nAtoms; j++){ |
240 |
> |
currentAtom = comp_stamps[stampID]->getAtom(j); |
241 |
> |
|
242 |
> |
if (currentAtom->haveOrientation()){ |
243 |
> |
dAtom = new DirectionalAtom((j + atomOffset), |
244 |
> |
info[k].getConfiguration()); |
245 |
> |
info[k].n_oriented++; |
246 |
> |
molInfo.myAtoms[j] = dAtom; |
247 |
> |
|
248 |
> |
// Directional Atoms have standard unit vectors which are oriented |
249 |
> |
// in space using the three Euler angles. We assume the standard |
250 |
> |
// unit vector was originally along the z axis below. |
251 |
> |
|
252 |
> |
phi = currentAtom->getEulerPhi() * M_PI / 180.0; |
253 |
> |
theta = currentAtom->getEulerTheta() * M_PI / 180.0; |
254 |
> |
psi = currentAtom->getEulerPsi()* M_PI / 180.0; |
255 |
> |
|
256 |
> |
dAtom->setUnitFrameFromEuler(phi, theta, psi); |
257 |
> |
|
258 |
> |
} |
259 |
> |
else{ |
260 |
> |
|
261 |
> |
molInfo.myAtoms[j] = new Atom((j + atomOffset), info[k].getConfiguration()); |
262 |
> |
} |
263 |
> |
|
264 |
> |
molInfo.myAtoms[j]->setType(currentAtom->getType()); |
265 |
> |
|
266 |
|
#ifdef IS_MPI |
267 |
< |
|
268 |
< |
molInfo.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
269 |
< |
|
267 |
> |
|
268 |
> |
molInfo.myAtoms[j]->setGlobalIndex(globalIndex[j + atomOffset]); |
269 |
> |
|
270 |
|
#endif // is_mpi |
271 |
|
} |
272 |
< |
|
273 |
< |
// make the bonds |
274 |
< |
for(j=0; j<molInfo.nBonds; j++){ |
275 |
< |
|
276 |
< |
currentBond = comp_stamps[stampID]->getBond( j ); |
277 |
< |
theBonds[j].a = currentBond->getA() + atomOffset; |
278 |
< |
theBonds[j].b = currentBond->getB() + atomOffset; |
279 |
< |
|
280 |
< |
exI = theBonds[j].a; |
281 |
< |
exJ = theBonds[j].b; |
282 |
< |
|
283 |
< |
// exclude_I must always be the smaller of the pair |
284 |
< |
if( exI > exJ ){ |
285 |
< |
tempEx = exI; |
286 |
< |
exI = exJ; |
287 |
< |
exJ = tempEx; |
288 |
< |
} |
289 |
< |
#ifdef IS_MPI |
290 |
< |
tempEx = exI; |
291 |
< |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
292 |
< |
tempEx = exJ; |
248 |
< |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
249 |
< |
|
250 |
< |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
251 |
< |
#else // isn't MPI |
252 |
< |
|
253 |
< |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
254 |
< |
#endif //is_mpi |
255 |
< |
} |
256 |
< |
excludeOffset += molInfo.nBonds; |
257 |
< |
|
272 |
> |
|
273 |
> |
// make the bonds |
274 |
> |
for (j = 0; j < molInfo.nBonds; j++){ |
275 |
> |
currentBond = comp_stamps[stampID]->getBond(j); |
276 |
> |
theBonds[j].a = currentBond->getA() + atomOffset; |
277 |
> |
theBonds[j].b = currentBond->getB() + atomOffset; |
278 |
> |
|
279 |
> |
tempI = theBonds[j].a; |
280 |
> |
tempJ = theBonds[j].b; |
281 |
> |
|
282 |
> |
#ifdef IS_MPI |
283 |
> |
exI = info[k].atoms[tempI]->getGlobalIndex() + 1; |
284 |
> |
exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1; |
285 |
> |
#else |
286 |
> |
exI = tempI + 1; |
287 |
> |
exJ = tempJ + 1; |
288 |
> |
#endif |
289 |
> |
|
290 |
> |
info[k].excludes->addPair(exI, exJ); |
291 |
> |
} |
292 |
> |
|
293 |
|
//make the bends |
294 |
< |
for(j=0; j<molInfo.nBends; j++){ |
295 |
< |
|
296 |
< |
currentBend = comp_stamps[stampID]->getBend( j ); |
297 |
< |
theBends[j].a = currentBend->getA() + atomOffset; |
298 |
< |
theBends[j].b = currentBend->getB() + atomOffset; |
299 |
< |
theBends[j].c = currentBend->getC() + atomOffset; |
300 |
< |
|
301 |
< |
if( currentBend->haveExtras() ){ |
302 |
< |
|
303 |
< |
extras = currentBend->getExtras(); |
304 |
< |
current_extra = extras; |
305 |
< |
|
306 |
< |
while( current_extra != NULL ){ |
307 |
< |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
308 |
< |
|
309 |
< |
switch( current_extra->getType() ){ |
310 |
< |
|
311 |
< |
case 0: |
312 |
< |
theBends[j].ghost = |
313 |
< |
current_extra->getInt() + atomOffset; |
314 |
< |
theBends[j].isGhost = 1; |
315 |
< |
break; |
316 |
< |
|
317 |
< |
case 1: |
318 |
< |
theBends[j].ghost = |
319 |
< |
(int)current_extra->getDouble() + atomOffset; |
320 |
< |
theBends[j].isGhost = 1; |
321 |
< |
break; |
322 |
< |
|
323 |
< |
default: |
324 |
< |
sprintf( painCave.errMsg, |
325 |
< |
"SimSetup Error: ghostVectorSource was neither a " |
326 |
< |
"double nor an int.\n" |
327 |
< |
"-->Bend[%d] in %s\n", |
328 |
< |
j, comp_stamps[stampID]->getID() ); |
329 |
< |
painCave.isFatal = 1; |
330 |
< |
simError(); |
331 |
< |
} |
332 |
< |
} |
333 |
< |
|
334 |
< |
else{ |
335 |
< |
|
336 |
< |
sprintf( painCave.errMsg, |
337 |
< |
"SimSetup Error: unhandled bend assignment:\n" |
338 |
< |
" -->%s in Bend[%d] in %s\n", |
339 |
< |
current_extra->getlhs(), |
340 |
< |
j, comp_stamps[stampID]->getID() ); |
341 |
< |
painCave.isFatal = 1; |
342 |
< |
simError(); |
343 |
< |
} |
344 |
< |
|
345 |
< |
current_extra = current_extra->getNext(); |
311 |
< |
} |
312 |
< |
} |
313 |
< |
|
314 |
< |
if( !theBends[j].isGhost ){ |
315 |
< |
|
316 |
< |
exI = theBends[j].a; |
317 |
< |
exJ = theBends[j].c; |
318 |
< |
} |
319 |
< |
else{ |
320 |
< |
|
321 |
< |
exI = theBends[j].a; |
322 |
< |
exJ = theBends[j].b; |
323 |
< |
} |
324 |
< |
|
325 |
< |
// exclude_I must always be the smaller of the pair |
326 |
< |
if( exI > exJ ){ |
327 |
< |
tempEx = exI; |
328 |
< |
exI = exJ; |
329 |
< |
exJ = tempEx; |
330 |
< |
} |
294 |
> |
for (j = 0; j < molInfo.nBends; j++){ |
295 |
> |
currentBend = comp_stamps[stampID]->getBend(j); |
296 |
> |
theBends[j].a = currentBend->getA() + atomOffset; |
297 |
> |
theBends[j].b = currentBend->getB() + atomOffset; |
298 |
> |
theBends[j].c = currentBend->getC() + atomOffset; |
299 |
> |
|
300 |
> |
if (currentBend->haveExtras()){ |
301 |
> |
extras = currentBend->getExtras(); |
302 |
> |
current_extra = extras; |
303 |
> |
|
304 |
> |
while (current_extra != NULL){ |
305 |
> |
if (!strcmp(current_extra->getlhs(), "ghostVectorSource")){ |
306 |
> |
switch (current_extra->getType()){ |
307 |
> |
case 0: |
308 |
> |
theBends[j].ghost = current_extra->getInt() + atomOffset; |
309 |
> |
theBends[j].isGhost = 1; |
310 |
> |
break; |
311 |
> |
|
312 |
> |
case 1: |
313 |
> |
theBends[j].ghost = (int) current_extra->getDouble() + |
314 |
> |
atomOffset; |
315 |
> |
theBends[j].isGhost = 1; |
316 |
> |
break; |
317 |
> |
|
318 |
> |
default: |
319 |
> |
sprintf(painCave.errMsg, |
320 |
> |
"SimSetup Error: ghostVectorSource was neither a " |
321 |
> |
"double nor an int.\n" |
322 |
> |
"-->Bend[%d] in %s\n", |
323 |
> |
j, comp_stamps[stampID]->getID()); |
324 |
> |
painCave.isFatal = 1; |
325 |
> |
simError(); |
326 |
> |
} |
327 |
> |
} |
328 |
> |
else{ |
329 |
> |
sprintf(painCave.errMsg, |
330 |
> |
"SimSetup Error: unhandled bend assignment:\n" |
331 |
> |
" -->%s in Bend[%d] in %s\n", |
332 |
> |
current_extra->getlhs(), j, comp_stamps[stampID]->getID()); |
333 |
> |
painCave.isFatal = 1; |
334 |
> |
simError(); |
335 |
> |
} |
336 |
> |
|
337 |
> |
current_extra = current_extra->getNext(); |
338 |
> |
} |
339 |
> |
} |
340 |
> |
|
341 |
> |
if (theBends[j].isGhost) { |
342 |
> |
|
343 |
> |
tempI = theBends[j].a; |
344 |
> |
tempJ = theBends[j].b; |
345 |
> |
|
346 |
|
#ifdef IS_MPI |
347 |
< |
tempEx = exI; |
348 |
< |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
349 |
< |
tempEx = exJ; |
350 |
< |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
351 |
< |
|
352 |
< |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
353 |
< |
#else // isn't MPI |
354 |
< |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
355 |
< |
#endif //is_mpi |
347 |
> |
exI = info[k].atoms[tempI]->getGlobalIndex() + 1; |
348 |
> |
exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1; |
349 |
> |
#else |
350 |
> |
exI = tempI + 1; |
351 |
> |
exJ = tempJ + 1; |
352 |
> |
#endif |
353 |
> |
info[k].excludes->addPair(exI, exJ); |
354 |
> |
|
355 |
> |
} else { |
356 |
> |
|
357 |
> |
tempI = theBends[j].a; |
358 |
> |
tempJ = theBends[j].b; |
359 |
> |
tempK = theBends[j].c; |
360 |
> |
|
361 |
> |
#ifdef IS_MPI |
362 |
> |
exI = info[k].atoms[tempI]->getGlobalIndex() + 1; |
363 |
> |
exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1; |
364 |
> |
exK = info[k].atoms[tempK]->getGlobalIndex() + 1; |
365 |
> |
#else |
366 |
> |
exI = tempI + 1; |
367 |
> |
exJ = tempJ + 1; |
368 |
> |
exK = tempK + 1; |
369 |
> |
#endif |
370 |
> |
|
371 |
> |
info[k].excludes->addPair(exI, exK); |
372 |
> |
info[k].excludes->addPair(exI, exJ); |
373 |
> |
info[k].excludes->addPair(exJ, exK); |
374 |
> |
} |
375 |
|
} |
376 |
< |
excludeOffset += molInfo.nBends; |
377 |
< |
|
378 |
< |
for(j=0; j<molInfo.nTorsions; j++){ |
379 |
< |
|
380 |
< |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
381 |
< |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
382 |
< |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
383 |
< |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
384 |
< |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
385 |
< |
|
386 |
< |
exI = theTorsions[j].a; |
387 |
< |
exJ = theTorsions[j].d; |
388 |
< |
|
355 |
< |
// exclude_I must always be the smaller of the pair |
356 |
< |
if( exI > exJ ){ |
357 |
< |
tempEx = exI; |
358 |
< |
exI = exJ; |
359 |
< |
exJ = tempEx; |
360 |
< |
} |
376 |
> |
|
377 |
> |
for (j = 0; j < molInfo.nTorsions; j++){ |
378 |
> |
currentTorsion = comp_stamps[stampID]->getTorsion(j); |
379 |
> |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
380 |
> |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
381 |
> |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
382 |
> |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
383 |
> |
|
384 |
> |
tempI = theTorsions[j].a; |
385 |
> |
tempJ = theTorsions[j].b; |
386 |
> |
tempK = theTorsions[j].c; |
387 |
> |
tempL = theTorsions[j].d; |
388 |
> |
|
389 |
|
#ifdef IS_MPI |
390 |
< |
tempEx = exI; |
391 |
< |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
392 |
< |
tempEx = exJ; |
393 |
< |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
394 |
< |
|
395 |
< |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
396 |
< |
#else // isn't MPI |
397 |
< |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
398 |
< |
#endif //is_mpi |
390 |
> |
exI = info[k].atoms[tempI]->getGlobalIndex() + 1; |
391 |
> |
exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1; |
392 |
> |
exK = info[k].atoms[tempK]->getGlobalIndex() + 1; |
393 |
> |
exL = info[k].atoms[tempL]->getGlobalIndex() + 1; |
394 |
> |
#else |
395 |
> |
exI = tempI + 1; |
396 |
> |
exJ = tempJ + 1; |
397 |
> |
exK = tempK + 1; |
398 |
> |
exL = tempL + 1; |
399 |
> |
#endif |
400 |
> |
|
401 |
> |
info[k].excludes->addPair(exI, exJ); |
402 |
> |
info[k].excludes->addPair(exI, exK); |
403 |
> |
info[k].excludes->addPair(exI, exL); |
404 |
> |
info[k].excludes->addPair(exJ, exK); |
405 |
> |
info[k].excludes->addPair(exJ, exL); |
406 |
> |
info[k].excludes->addPair(exK, exL); |
407 |
|
} |
408 |
< |
excludeOffset += molInfo.nTorsions; |
409 |
< |
|
408 |
> |
|
409 |
> |
for (j = 0; j < molInfo.nRigidBodies; j++){ |
410 |
> |
|
411 |
> |
currentRigidBody = comp_stamps[stampID]->getRigidBody(j); |
412 |
> |
nMembers = currentRigidBody->getNMembers(); |
413 |
> |
|
414 |
> |
// Create the Rigid Body: |
415 |
> |
|
416 |
> |
myRB = new RigidBody(); |
417 |
> |
|
418 |
> |
for (rb1 = 0; rb1 < nMembers; rb1++) { |
419 |
> |
|
420 |
> |
// molI is atom numbering inside this molecule |
421 |
> |
molI = currentRigidBody->getMember(rb1); |
422 |
> |
|
423 |
> |
// tempI is atom numbering on local processor |
424 |
> |
tempI = molI + atomOffset; |
425 |
> |
|
426 |
> |
// currentAtom is the AtomStamp (which we need for |
427 |
> |
// rigid body reference positions) |
428 |
> |
currentAtom = comp_stamps[stampID]->getAtom(molI); |
429 |
> |
|
430 |
> |
// When we add to the rigid body, add the atom itself and |
431 |
> |
// the stamp info: |
432 |
> |
|
433 |
> |
myRB->addAtom(info[k].atoms[tempI], currentAtom); |
434 |
> |
|
435 |
> |
// Add this atom to the Skip List for the integrators |
436 |
> |
#ifdef IS_MPI |
437 |
> |
slI = info[k].atoms[tempI]->getGlobalIndex(); |
438 |
> |
#else |
439 |
> |
slI = tempI; |
440 |
> |
#endif |
441 |
> |
skipList.insert(slI); |
442 |
> |
|
443 |
> |
} |
444 |
> |
|
445 |
> |
for(rb1 = 0; rb1 < nMembers - 1; rb1++) { |
446 |
> |
for(rb2 = rb1+1; rb2 < nMembers; rb2++) { |
447 |
> |
|
448 |
> |
tempI = currentRigidBody->getMember(rb1); |
449 |
> |
tempJ = currentRigidBody->getMember(rb2); |
450 |
> |
|
451 |
> |
// Some explanation is required here. |
452 |
> |
// Fortran indexing starts at 1, while c indexing starts at 0 |
453 |
> |
// Also, in parallel computations, the GlobalIndex is |
454 |
> |
// used for the exclude list: |
455 |
> |
|
456 |
> |
#ifdef IS_MPI |
457 |
> |
exI = info[k].atoms[tempI]->getGlobalIndex() + 1; |
458 |
> |
exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1; |
459 |
> |
#else |
460 |
> |
exI = tempI + 1; |
461 |
> |
exJ = tempJ + 1; |
462 |
> |
#endif |
463 |
> |
|
464 |
> |
info[k].excludes->addPair(exI, exJ); |
465 |
> |
|
466 |
> |
} |
467 |
> |
} |
468 |
> |
} |
469 |
|
|
470 |
|
// send the arrays off to the forceField for init. |
471 |
|
|
472 |
< |
the_ff->initializeAtoms( molInfo.nAtoms, molInfo.myAtoms ); |
473 |
< |
the_ff->initializeBonds( molInfo.nBonds, molInfo.myBonds, theBonds ); |
474 |
< |
the_ff->initializeBends( molInfo.nBends, molInfo.myBends, theBends ); |
475 |
< |
the_ff->initializeTorsions( molInfo.nTorsions, molInfo.myTorsions, theTorsions ); |
476 |
< |
|
382 |
< |
|
383 |
< |
info[k].molecules[i].initialize( molInfo ); |
472 |
> |
the_ff->initializeAtoms(molInfo.nAtoms, molInfo.myAtoms); |
473 |
> |
the_ff->initializeBonds(molInfo.nBonds, molInfo.myBonds, theBonds); |
474 |
> |
the_ff->initializeBends(molInfo.nBends, molInfo.myBends, theBends); |
475 |
> |
the_ff->initializeTorsions(molInfo.nTorsions, molInfo.myTorsions, |
476 |
> |
theTorsions); |
477 |
|
|
478 |
< |
|
478 |
> |
info[k].molecules[i].initialize(molInfo); |
479 |
> |
|
480 |
> |
|
481 |
|
atomOffset += molInfo.nAtoms; |
482 |
|
delete[] theBonds; |
483 |
|
delete[] theBends; |
484 |
|
delete[] theTorsions; |
485 |
|
} |
486 |
+ |
|
487 |
+ |
// build up the integrableObjects vector: |
488 |
+ |
|
489 |
+ |
for (i = 0; i < info[k].n_atoms; i++) { |
490 |
+ |
|
491 |
+ |
#ifdef IS_MPI |
492 |
+ |
slI = info[k].atoms[i]->getGlobalIndex(); |
493 |
+ |
#else |
494 |
+ |
slI = i; |
495 |
+ |
#endif |
496 |
+ |
|
497 |
+ |
if (skipList.find(slI) == skipList.end()) { |
498 |
+ |
mySD = (StuntDouble *) info[k].atoms[i]; |
499 |
+ |
info[k].integrableObjects.push_back(mySD); |
500 |
+ |
} |
501 |
+ |
} |
502 |
+ |
for (i = 0; i < info[k].rigidBodies.size(); i++) { |
503 |
+ |
mySD = (StuntDouble *) info[k].rigidBodies[i]; |
504 |
+ |
info[k].integrableObjects.push_back(mySD); |
505 |
+ |
} |
506 |
+ |
|
507 |
|
} |
508 |
< |
|
508 |
> |
|
509 |
|
#ifdef IS_MPI |
510 |
< |
sprintf( checkPointMsg, "all molecules initialized succesfully" ); |
510 |
> |
sprintf(checkPointMsg, "all molecules initialized succesfully"); |
511 |
|
MPIcheckPoint(); |
512 |
|
#endif // is_mpi |
513 |
< |
|
513 |
> |
|
514 |
|
// clean up the forcefield |
515 |
|
|
516 |
< |
the_ff->calcRcut(); |
516 |
> |
if (!globals->haveLJrcut()){ |
517 |
> |
|
518 |
> |
the_ff->calcRcut(); |
519 |
> |
|
520 |
> |
} else { |
521 |
> |
|
522 |
> |
the_ff->setRcut( globals->getLJrcut() ); |
523 |
> |
} |
524 |
> |
|
525 |
|
the_ff->cleanMe(); |
402 |
– |
|
526 |
|
} |
527 |
|
|
528 |
< |
void SimSetup::initFromBass( void ){ |
406 |
< |
|
528 |
> |
void SimSetup::initFromBass(void){ |
529 |
|
int i, j, k; |
530 |
|
int n_cells; |
531 |
|
double cellx, celly, cellz; |
539 |
|
vel[1] = 0.0; |
540 |
|
vel[2] = 0.0; |
541 |
|
|
542 |
< |
temp1 = (double)tot_nmol / 4.0; |
543 |
< |
temp2 = pow( temp1, ( 1.0 / 3.0 ) ); |
544 |
< |
temp3 = ceil( temp2 ); |
542 |
> |
temp1 = (double) tot_nmol / 4.0; |
543 |
> |
temp2 = pow(temp1, (1.0 / 3.0)); |
544 |
> |
temp3 = ceil(temp2); |
545 |
|
|
546 |
< |
have_extra =0; |
547 |
< |
if( temp2 < temp3 ){ // we have a non-complete lattice |
548 |
< |
have_extra =1; |
546 |
> |
have_extra = 0; |
547 |
> |
if (temp2 < temp3){ |
548 |
> |
// we have a non-complete lattice |
549 |
> |
have_extra = 1; |
550 |
|
|
551 |
< |
n_cells = (int)temp3 - 1; |
551 |
> |
n_cells = (int) temp3 - 1; |
552 |
|
cellx = info[0].boxL[0] / temp3; |
553 |
|
celly = info[0].boxL[1] / temp3; |
554 |
|
cellz = info[0].boxL[2] / temp3; |
555 |
< |
n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells ); |
556 |
< |
temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) ); |
557 |
< |
n_per_extra = (int)ceil( temp1 ); |
555 |
> |
n_extra = tot_nmol - (4 * n_cells * n_cells * n_cells); |
556 |
> |
temp1 = ((double) n_extra) / (pow(temp3, 3.0) - pow(n_cells, 3.0)); |
557 |
> |
n_per_extra = (int) ceil(temp1); |
558 |
|
|
559 |
< |
if( n_per_extra > 4){ |
560 |
< |
sprintf( painCave.errMsg, |
561 |
< |
"SimSetup error. There has been an error in constructing" |
562 |
< |
" the non-complete lattice.\n" ); |
559 |
> |
if (n_per_extra > 4){ |
560 |
> |
sprintf(painCave.errMsg, |
561 |
> |
"SimSetup error. There has been an error in constructing" |
562 |
> |
" the non-complete lattice.\n"); |
563 |
|
painCave.isFatal = 1; |
564 |
|
simError(); |
565 |
|
} |
566 |
|
} |
567 |
|
else{ |
568 |
< |
n_cells = (int)temp3; |
568 |
> |
n_cells = (int) temp3; |
569 |
|
cellx = info[0].boxL[0] / temp3; |
570 |
|
celly = info[0].boxL[1] / temp3; |
571 |
|
cellz = info[0].boxL[2] / temp3; |
576 |
|
current_comp = 0; |
577 |
|
current_atom_ndx = 0; |
578 |
|
|
579 |
< |
for( i=0; i < n_cells ; i++ ){ |
580 |
< |
for( j=0; j < n_cells; j++ ){ |
581 |
< |
for( k=0; k < n_cells; k++ ){ |
579 |
> |
for (i = 0; i < n_cells ; i++){ |
580 |
> |
for (j = 0; j < n_cells; j++){ |
581 |
> |
for (k = 0; k < n_cells; k++){ |
582 |
> |
makeElement(i * cellx, j * celly, k * cellz); |
583 |
|
|
584 |
< |
makeElement( i * cellx, |
461 |
< |
j * celly, |
462 |
< |
k * cellz ); |
584 |
> |
makeElement(i * cellx + 0.5 * cellx, j * celly + 0.5 * celly, k * cellz); |
585 |
|
|
586 |
< |
makeElement( i * cellx + 0.5 * cellx, |
465 |
< |
j * celly + 0.5 * celly, |
466 |
< |
k * cellz ); |
586 |
> |
makeElement(i * cellx, j * celly + 0.5 * celly, k * cellz + 0.5 * cellz); |
587 |
|
|
588 |
< |
makeElement( i * cellx, |
469 |
< |
j * celly + 0.5 * celly, |
470 |
< |
k * cellz + 0.5 * cellz ); |
471 |
< |
|
472 |
< |
makeElement( i * cellx + 0.5 * cellx, |
473 |
< |
j * celly, |
474 |
< |
k * cellz + 0.5 * cellz ); |
588 |
> |
makeElement(i * cellx + 0.5 * cellx, j * celly, k * cellz + 0.5 * cellz); |
589 |
|
} |
590 |
|
} |
591 |
|
} |
592 |
|
|
593 |
< |
if( have_extra ){ |
593 |
> |
if (have_extra){ |
594 |
|
done = 0; |
595 |
|
|
596 |
|
int start_ndx; |
597 |
< |
for( i=0; i < (n_cells+1) && !done; i++ ){ |
598 |
< |
for( j=0; j < (n_cells+1) && !done; j++ ){ |
597 |
> |
for (i = 0; i < (n_cells + 1) && !done; i++){ |
598 |
> |
for (j = 0; j < (n_cells + 1) && !done; j++){ |
599 |
> |
if (i < n_cells){ |
600 |
> |
if (j < n_cells){ |
601 |
> |
start_ndx = n_cells; |
602 |
> |
} |
603 |
> |
else |
604 |
> |
start_ndx = 0; |
605 |
> |
} |
606 |
> |
else |
607 |
> |
start_ndx = 0; |
608 |
|
|
609 |
< |
if( i < n_cells ){ |
609 |
> |
for (k = start_ndx; k < (n_cells + 1) && !done; k++){ |
610 |
> |
makeElement(i * cellx, j * celly, k * cellz); |
611 |
> |
done = (current_mol >= tot_nmol); |
612 |
|
|
613 |
< |
if( j < n_cells ){ |
614 |
< |
start_ndx = n_cells; |
615 |
< |
} |
616 |
< |
else start_ndx = 0; |
617 |
< |
} |
493 |
< |
else start_ndx = 0; |
613 |
> |
if (!done && n_per_extra > 1){ |
614 |
> |
makeElement(i * cellx + 0.5 * cellx, j * celly + 0.5 * celly, |
615 |
> |
k * cellz); |
616 |
> |
done = (current_mol >= tot_nmol); |
617 |
> |
} |
618 |
|
|
619 |
< |
for( k=start_ndx; k < (n_cells+1) && !done; k++ ){ |
619 |
> |
if (!done && n_per_extra > 2){ |
620 |
> |
makeElement(i * cellx, j * celly + 0.5 * celly, |
621 |
> |
k * cellz + 0.5 * cellz); |
622 |
> |
done = (current_mol >= tot_nmol); |
623 |
> |
} |
624 |
|
|
625 |
< |
makeElement( i * cellx, |
626 |
< |
j * celly, |
627 |
< |
k * cellz ); |
628 |
< |
done = ( current_mol >= tot_nmol ); |
629 |
< |
|
630 |
< |
if( !done && n_per_extra > 1 ){ |
503 |
< |
makeElement( i * cellx + 0.5 * cellx, |
504 |
< |
j * celly + 0.5 * celly, |
505 |
< |
k * cellz ); |
506 |
< |
done = ( current_mol >= tot_nmol ); |
507 |
< |
} |
508 |
< |
|
509 |
< |
if( !done && n_per_extra > 2){ |
510 |
< |
makeElement( i * cellx, |
511 |
< |
j * celly + 0.5 * celly, |
512 |
< |
k * cellz + 0.5 * cellz ); |
513 |
< |
done = ( current_mol >= tot_nmol ); |
514 |
< |
} |
515 |
< |
|
516 |
< |
if( !done && n_per_extra > 3){ |
517 |
< |
makeElement( i * cellx + 0.5 * cellx, |
518 |
< |
j * celly, |
519 |
< |
k * cellz + 0.5 * cellz ); |
520 |
< |
done = ( current_mol >= tot_nmol ); |
521 |
< |
} |
522 |
< |
} |
625 |
> |
if (!done && n_per_extra > 3){ |
626 |
> |
makeElement(i * cellx + 0.5 * cellx, j * celly, |
627 |
> |
k * cellz + 0.5 * cellz); |
628 |
> |
done = (current_mol >= tot_nmol); |
629 |
> |
} |
630 |
> |
} |
631 |
|
} |
632 |
|
} |
633 |
|
} |
634 |
|
|
635 |
< |
for( i=0; i<info[0].n_atoms; i++ ){ |
636 |
< |
info[0].atoms[i]->setVel( vel ); |
635 |
> |
for (i = 0; i < info[0].n_atoms; i++){ |
636 |
> |
info[0].atoms[i]->setVel(vel); |
637 |
|
} |
638 |
|
} |
639 |
|
|
640 |
< |
void SimSetup::makeElement( double x, double y, double z ){ |
533 |
< |
|
640 |
> |
void SimSetup::makeElement(double x, double y, double z){ |
641 |
|
int k; |
642 |
|
AtomStamp* current_atom; |
643 |
|
DirectionalAtom* dAtom; |
644 |
|
double rotMat[3][3]; |
645 |
|
double pos[3]; |
646 |
|
|
647 |
< |
for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){ |
648 |
< |
|
649 |
< |
current_atom = comp_stamps[current_comp]->getAtom( k ); |
650 |
< |
if( !current_atom->havePosition() ){ |
651 |
< |
sprintf( painCave.errMsg, |
652 |
< |
"SimSetup:initFromBass error.\n" |
653 |
< |
"\tComponent %s, atom %s does not have a position specified.\n" |
654 |
< |
"\tThe initialization routine is unable to give a start" |
655 |
< |
" position.\n", |
549 |
< |
comp_stamps[current_comp]->getID(), |
550 |
< |
current_atom->getType() ); |
647 |
> |
for (k = 0; k < comp_stamps[current_comp]->getNAtoms(); k++){ |
648 |
> |
current_atom = comp_stamps[current_comp]->getAtom(k); |
649 |
> |
if (!current_atom->havePosition()){ |
650 |
> |
sprintf(painCave.errMsg, |
651 |
> |
"SimSetup:initFromBass error.\n" |
652 |
> |
"\tComponent %s, atom %s does not have a position specified.\n" |
653 |
> |
"\tThe initialization routine is unable to give a start" |
654 |
> |
" position.\n", |
655 |
> |
comp_stamps[current_comp]->getID(), current_atom->getType()); |
656 |
|
painCave.isFatal = 1; |
657 |
|
simError(); |
658 |
|
} |
659 |
< |
|
659 |
> |
|
660 |
|
pos[0] = x + current_atom->getPosX(); |
661 |
|
pos[1] = y + current_atom->getPosY(); |
662 |
|
pos[2] = z + current_atom->getPosZ(); |
558 |
– |
|
559 |
– |
info[0].atoms[current_atom_ndx]->setPos( pos ); |
663 |
|
|
664 |
< |
if( info[0].atoms[current_atom_ndx]->isDirectional() ){ |
664 |
> |
info[0].atoms[current_atom_ndx]->setPos(pos); |
665 |
|
|
666 |
< |
dAtom = (DirectionalAtom *)info[0].atoms[current_atom_ndx]; |
666 |
> |
if (info[0].atoms[current_atom_ndx]->isDirectional()){ |
667 |
> |
dAtom = (DirectionalAtom *) info[0].atoms[current_atom_ndx]; |
668 |
|
|
669 |
|
rotMat[0][0] = 1.0; |
670 |
|
rotMat[0][1] = 0.0; |
678 |
|
rotMat[2][1] = 0.0; |
679 |
|
rotMat[2][2] = 1.0; |
680 |
|
|
681 |
< |
dAtom->setA( rotMat ); |
681 |
> |
dAtom->setA(rotMat); |
682 |
|
} |
683 |
|
|
684 |
|
current_atom_ndx++; |
687 |
|
current_mol++; |
688 |
|
current_comp_mol++; |
689 |
|
|
690 |
< |
if( current_comp_mol >= components_nmol[current_comp] ){ |
587 |
< |
|
690 |
> |
if (current_comp_mol >= components_nmol[current_comp]){ |
691 |
|
current_comp_mol = 0; |
692 |
|
current_comp++; |
693 |
|
} |
694 |
|
} |
695 |
|
|
696 |
|
|
697 |
< |
void SimSetup::gatherInfo( void ){ |
698 |
< |
int i,j,k; |
697 |
> |
void SimSetup::gatherInfo(void){ |
698 |
> |
int i; |
699 |
|
|
700 |
|
ensembleCase = -1; |
701 |
|
ffCase = -1; |
702 |
|
|
703 |
|
// set the easy ones first |
704 |
|
|
705 |
< |
for( i=0; i<nInfo; i++){ |
705 |
> |
for (i = 0; i < nInfo; i++){ |
706 |
|
info[i].target_temp = globals->getTargetTemp(); |
707 |
|
info[i].dt = globals->getDt(); |
708 |
|
info[i].run_time = globals->getRunTime(); |
712 |
|
|
713 |
|
// get the forceField |
714 |
|
|
715 |
< |
strcpy( force_field, globals->getForceField() ); |
715 |
> |
strcpy(force_field, globals->getForceField()); |
716 |
|
|
717 |
< |
if( !strcasecmp( force_field, "DUFF" )) ffCase = FF_DUFF; |
718 |
< |
else if( !strcasecmp( force_field, "LJ" )) ffCase = FF_LJ; |
719 |
< |
else if( !strcasecmp( force_field, "EAM" )) ffCase = FF_EAM; |
717 |
> |
if (!strcasecmp(force_field, "DUFF")){ |
718 |
> |
ffCase = FF_DUFF; |
719 |
> |
} |
720 |
> |
else if (!strcasecmp(force_field, "LJ")){ |
721 |
> |
ffCase = FF_LJ; |
722 |
> |
} |
723 |
> |
else if (!strcasecmp(force_field, "EAM")){ |
724 |
> |
ffCase = FF_EAM; |
725 |
> |
} |
726 |
> |
else if (!strcasecmp(force_field, "WATER")){ |
727 |
> |
ffCase = FF_H2O; |
728 |
> |
} |
729 |
|
else{ |
730 |
< |
sprintf( painCave.errMsg, |
731 |
< |
"SimSetup Error. Unrecognized force field -> %s\n", |
732 |
< |
force_field ); |
733 |
< |
painCave.isFatal = 1; |
622 |
< |
simError(); |
730 |
> |
sprintf(painCave.errMsg, "SimSetup Error. Unrecognized force field -> %s\n", |
731 |
> |
force_field); |
732 |
> |
painCave.isFatal = 1; |
733 |
> |
simError(); |
734 |
|
} |
735 |
|
|
736 |
< |
// get the ensemble |
736 |
> |
// get the ensemble |
737 |
|
|
738 |
< |
strcpy( ensemble, globals->getEnsemble() ); |
738 |
> |
strcpy(ensemble, globals->getEnsemble()); |
739 |
|
|
740 |
< |
if( !strcasecmp( ensemble, "NVE" )) ensembleCase = NVE_ENS; |
741 |
< |
else if( !strcasecmp( ensemble, "NVT" )) ensembleCase = NVT_ENS; |
742 |
< |
else if( !strcasecmp( ensemble, "NPTi" ) || !strcasecmp( ensemble, "NPT") ) |
740 |
> |
if (!strcasecmp(ensemble, "NVE")){ |
741 |
> |
ensembleCase = NVE_ENS; |
742 |
> |
} |
743 |
> |
else if (!strcasecmp(ensemble, "NVT")){ |
744 |
> |
ensembleCase = NVT_ENS; |
745 |
> |
} |
746 |
> |
else if (!strcasecmp(ensemble, "NPTi") || !strcasecmp(ensemble, "NPT")){ |
747 |
|
ensembleCase = NPTi_ENS; |
748 |
< |
else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; |
749 |
< |
else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS; |
750 |
< |
else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS; |
748 |
> |
} |
749 |
> |
else if (!strcasecmp(ensemble, "NPTf")){ |
750 |
> |
ensembleCase = NPTf_ENS; |
751 |
> |
} |
752 |
> |
else if (!strcasecmp(ensemble, "NPTxyz")){ |
753 |
> |
ensembleCase = NPTxyz_ENS; |
754 |
> |
} |
755 |
|
else{ |
756 |
< |
sprintf( painCave.errMsg, |
757 |
< |
"SimSetup Warning. Unrecognized Ensemble -> %s, " |
758 |
< |
"reverting to NVE for this simulation.\n", |
759 |
< |
ensemble ); |
760 |
< |
painCave.isFatal = 0; |
761 |
< |
simError(); |
762 |
< |
strcpy( ensemble, "NVE" ); |
763 |
< |
ensembleCase = NVE_ENS; |
756 |
> |
sprintf(painCave.errMsg, |
757 |
> |
"SimSetup Warning. Unrecognized Ensemble -> %s \n" |
758 |
> |
"\treverting to NVE for this simulation.\n", |
759 |
> |
ensemble); |
760 |
> |
painCave.isFatal = 0; |
761 |
> |
simError(); |
762 |
> |
strcpy(ensemble, "NVE"); |
763 |
> |
ensembleCase = NVE_ENS; |
764 |
|
} |
646 |
– |
|
647 |
– |
for(i=0; i<nInfo; i++){ |
648 |
– |
|
649 |
– |
strcpy( info[i].ensemble, ensemble ); |
765 |
|
|
766 |
+ |
for (i = 0; i < nInfo; i++){ |
767 |
+ |
strcpy(info[i].ensemble, ensemble); |
768 |
+ |
|
769 |
|
// get the mixing rule |
770 |
|
|
771 |
< |
strcpy( info[i].mixingRule, globals->getMixingRule() ); |
771 |
> |
strcpy(info[i].mixingRule, globals->getMixingRule()); |
772 |
|
info[i].usePBC = globals->getPBC(); |
773 |
|
} |
774 |
< |
|
774 |
> |
|
775 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
776 |
< |
|
776 |
> |
|
777 |
|
the_components = globals->getComponents(); |
778 |
|
components_nmol = new int[n_components]; |
779 |
|
|
780 |
|
|
781 |
< |
if( !globals->haveNMol() ){ |
781 |
> |
if (!globals->haveNMol()){ |
782 |
|
// we don't have the total number of molecules, so we assume it is |
783 |
|
// given in each component |
784 |
|
|
785 |
|
tot_nmol = 0; |
786 |
< |
for( i=0; i<n_components; i++ ){ |
787 |
< |
|
788 |
< |
if( !the_components[i]->haveNMol() ){ |
789 |
< |
// we have a problem |
790 |
< |
sprintf( painCave.errMsg, |
791 |
< |
"SimSetup Error. No global NMol or component NMol" |
792 |
< |
" given. Cannot calculate the number of atoms.\n" ); |
793 |
< |
painCave.isFatal = 1; |
676 |
< |
simError(); |
786 |
> |
for (i = 0; i < n_components; i++){ |
787 |
> |
if (!the_components[i]->haveNMol()){ |
788 |
> |
// we have a problem |
789 |
> |
sprintf(painCave.errMsg, |
790 |
> |
"SimSetup Error. No global NMol or component NMol given.\n" |
791 |
> |
"\tCannot calculate the number of atoms.\n"); |
792 |
> |
painCave.isFatal = 1; |
793 |
> |
simError(); |
794 |
|
} |
795 |
|
|
796 |
|
tot_nmol += the_components[i]->getNMol(); |
798 |
|
} |
799 |
|
} |
800 |
|
else{ |
801 |
< |
sprintf( painCave.errMsg, |
802 |
< |
"SimSetup error.\n" |
803 |
< |
"\tSorry, the ability to specify total" |
804 |
< |
" nMols and then give molfractions in the components\n" |
805 |
< |
"\tis not currently supported." |
806 |
< |
" Please give nMol in the components.\n" ); |
801 |
> |
sprintf(painCave.errMsg, |
802 |
> |
"SimSetup error.\n" |
803 |
> |
"\tSorry, the ability to specify total" |
804 |
> |
" nMols and then give molfractions in the components\n" |
805 |
> |
"\tis not currently supported." |
806 |
> |
" Please give nMol in the components.\n"); |
807 |
|
painCave.isFatal = 1; |
808 |
|
simError(); |
809 |
|
} |
810 |
|
|
811 |
+ |
//check whether sample time, status time, thermal time and reset time are divisble by dt |
812 |
+ |
if (!isDivisible(globals->getSampleTime(), globals->getDt())){ |
813 |
+ |
sprintf(painCave.errMsg, |
814 |
+ |
"Sample time is not divisible by dt.\n" |
815 |
+ |
"\tThis will result in samples that are not uniformly\n" |
816 |
+ |
"\tdistributed in time. If this is a problem, change\n" |
817 |
+ |
"\tyour sampleTime variable.\n"); |
818 |
+ |
painCave.isFatal = 0; |
819 |
+ |
simError(); |
820 |
+ |
} |
821 |
+ |
|
822 |
+ |
if (globals->haveStatusTime() && !isDivisible(globals->getSampleTime(), globals->getDt())){ |
823 |
+ |
sprintf(painCave.errMsg, |
824 |
+ |
"Status time is not divisible by dt.\n" |
825 |
+ |
"\tThis will result in status reports that are not uniformly\n" |
826 |
+ |
"\tdistributed in time. If this is a problem, change \n" |
827 |
+ |
"\tyour statusTime variable.\n"); |
828 |
+ |
painCave.isFatal = 0; |
829 |
+ |
simError(); |
830 |
+ |
} |
831 |
+ |
|
832 |
+ |
if (globals->haveThermalTime() && !isDivisible(globals->getThermalTime(), globals->getDt())){ |
833 |
+ |
sprintf(painCave.errMsg, |
834 |
+ |
"Thermal time is not divisible by dt.\n" |
835 |
+ |
"\tThis will result in thermalizations that are not uniformly\n" |
836 |
+ |
"\tdistributed in time. If this is a problem, change \n" |
837 |
+ |
"\tyour thermalTime variable.\n"); |
838 |
+ |
painCave.isFatal = 0; |
839 |
+ |
simError(); |
840 |
+ |
} |
841 |
+ |
|
842 |
+ |
if (globals->haveResetTime() && !isDivisible(globals->getResetTime(), globals->getDt())){ |
843 |
+ |
sprintf(painCave.errMsg, |
844 |
+ |
"Reset time is not divisible by dt.\n" |
845 |
+ |
"\tThis will result in integrator resets that are not uniformly\n" |
846 |
+ |
"\tdistributed in time. If this is a problem, change\n" |
847 |
+ |
"\tyour resetTime variable.\n"); |
848 |
+ |
painCave.isFatal = 0; |
849 |
+ |
simError(); |
850 |
+ |
} |
851 |
+ |
|
852 |
|
// set the status, sample, and thermal kick times |
695 |
– |
|
696 |
– |
for(i=0; i<nInfo; i++){ |
853 |
|
|
854 |
< |
if( globals->haveSampleTime() ){ |
854 |
> |
for (i = 0; i < nInfo; i++){ |
855 |
> |
if (globals->haveSampleTime()){ |
856 |
|
info[i].sampleTime = globals->getSampleTime(); |
857 |
|
info[i].statusTime = info[i].sampleTime; |
858 |
|
info[i].thermalTime = info[i].sampleTime; |
862 |
|
info[i].statusTime = info[i].sampleTime; |
863 |
|
info[i].thermalTime = info[i].sampleTime; |
864 |
|
} |
865 |
< |
|
866 |
< |
if( globals->haveStatusTime() ){ |
865 |
> |
|
866 |
> |
if (globals->haveStatusTime()){ |
867 |
|
info[i].statusTime = globals->getStatusTime(); |
868 |
|
} |
869 |
< |
|
870 |
< |
if( globals->haveThermalTime() ){ |
869 |
> |
|
870 |
> |
if (globals->haveThermalTime()){ |
871 |
|
info[i].thermalTime = globals->getThermalTime(); |
872 |
|
} |
873 |
|
|
874 |
+ |
info[i].resetIntegrator = 0; |
875 |
+ |
if( globals->haveResetTime() ){ |
876 |
+ |
info[i].resetTime = globals->getResetTime(); |
877 |
+ |
info[i].resetIntegrator = 1; |
878 |
+ |
} |
879 |
+ |
|
880 |
|
// check for the temperature set flag |
881 |
+ |
|
882 |
+ |
if (globals->haveTempSet()) |
883 |
+ |
info[i].setTemp = globals->getTempSet(); |
884 |
|
|
885 |
< |
if( globals->haveTempSet() ) info[i].setTemp = globals->getTempSet(); |
885 |
> |
// check for the extended State init |
886 |
> |
|
887 |
> |
info[i].useInitXSstate = globals->getUseInitXSstate(); |
888 |
> |
info[i].orthoTolerance = globals->getOrthoBoxTolerance(); |
889 |
|
|
721 |
– |
// get some of the tricky things that may still be in the globals |
722 |
– |
|
723 |
– |
double boxVector[3]; |
724 |
– |
if( globals->haveBox() ){ |
725 |
– |
boxVector[0] = globals->getBox(); |
726 |
– |
boxVector[1] = globals->getBox(); |
727 |
– |
boxVector[2] = globals->getBox(); |
728 |
– |
|
729 |
– |
info[i].setBox( boxVector ); |
730 |
– |
} |
731 |
– |
else if( globals->haveDensity() ){ |
732 |
– |
|
733 |
– |
double vol; |
734 |
– |
vol = (double)tot_nmol / globals->getDensity(); |
735 |
– |
boxVector[0] = pow( vol, ( 1.0 / 3.0 ) ); |
736 |
– |
boxVector[1] = boxVector[0]; |
737 |
– |
boxVector[2] = boxVector[0]; |
738 |
– |
|
739 |
– |
info[i].setBox( boxVector ); |
890 |
|
} |
891 |
< |
else{ |
892 |
< |
if( !globals->haveBoxX() ){ |
893 |
< |
sprintf( painCave.errMsg, |
894 |
< |
"SimSetup error, no periodic BoxX size given.\n" ); |
895 |
< |
painCave.isFatal = 1; |
896 |
< |
simError(); |
891 |
> |
|
892 |
> |
//setup seed for random number generator |
893 |
> |
int seedValue; |
894 |
> |
|
895 |
> |
if (globals->haveSeed()){ |
896 |
> |
seedValue = globals->getSeed(); |
897 |
> |
|
898 |
> |
if(seedValue / 1E9 == 0){ |
899 |
> |
sprintf(painCave.errMsg, |
900 |
> |
"Seed for sprng library should contain at least 9 digits\n" |
901 |
> |
"OOPSE will generate a seed for user\n"); |
902 |
> |
painCave.isFatal = 0; |
903 |
> |
simError(); |
904 |
> |
|
905 |
> |
//using seed generated by system instead of invalid seed set by user |
906 |
> |
#ifndef IS_MPI |
907 |
> |
seedValue = make_sprng_seed(); |
908 |
> |
#else |
909 |
> |
if (worldRank == 0){ |
910 |
> |
seedValue = make_sprng_seed(); |
911 |
|
} |
912 |
< |
boxVector[0] = globals->getBoxX(); |
913 |
< |
|
750 |
< |
if( !globals->haveBoxY() ){ |
751 |
< |
sprintf( painCave.errMsg, |
752 |
< |
"SimSetup error, no periodic BoxY size given.\n" ); |
753 |
< |
painCave.isFatal = 1; |
754 |
< |
simError(); |
755 |
< |
} |
756 |
< |
boxVector[1] = globals->getBoxY(); |
757 |
< |
|
758 |
< |
if( !globals->haveBoxZ() ){ |
759 |
< |
sprintf( painCave.errMsg, |
760 |
< |
"SimSetup error, no periodic BoxZ size given.\n" ); |
761 |
< |
painCave.isFatal = 1; |
762 |
< |
simError(); |
763 |
< |
} |
764 |
< |
boxVector[2] = globals->getBoxZ(); |
765 |
< |
|
766 |
< |
info[i].setBox( boxVector ); |
912 |
> |
MPI_Bcast(&seedValue, 1, MPI_INT, 0, MPI_COMM_WORLD); |
913 |
> |
#endif |
914 |
|
} |
915 |
+ |
}//end of if branch of globals->haveSeed() |
916 |
+ |
else{ |
917 |
+ |
|
918 |
+ |
#ifndef IS_MPI |
919 |
+ |
seedValue = make_sprng_seed(); |
920 |
+ |
#else |
921 |
+ |
if (worldRank == 0){ |
922 |
+ |
seedValue = make_sprng_seed(); |
923 |
+ |
} |
924 |
+ |
MPI_Bcast(&seedValue, 1, MPI_INT, 0, MPI_COMM_WORLD); |
925 |
+ |
#endif |
926 |
+ |
}//end of globals->haveSeed() |
927 |
|
|
928 |
+ |
for (int i = 0; i < nInfo; i++){ |
929 |
+ |
info[i].setSeed(seedValue); |
930 |
|
} |
931 |
< |
|
931 |
> |
|
932 |
|
#ifdef IS_MPI |
933 |
< |
strcpy( checkPointMsg, "Succesfully gathered all information from Bass\n" ); |
933 |
> |
strcpy(checkPointMsg, "Successfully gathered all information from Bass\n"); |
934 |
|
MPIcheckPoint(); |
935 |
|
#endif // is_mpi |
775 |
– |
|
936 |
|
} |
937 |
|
|
938 |
|
|
939 |
< |
void SimSetup::finalInfoCheck( void ){ |
939 |
> |
void SimSetup::finalInfoCheck(void){ |
940 |
|
int index; |
941 |
|
int usesDipoles; |
942 |
|
int i; |
943 |
|
|
944 |
< |
for(i=0; i<nInfo; i++){ |
944 |
> |
for (i = 0; i < nInfo; i++){ |
945 |
|
// check electrostatic parameters |
946 |
< |
|
946 |
> |
|
947 |
|
index = 0; |
948 |
|
usesDipoles = 0; |
949 |
< |
while( (index < info[i].n_atoms) && !usesDipoles ){ |
949 |
> |
while ((index < info[i].n_atoms) && !usesDipoles){ |
950 |
|
usesDipoles = (info[i].atoms[index])->hasDipole(); |
951 |
|
index++; |
952 |
|
} |
953 |
< |
|
953 |
> |
|
954 |
|
#ifdef IS_MPI |
955 |
|
int myUse = usesDipoles; |
956 |
< |
MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
956 |
> |
MPI_Allreduce(&myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
957 |
|
#endif //is_mpi |
958 |
< |
|
958 |
> |
|
959 |
|
double theEcr, theEst; |
960 |
< |
|
961 |
< |
if (globals->getUseRF() ) { |
960 |
> |
|
961 |
> |
if (globals->getUseRF()){ |
962 |
|
info[i].useReactionField = 1; |
963 |
< |
|
964 |
< |
if( !globals->haveECR() ){ |
965 |
< |
sprintf( painCave.errMsg, |
966 |
< |
"SimSetup Warning: using default value of 1/2 the smallest " |
967 |
< |
"box length for the electrostaticCutoffRadius.\n" |
968 |
< |
"I hope you have a very fast processor!\n"); |
969 |
< |
painCave.isFatal = 0; |
970 |
< |
simError(); |
971 |
< |
double smallest; |
812 |
< |
smallest = info[i].boxL[0]; |
813 |
< |
if (info[i].boxL[1] <= smallest) smallest = info[i].boxL[1]; |
814 |
< |
if (info[i].boxL[2] <= smallest) smallest = info[i].boxL[2]; |
815 |
< |
theEcr = 0.5 * smallest; |
816 |
< |
} else { |
817 |
< |
theEcr = globals->getECR(); |
963 |
> |
|
964 |
> |
if (!globals->haveECR()){ |
965 |
> |
sprintf(painCave.errMsg, |
966 |
> |
"SimSetup Warning: No value was set for electrostaticCutoffRadius.\n" |
967 |
> |
"\tOOPSE will use a default value of 15.0 angstroms" |
968 |
> |
"\tfor the electrostaticCutoffRadius.\n"); |
969 |
> |
painCave.isFatal = 0; |
970 |
> |
simError(); |
971 |
> |
theEcr = 15.0; |
972 |
|
} |
973 |
< |
|
974 |
< |
if( !globals->haveEST() ){ |
821 |
< |
sprintf( painCave.errMsg, |
822 |
< |
"SimSetup Warning: using default value of 0.05 * the " |
823 |
< |
"electrostaticCutoffRadius for the electrostaticSkinThickness\n" |
824 |
< |
); |
825 |
< |
painCave.isFatal = 0; |
826 |
< |
simError(); |
827 |
< |
theEst = 0.05 * theEcr; |
828 |
< |
} else { |
829 |
< |
theEst= globals->getEST(); |
973 |
> |
else{ |
974 |
> |
theEcr = globals->getECR(); |
975 |
|
} |
976 |
< |
|
977 |
< |
info[i].setEcr( theEcr, theEst ); |
978 |
< |
|
979 |
< |
if(!globals->haveDielectric() ){ |
980 |
< |
sprintf( painCave.errMsg, |
981 |
< |
"SimSetup Error: You are trying to use Reaction Field without" |
982 |
< |
"setting a dielectric constant!\n" |
983 |
< |
); |
984 |
< |
painCave.isFatal = 1; |
985 |
< |
simError(); |
976 |
> |
|
977 |
> |
if (!globals->haveEST()){ |
978 |
> |
sprintf(painCave.errMsg, |
979 |
> |
"SimSetup Warning: No value was set for electrostaticSkinThickness.\n" |
980 |
> |
"\tOOPSE will use a default value of\n" |
981 |
> |
"\t0.05 * electrostaticCutoffRadius\n" |
982 |
> |
"\tfor the electrostaticSkinThickness\n"); |
983 |
> |
painCave.isFatal = 0; |
984 |
> |
simError(); |
985 |
> |
theEst = 0.05 * theEcr; |
986 |
|
} |
987 |
< |
info[i].dielectric = globals->getDielectric(); |
988 |
< |
} |
989 |
< |
else { |
990 |
< |
if (usesDipoles) { |
991 |
< |
|
992 |
< |
if( !globals->haveECR() ){ |
993 |
< |
sprintf( painCave.errMsg, |
994 |
< |
"SimSetup Warning: using default value of 1/2 the smallest " |
995 |
< |
"box length for the electrostaticCutoffRadius.\n" |
996 |
< |
"I hope you have a very fast processor!\n"); |
987 |
> |
else{ |
988 |
> |
theEst = globals->getEST(); |
989 |
> |
} |
990 |
> |
|
991 |
> |
info[i].setDefaultEcr(theEcr, theEst); |
992 |
> |
|
993 |
> |
if (!globals->haveDielectric()){ |
994 |
> |
sprintf(painCave.errMsg, |
995 |
> |
"SimSetup Error: No Dielectric constant was set.\n" |
996 |
> |
"\tYou are trying to use Reaction Field without" |
997 |
> |
"\tsetting a dielectric constant!\n"); |
998 |
> |
painCave.isFatal = 1; |
999 |
> |
simError(); |
1000 |
> |
} |
1001 |
> |
info[i].dielectric = globals->getDielectric(); |
1002 |
> |
} |
1003 |
> |
else{ |
1004 |
> |
if (usesDipoles){ |
1005 |
> |
if (!globals->haveECR()){ |
1006 |
> |
sprintf(painCave.errMsg, |
1007 |
> |
"SimSetup Warning: No value was set for electrostaticCutoffRadius.\n" |
1008 |
> |
"\tOOPSE will use a default value of 15.0 angstroms" |
1009 |
> |
"\tfor the electrostaticCutoffRadius.\n"); |
1010 |
|
painCave.isFatal = 0; |
1011 |
|
simError(); |
1012 |
< |
double smallest; |
1013 |
< |
smallest = info[i].boxL[0]; |
1014 |
< |
if (info[i].boxL[1] <= smallest) smallest = info[i].boxL[1]; |
1015 |
< |
if (info[i].boxL[2] <= smallest) smallest = info[i].boxL[2]; |
1016 |
< |
theEcr = 0.5 * smallest; |
859 |
< |
} else { |
860 |
< |
theEcr = globals->getECR(); |
861 |
< |
} |
1012 |
> |
theEcr = 15.0; |
1013 |
> |
} |
1014 |
> |
else{ |
1015 |
> |
theEcr = globals->getECR(); |
1016 |
> |
} |
1017 |
|
|
1018 |
< |
if( !globals->haveEST() ){ |
1019 |
< |
sprintf( painCave.errMsg, |
1020 |
< |
"SimSetup Warning: using default value of 0.05 * the " |
1021 |
< |
"electrostaticCutoffRadius for the " |
1022 |
< |
"electrostaticSkinThickness\n" |
1023 |
< |
); |
1024 |
< |
painCave.isFatal = 0; |
1025 |
< |
simError(); |
1026 |
< |
theEst = 0.05 * theEcr; |
1027 |
< |
} else { |
1028 |
< |
theEst= globals->getEST(); |
1029 |
< |
} |
1018 |
> |
if (!globals->haveEST()){ |
1019 |
> |
sprintf(painCave.errMsg, |
1020 |
> |
"SimSetup Warning: No value was set for electrostaticSkinThickness.\n" |
1021 |
> |
"\tOOPSE will use a default value of\n" |
1022 |
> |
"\t0.05 * electrostaticCutoffRadius\n" |
1023 |
> |
"\tfor the electrostaticSkinThickness\n"); |
1024 |
> |
painCave.isFatal = 0; |
1025 |
> |
simError(); |
1026 |
> |
theEst = 0.05 * theEcr; |
1027 |
> |
} |
1028 |
> |
else{ |
1029 |
> |
theEst = globals->getEST(); |
1030 |
> |
} |
1031 |
|
|
1032 |
< |
info[i].setEcr( theEcr, theEst ); |
1032 |
> |
info[i].setDefaultEcr(theEcr, theEst); |
1033 |
|
} |
1034 |
< |
} |
1034 |
> |
} |
1035 |
|
} |
880 |
– |
|
1036 |
|
#ifdef IS_MPI |
1037 |
< |
strcpy( checkPointMsg, "post processing checks out" ); |
1037 |
> |
strcpy(checkPointMsg, "post processing checks out"); |
1038 |
|
MPIcheckPoint(); |
1039 |
|
#endif // is_mpi |
885 |
– |
|
1040 |
|
} |
887 |
– |
|
888 |
– |
void SimSetup::initSystemCoords( void ){ |
889 |
– |
int i; |
1041 |
|
|
1042 |
< |
std::cerr << "Setting atom Coords\n"; |
1042 |
> |
void SimSetup::initSystemCoords(void){ |
1043 |
> |
int i; |
1044 |
> |
|
1045 |
> |
char* inName; |
1046 |
|
|
1047 |
< |
(info[0].getConfiguration())->createArrays( info[0].n_atoms ); |
1048 |
< |
|
1049 |
< |
for(i=0; i<info[0].n_atoms; i++) info[0].atoms[i]->setCoords(); |
1050 |
< |
|
1051 |
< |
if( globals->haveInitialConfig() ){ |
1052 |
< |
|
1047 |
> |
(info[0].getConfiguration())->createArrays(info[0].n_atoms); |
1048 |
> |
|
1049 |
> |
for (i = 0; i < info[0].n_atoms; i++) |
1050 |
> |
info[0].atoms[i]->setCoords(); |
1051 |
> |
|
1052 |
> |
if (globals->haveInitialConfig()){ |
1053 |
|
InitializeFromFile* fileInit; |
1054 |
|
#ifdef IS_MPI // is_mpi |
1055 |
< |
if( worldRank == 0 ){ |
1055 |
> |
if (worldRank == 0){ |
1056 |
|
#endif //is_mpi |
1057 |
< |
fileInit = new InitializeFromFile( globals->getInitialConfig() ); |
1057 |
> |
inName = globals->getInitialConfig(); |
1058 |
> |
fileInit = new InitializeFromFile(inName); |
1059 |
|
#ifdef IS_MPI |
1060 |
< |
}else fileInit = new InitializeFromFile( NULL ); |
1060 |
> |
} |
1061 |
> |
else |
1062 |
> |
fileInit = new InitializeFromFile(NULL); |
1063 |
|
#endif |
1064 |
< |
fileInit->readInit( info ); // default velocities on |
1065 |
< |
|
1064 |
> |
fileInit->readInit(info); // default velocities on |
1065 |
> |
|
1066 |
|
delete fileInit; |
1067 |
|
} |
1068 |
|
else{ |
1069 |
|
|
913 |
– |
#ifdef IS_MPI |
914 |
– |
|
1070 |
|
// no init from bass |
1071 |
|
|
1072 |
< |
sprintf( painCave.errMsg, |
1073 |
< |
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
1074 |
< |
painCave.isFatal; |
1072 |
> |
sprintf(painCave.errMsg, |
1073 |
> |
"Cannot intialize a simulation without an initial configuration file.\n"); |
1074 |
> |
painCave.isFatal = 1;; |
1075 |
|
simError(); |
1076 |
|
|
922 |
– |
#else |
923 |
– |
|
924 |
– |
initFromBass(); |
925 |
– |
|
926 |
– |
|
927 |
– |
#endif |
1077 |
|
} |
1078 |
< |
|
1078 |
> |
|
1079 |
|
#ifdef IS_MPI |
1080 |
< |
strcpy( checkPointMsg, "Successfully read in the initial configuration" ); |
1080 |
> |
strcpy(checkPointMsg, "Successfully read in the initial configuration"); |
1081 |
|
MPIcheckPoint(); |
1082 |
|
#endif // is_mpi |
934 |
– |
|
1083 |
|
} |
1084 |
|
|
1085 |
|
|
1086 |
< |
void SimSetup::makeOutNames( void ){ |
939 |
< |
|
1086 |
> |
void SimSetup::makeOutNames(void){ |
1087 |
|
int k; |
1088 |
|
|
942 |
– |
|
943 |
– |
for(k=0; k<nInfo; k++){ |
1089 |
|
|
1090 |
+ |
for (k = 0; k < nInfo; k++){ |
1091 |
|
#ifdef IS_MPI |
1092 |
< |
if( worldRank == 0 ){ |
1092 |
> |
if (worldRank == 0){ |
1093 |
|
#endif // is_mpi |
1094 |
< |
|
1095 |
< |
if( globals->haveFinalConfig() ){ |
1096 |
< |
strcpy( info[k].finalName, globals->getFinalConfig() ); |
1094 |
> |
|
1095 |
> |
if (globals->haveFinalConfig()){ |
1096 |
> |
strcpy(info[k].finalName, globals->getFinalConfig()); |
1097 |
|
} |
1098 |
|
else{ |
1099 |
< |
strcpy( info[k].finalName, inFileName ); |
1100 |
< |
char* endTest; |
1101 |
< |
int nameLength = strlen( info[k].finalName ); |
1102 |
< |
endTest = &(info[k].finalName[nameLength - 5]); |
1103 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
1104 |
< |
strcpy( endTest, ".eor" ); |
1105 |
< |
} |
1106 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
1107 |
< |
strcpy( endTest, ".eor" ); |
1108 |
< |
} |
1109 |
< |
else{ |
1110 |
< |
endTest = &(info[k].finalName[nameLength - 4]); |
1111 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
1112 |
< |
strcpy( endTest, ".eor" ); |
1113 |
< |
} |
1114 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
1115 |
< |
strcpy( endTest, ".eor" ); |
1116 |
< |
} |
1117 |
< |
else{ |
1118 |
< |
strcat( info[k].finalName, ".eor" ); |
1119 |
< |
} |
1120 |
< |
} |
1099 |
> |
strcpy(info[k].finalName, inFileName); |
1100 |
> |
char* endTest; |
1101 |
> |
int nameLength = strlen(info[k].finalName); |
1102 |
> |
endTest = &(info[k].finalName[nameLength - 5]); |
1103 |
> |
if (!strcmp(endTest, ".bass")){ |
1104 |
> |
strcpy(endTest, ".eor"); |
1105 |
> |
} |
1106 |
> |
else if (!strcmp(endTest, ".BASS")){ |
1107 |
> |
strcpy(endTest, ".eor"); |
1108 |
> |
} |
1109 |
> |
else{ |
1110 |
> |
endTest = &(info[k].finalName[nameLength - 4]); |
1111 |
> |
if (!strcmp(endTest, ".bss")){ |
1112 |
> |
strcpy(endTest, ".eor"); |
1113 |
> |
} |
1114 |
> |
else if (!strcmp(endTest, ".mdl")){ |
1115 |
> |
strcpy(endTest, ".eor"); |
1116 |
> |
} |
1117 |
> |
else{ |
1118 |
> |
strcat(info[k].finalName, ".eor"); |
1119 |
> |
} |
1120 |
> |
} |
1121 |
|
} |
1122 |
< |
|
1122 |
> |
|
1123 |
|
// make the sample and status out names |
1124 |
< |
|
1125 |
< |
strcpy( info[k].sampleName, inFileName ); |
1124 |
> |
|
1125 |
> |
strcpy(info[k].sampleName, inFileName); |
1126 |
|
char* endTest; |
1127 |
< |
int nameLength = strlen( info[k].sampleName ); |
1127 |
> |
int nameLength = strlen(info[k].sampleName); |
1128 |
|
endTest = &(info[k].sampleName[nameLength - 5]); |
1129 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
1130 |
< |
strcpy( endTest, ".dump" ); |
1129 |
> |
if (!strcmp(endTest, ".bass")){ |
1130 |
> |
strcpy(endTest, ".dump"); |
1131 |
|
} |
1132 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
1133 |
< |
strcpy( endTest, ".dump" ); |
1132 |
> |
else if (!strcmp(endTest, ".BASS")){ |
1133 |
> |
strcpy(endTest, ".dump"); |
1134 |
|
} |
1135 |
|
else{ |
1136 |
< |
endTest = &(info[k].sampleName[nameLength - 4]); |
1137 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
1138 |
< |
strcpy( endTest, ".dump" ); |
1139 |
< |
} |
1140 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
1141 |
< |
strcpy( endTest, ".dump" ); |
1142 |
< |
} |
1143 |
< |
else{ |
1144 |
< |
strcat( info[k].sampleName, ".dump" ); |
1145 |
< |
} |
1136 |
> |
endTest = &(info[k].sampleName[nameLength - 4]); |
1137 |
> |
if (!strcmp(endTest, ".bss")){ |
1138 |
> |
strcpy(endTest, ".dump"); |
1139 |
> |
} |
1140 |
> |
else if (!strcmp(endTest, ".mdl")){ |
1141 |
> |
strcpy(endTest, ".dump"); |
1142 |
> |
} |
1143 |
> |
else{ |
1144 |
> |
strcat(info[k].sampleName, ".dump"); |
1145 |
> |
} |
1146 |
|
} |
1147 |
< |
|
1148 |
< |
strcpy( info[k].statusName, inFileName ); |
1149 |
< |
nameLength = strlen( info[k].statusName ); |
1147 |
> |
|
1148 |
> |
strcpy(info[k].statusName, inFileName); |
1149 |
> |
nameLength = strlen(info[k].statusName); |
1150 |
|
endTest = &(info[k].statusName[nameLength - 5]); |
1151 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
1152 |
< |
strcpy( endTest, ".stat" ); |
1151 |
> |
if (!strcmp(endTest, ".bass")){ |
1152 |
> |
strcpy(endTest, ".stat"); |
1153 |
|
} |
1154 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
1155 |
< |
strcpy( endTest, ".stat" ); |
1154 |
> |
else if (!strcmp(endTest, ".BASS")){ |
1155 |
> |
strcpy(endTest, ".stat"); |
1156 |
|
} |
1157 |
|
else{ |
1158 |
< |
endTest = &(info[k].statusName[nameLength - 4]); |
1159 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
1160 |
< |
strcpy( endTest, ".stat" ); |
1161 |
< |
} |
1162 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
1163 |
< |
strcpy( endTest, ".stat" ); |
1164 |
< |
} |
1165 |
< |
else{ |
1166 |
< |
strcat( info[k].statusName, ".stat" ); |
1167 |
< |
} |
1158 |
> |
endTest = &(info[k].statusName[nameLength - 4]); |
1159 |
> |
if (!strcmp(endTest, ".bss")){ |
1160 |
> |
strcpy(endTest, ".stat"); |
1161 |
> |
} |
1162 |
> |
else if (!strcmp(endTest, ".mdl")){ |
1163 |
> |
strcpy(endTest, ".stat"); |
1164 |
> |
} |
1165 |
> |
else{ |
1166 |
> |
strcat(info[k].statusName, ".stat"); |
1167 |
> |
} |
1168 |
|
} |
1169 |
< |
|
1169 |
> |
|
1170 |
|
#ifdef IS_MPI |
1171 |
+ |
|
1172 |
|
} |
1173 |
|
#endif // is_mpi |
1174 |
|
} |
1175 |
|
} |
1176 |
|
|
1177 |
|
|
1178 |
< |
void SimSetup::sysObjectsCreation( void ){ |
1179 |
< |
|
1180 |
< |
int i,k; |
1034 |
< |
|
1178 |
> |
void SimSetup::sysObjectsCreation(void){ |
1179 |
> |
int i, k; |
1180 |
> |
|
1181 |
|
// create the forceField |
1182 |
< |
|
1182 |
> |
|
1183 |
|
createFF(); |
1184 |
|
|
1185 |
|
// extract componentList |
1192 |
|
|
1193 |
|
#ifdef IS_MPI |
1194 |
|
// divide the molecules among the processors |
1195 |
< |
|
1195 |
> |
|
1196 |
|
mpiMolDivide(); |
1197 |
|
#endif //is_mpi |
1198 |
< |
|
1198 |
> |
|
1199 |
|
// create the atom and SRI arrays. Also initialize Molecule Stamp ID's |
1200 |
< |
|
1200 |
> |
|
1201 |
|
makeSysArrays(); |
1202 |
|
|
1203 |
|
// make and initialize the molecules (all but atomic coordinates) |
1204 |
< |
|
1204 |
> |
|
1205 |
|
makeMolecules(); |
1206 |
< |
|
1207 |
< |
for(k=0; k<nInfo; k++){ |
1206 |
> |
|
1207 |
> |
for (k = 0; k < nInfo; k++){ |
1208 |
|
info[k].identArray = new int[info[k].n_atoms]; |
1209 |
< |
for(i=0; i<info[k].n_atoms; i++){ |
1209 |
> |
for (i = 0; i < info[k].n_atoms; i++){ |
1210 |
|
info[k].identArray[i] = info[k].atoms[i]->getIdent(); |
1211 |
|
} |
1212 |
|
} |
1213 |
|
} |
1214 |
|
|
1215 |
|
|
1216 |
< |
void SimSetup::createFF( void ){ |
1216 |
> |
void SimSetup::createFF(void){ |
1217 |
> |
switch (ffCase){ |
1218 |
> |
case FF_DUFF: |
1219 |
> |
the_ff = new DUFF(); |
1220 |
> |
break; |
1221 |
|
|
1222 |
< |
switch( ffCase ){ |
1222 |
> |
case FF_LJ: |
1223 |
> |
the_ff = new LJFF(); |
1224 |
> |
break; |
1225 |
|
|
1226 |
< |
case FF_DUFF: |
1227 |
< |
the_ff = new DUFF(); |
1228 |
< |
break; |
1226 |
> |
case FF_EAM: |
1227 |
> |
the_ff = new EAM_FF(); |
1228 |
> |
break; |
1229 |
|
|
1230 |
< |
case FF_LJ: |
1231 |
< |
the_ff = new LJFF(); |
1232 |
< |
break; |
1230 |
> |
case FF_H2O: |
1231 |
> |
the_ff = new WATER(); |
1232 |
> |
break; |
1233 |
|
|
1234 |
< |
case FF_EAM: |
1235 |
< |
the_ff = new EAM_FF(); |
1236 |
< |
break; |
1237 |
< |
|
1238 |
< |
default: |
1087 |
< |
sprintf( painCave.errMsg, |
1088 |
< |
"SimSetup Error. Unrecognized force field in case statement.\n"); |
1089 |
< |
painCave.isFatal = 1; |
1090 |
< |
simError(); |
1234 |
> |
default: |
1235 |
> |
sprintf(painCave.errMsg, |
1236 |
> |
"SimSetup Error. Unrecognized force field in case statement.\n"); |
1237 |
> |
painCave.isFatal = 1; |
1238 |
> |
simError(); |
1239 |
|
} |
1240 |
|
|
1241 |
|
#ifdef IS_MPI |
1242 |
< |
strcpy( checkPointMsg, "ForceField creation successful" ); |
1242 |
> |
strcpy(checkPointMsg, "ForceField creation successful"); |
1243 |
|
MPIcheckPoint(); |
1244 |
|
#endif // is_mpi |
1097 |
– |
|
1245 |
|
} |
1246 |
|
|
1247 |
|
|
1248 |
< |
void SimSetup::compList( void ){ |
1102 |
< |
|
1248 |
> |
void SimSetup::compList(void){ |
1249 |
|
int i; |
1250 |
|
char* id; |
1251 |
|
LinkedMolStamp* headStamp = new LinkedMolStamp(); |
1252 |
|
LinkedMolStamp* currentStamp = NULL; |
1253 |
< |
comp_stamps = new MoleculeStamp*[n_components]; |
1254 |
< |
|
1253 |
> |
comp_stamps = new MoleculeStamp * [n_components]; |
1254 |
> |
|
1255 |
|
// make an array of molecule stamps that match the components used. |
1256 |
|
// also extract the used stamps out into a separate linked list |
1257 |
< |
|
1258 |
< |
for(i=0; i<nInfo; i++){ |
1257 |
> |
|
1258 |
> |
for (i = 0; i < nInfo; i++){ |
1259 |
|
info[i].nComponents = n_components; |
1260 |
|
info[i].componentsNmol = components_nmol; |
1261 |
|
info[i].compStamps = comp_stamps; |
1262 |
|
info[i].headStamp = headStamp; |
1263 |
|
} |
1118 |
– |
|
1264 |
|
|
1120 |
– |
for( i=0; i<n_components; i++ ){ |
1265 |
|
|
1266 |
+ |
for (i = 0; i < n_components; i++){ |
1267 |
|
id = the_components[i]->getType(); |
1268 |
|
comp_stamps[i] = NULL; |
1269 |
< |
|
1269 |
> |
|
1270 |
|
// check to make sure the component isn't already in the list |
1271 |
|
|
1272 |
< |
comp_stamps[i] = headStamp->match( id ); |
1273 |
< |
if( comp_stamps[i] == NULL ){ |
1129 |
< |
|
1272 |
> |
comp_stamps[i] = headStamp->match(id); |
1273 |
> |
if (comp_stamps[i] == NULL){ |
1274 |
|
// extract the component from the list; |
1275 |
< |
|
1276 |
< |
currentStamp = stamps->extractMolStamp( id ); |
1277 |
< |
if( currentStamp == NULL ){ |
1278 |
< |
sprintf( painCave.errMsg, |
1279 |
< |
"SimSetup error: Component \"%s\" was not found in the " |
1280 |
< |
"list of declared molecules\n", |
1281 |
< |
id ); |
1282 |
< |
painCave.isFatal = 1; |
1283 |
< |
simError(); |
1275 |
> |
|
1276 |
> |
currentStamp = stamps->extractMolStamp(id); |
1277 |
> |
if (currentStamp == NULL){ |
1278 |
> |
sprintf(painCave.errMsg, |
1279 |
> |
"SimSetup error: Component \"%s\" was not found in the " |
1280 |
> |
"list of declared molecules\n", |
1281 |
> |
id); |
1282 |
> |
painCave.isFatal = 1; |
1283 |
> |
simError(); |
1284 |
|
} |
1285 |
< |
|
1286 |
< |
headStamp->add( currentStamp ); |
1287 |
< |
comp_stamps[i] = headStamp->match( id ); |
1285 |
> |
|
1286 |
> |
headStamp->add(currentStamp); |
1287 |
> |
comp_stamps[i] = headStamp->match(id); |
1288 |
|
} |
1289 |
|
} |
1290 |
|
|
1291 |
|
#ifdef IS_MPI |
1292 |
< |
strcpy( checkPointMsg, "Component stamps successfully extracted\n" ); |
1292 |
> |
strcpy(checkPointMsg, "Component stamps successfully extracted\n"); |
1293 |
|
MPIcheckPoint(); |
1294 |
|
#endif // is_mpi |
1295 |
+ |
} |
1296 |
|
|
1297 |
+ |
void SimSetup::calcSysValues(void){ |
1298 |
+ |
int i; |
1299 |
|
|
1300 |
< |
} |
1300 |
> |
int* molMembershipArray; |
1301 |
|
|
1155 |
– |
void SimSetup::calcSysValues( void ){ |
1156 |
– |
int i, j, k; |
1157 |
– |
|
1158 |
– |
int *molMembershipArray; |
1159 |
– |
|
1302 |
|
tot_atoms = 0; |
1303 |
|
tot_bonds = 0; |
1304 |
|
tot_bends = 0; |
1305 |
|
tot_torsions = 0; |
1306 |
< |
for( i=0; i<n_components; i++ ){ |
1307 |
< |
|
1308 |
< |
tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms(); |
1309 |
< |
tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds(); |
1310 |
< |
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
1306 |
> |
tot_rigid = 0; |
1307 |
> |
for (i = 0; i < n_components; i++){ |
1308 |
> |
tot_atoms += components_nmol[i] * comp_stamps[i]->getNAtoms(); |
1309 |
> |
tot_bonds += components_nmol[i] * comp_stamps[i]->getNBonds(); |
1310 |
> |
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
1311 |
|
tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions(); |
1312 |
+ |
tot_rigid += components_nmol[i] * comp_stamps[i]->getNRigidBodies(); |
1313 |
|
} |
1314 |
|
|
1315 |
|
tot_SRI = tot_bonds + tot_bends + tot_torsions; |
1316 |
|
molMembershipArray = new int[tot_atoms]; |
1317 |
< |
|
1318 |
< |
for(i=0; i<nInfo; i++){ |
1317 |
> |
|
1318 |
> |
for (i = 0; i < nInfo; i++){ |
1319 |
|
info[i].n_atoms = tot_atoms; |
1320 |
|
info[i].n_bonds = tot_bonds; |
1321 |
|
info[i].n_bends = tot_bends; |
1322 |
|
info[i].n_torsions = tot_torsions; |
1323 |
|
info[i].n_SRI = tot_SRI; |
1324 |
|
info[i].n_mol = tot_nmol; |
1325 |
< |
|
1325 |
> |
|
1326 |
|
info[i].molMembershipArray = molMembershipArray; |
1327 |
< |
} |
1327 |
> |
} |
1328 |
|
} |
1329 |
|
|
1330 |
|
#ifdef IS_MPI |
1331 |
|
|
1332 |
< |
void SimSetup::mpiMolDivide( void ){ |
1190 |
< |
|
1332 |
> |
void SimSetup::mpiMolDivide(void){ |
1333 |
|
int i, j, k; |
1334 |
|
int localMol, allMol; |
1335 |
|
int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; |
1336 |
+ |
int local_rigid; |
1337 |
|
|
1338 |
< |
mpiSim = new mpiSimulation( info ); |
1339 |
< |
|
1338 |
> |
mpiSim = new mpiSimulation(info); |
1339 |
> |
|
1340 |
|
globalIndex = mpiSim->divideLabor(); |
1341 |
|
|
1342 |
|
// set up the local variables |
1343 |
< |
|
1343 |
> |
|
1344 |
|
mol2proc = mpiSim->getMolToProcMap(); |
1345 |
|
molCompType = mpiSim->getMolComponentType(); |
1346 |
< |
|
1346 |
> |
|
1347 |
|
allMol = 0; |
1348 |
|
localMol = 0; |
1349 |
|
local_atoms = 0; |
1350 |
|
local_bonds = 0; |
1351 |
|
local_bends = 0; |
1352 |
|
local_torsions = 0; |
1353 |
+ |
local_rigid = 0; |
1354 |
|
globalAtomIndex = 0; |
1355 |
|
|
1356 |
< |
|
1357 |
< |
for( i=0; i<n_components; i++ ){ |
1358 |
< |
|
1359 |
< |
for( j=0; j<components_nmol[i]; j++ ){ |
1360 |
< |
|
1361 |
< |
if( mol2proc[allMol] == worldRank ){ |
1362 |
< |
|
1363 |
< |
local_atoms += comp_stamps[i]->getNAtoms(); |
1364 |
< |
local_bonds += comp_stamps[i]->getNBonds(); |
1221 |
< |
local_bends += comp_stamps[i]->getNBends(); |
1222 |
< |
local_torsions += comp_stamps[i]->getNTorsions(); |
1223 |
< |
localMol++; |
1356 |
> |
for (i = 0; i < n_components; i++){ |
1357 |
> |
for (j = 0; j < components_nmol[i]; j++){ |
1358 |
> |
if (mol2proc[allMol] == worldRank){ |
1359 |
> |
local_atoms += comp_stamps[i]->getNAtoms(); |
1360 |
> |
local_bonds += comp_stamps[i]->getNBonds(); |
1361 |
> |
local_bends += comp_stamps[i]->getNBends(); |
1362 |
> |
local_torsions += comp_stamps[i]->getNTorsions(); |
1363 |
> |
local_rigid += comp_stamps[i]->getNRigidBodies(); |
1364 |
> |
localMol++; |
1365 |
|
} |
1366 |
< |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1366 |
> |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ |
1367 |
|
info[0].molMembershipArray[globalAtomIndex] = allMol; |
1368 |
|
globalAtomIndex++; |
1369 |
|
} |
1370 |
|
|
1371 |
< |
allMol++; |
1371 |
> |
allMol++; |
1372 |
|
} |
1373 |
|
} |
1374 |
|
local_SRI = local_bonds + local_bends + local_torsions; |
1375 |
< |
|
1375 |
> |
|
1376 |
|
info[0].n_atoms = mpiSim->getMyNlocal(); |
1377 |
|
|
1378 |
< |
if( local_atoms != info[0].n_atoms ){ |
1379 |
< |
sprintf( painCave.errMsg, |
1380 |
< |
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
1381 |
< |
" localAtom (%d) are not equal.\n", |
1382 |
< |
info[0].n_atoms, |
1383 |
< |
local_atoms ); |
1378 |
> |
|
1379 |
> |
if (local_atoms != info[0].n_atoms){ |
1380 |
> |
sprintf(painCave.errMsg, |
1381 |
> |
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's\n" |
1382 |
> |
"\tlocalAtom (%d) are not equal.\n", |
1383 |
> |
info[0].n_atoms, local_atoms); |
1384 |
|
painCave.isFatal = 1; |
1385 |
|
simError(); |
1386 |
|
} |
1391 |
|
info[0].n_SRI = local_SRI; |
1392 |
|
info[0].n_mol = localMol; |
1393 |
|
|
1394 |
< |
strcpy( checkPointMsg, "Passed nlocal consistency check." ); |
1394 |
> |
strcpy(checkPointMsg, "Passed nlocal consistency check."); |
1395 |
|
MPIcheckPoint(); |
1396 |
|
} |
1397 |
< |
|
1397 |
> |
|
1398 |
|
#endif // is_mpi |
1399 |
|
|
1400 |
|
|
1401 |
< |
void SimSetup::makeSysArrays( void ){ |
1402 |
< |
int i, j, k, l; |
1401 |
> |
void SimSetup::makeSysArrays(void){ |
1402 |
> |
|
1403 |
> |
#ifndef IS_MPI |
1404 |
> |
int k, j; |
1405 |
> |
#endif // is_mpi |
1406 |
> |
int i, l; |
1407 |
|
|
1408 |
|
Atom** the_atoms; |
1409 |
|
Molecule* the_molecules; |
1265 |
– |
Exclude** the_excludes; |
1410 |
|
|
1411 |
< |
|
1268 |
< |
for(l=0; l<nInfo; l++){ |
1269 |
< |
|
1411 |
> |
for (l = 0; l < nInfo; l++){ |
1412 |
|
// create the atom and short range interaction arrays |
1413 |
< |
|
1414 |
< |
the_atoms = new Atom*[info[l].n_atoms]; |
1413 |
> |
|
1414 |
> |
the_atoms = new Atom * [info[l].n_atoms]; |
1415 |
|
the_molecules = new Molecule[info[l].n_mol]; |
1416 |
|
int molIndex; |
1417 |
|
|
1418 |
|
// initialize the molecule's stampID's |
1419 |
< |
|
1419 |
> |
|
1420 |
|
#ifdef IS_MPI |
1421 |
< |
|
1422 |
< |
|
1421 |
> |
|
1422 |
> |
|
1423 |
|
molIndex = 0; |
1424 |
< |
for(i=0; i<mpiSim->getTotNmol(); i++){ |
1425 |
< |
|
1426 |
< |
if(mol2proc[i] == worldRank ){ |
1427 |
< |
the_molecules[molIndex].setStampID( molCompType[i] ); |
1428 |
< |
the_molecules[molIndex].setMyIndex( molIndex ); |
1429 |
< |
the_molecules[molIndex].setGlobalIndex( i ); |
1288 |
< |
molIndex++; |
1424 |
> |
for (i = 0; i < mpiSim->getTotNmol(); i++){ |
1425 |
> |
if (mol2proc[i] == worldRank){ |
1426 |
> |
the_molecules[molIndex].setStampID(molCompType[i]); |
1427 |
> |
the_molecules[molIndex].setMyIndex(molIndex); |
1428 |
> |
the_molecules[molIndex].setGlobalIndex(i); |
1429 |
> |
molIndex++; |
1430 |
|
} |
1431 |
|
} |
1432 |
< |
|
1432 |
> |
|
1433 |
|
#else // is_mpi |
1434 |
< |
|
1434 |
> |
|
1435 |
|
molIndex = 0; |
1436 |
|
globalAtomIndex = 0; |
1437 |
< |
for(i=0; i<n_components; i++){ |
1438 |
< |
for(j=0; j<components_nmol[i]; j++ ){ |
1439 |
< |
the_molecules[molIndex].setStampID( i ); |
1440 |
< |
the_molecules[molIndex].setMyIndex( molIndex ); |
1441 |
< |
the_molecules[molIndex].setGlobalIndex( molIndex ); |
1442 |
< |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1443 |
< |
info[l].molMembershipArray[globalAtomIndex] = molIndex; |
1444 |
< |
globalAtomIndex++; |
1445 |
< |
} |
1446 |
< |
molIndex++; |
1437 |
> |
for (i = 0; i < n_components; i++){ |
1438 |
> |
for (j = 0; j < components_nmol[i]; j++){ |
1439 |
> |
the_molecules[molIndex].setStampID(i); |
1440 |
> |
the_molecules[molIndex].setMyIndex(molIndex); |
1441 |
> |
the_molecules[molIndex].setGlobalIndex(molIndex); |
1442 |
> |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ |
1443 |
> |
info[l].molMembershipArray[globalAtomIndex] = molIndex; |
1444 |
> |
globalAtomIndex++; |
1445 |
> |
} |
1446 |
> |
molIndex++; |
1447 |
|
} |
1448 |
|
} |
1308 |
– |
|
1309 |
– |
|
1310 |
– |
#endif // is_mpi |
1449 |
|
|
1450 |
|
|
1451 |
< |
if( info[l].n_SRI ){ |
1314 |
< |
|
1315 |
< |
Exclude::createArray(info[l].n_SRI); |
1316 |
< |
the_excludes = new Exclude*[info[l].n_SRI]; |
1317 |
< |
for( int ex=0; ex<info[l].n_SRI; ex++){ |
1318 |
< |
the_excludes[ex] = new Exclude(ex); |
1319 |
< |
} |
1320 |
< |
info[l].globalExcludes = new int; |
1321 |
< |
info[l].n_exclude = info[l].n_SRI; |
1322 |
< |
} |
1323 |
< |
else{ |
1324 |
< |
|
1325 |
< |
Exclude::createArray( 1 ); |
1326 |
< |
the_excludes = new Exclude*; |
1327 |
< |
the_excludes[0] = new Exclude(0); |
1328 |
< |
the_excludes[0]->setPair( 0,0 ); |
1329 |
< |
info[l].globalExcludes = new int; |
1330 |
< |
info[l].globalExcludes[0] = 0; |
1331 |
< |
info[l].n_exclude = 0; |
1332 |
< |
} |
1451 |
> |
#endif // is_mpi |
1452 |
|
|
1453 |
+ |
info[l].globalExcludes = new int; |
1454 |
+ |
info[l].globalExcludes[0] = 0; |
1455 |
+ |
|
1456 |
|
// set the arrays into the SimInfo object |
1457 |
|
|
1458 |
|
info[l].atoms = the_atoms; |
1459 |
|
info[l].molecules = the_molecules; |
1460 |
|
info[l].nGlobalExcludes = 0; |
1339 |
– |
info[l].excludes = the_excludes; |
1461 |
|
|
1462 |
< |
the_ff->setSimInfo( info ); |
1342 |
< |
|
1462 |
> |
the_ff->setSimInfo(info); |
1463 |
|
} |
1464 |
|
} |
1465 |
|
|
1466 |
< |
void SimSetup::makeIntegrator( void ){ |
1347 |
< |
|
1466 |
> |
void SimSetup::makeIntegrator(void){ |
1467 |
|
int k; |
1468 |
|
|
1469 |
< |
NVT<RealIntegrator>* myNVT = NULL; |
1470 |
< |
NPTi<RealIntegrator>* myNPTi = NULL; |
1471 |
< |
NPTf<RealIntegrator>* myNPTf = NULL; |
1472 |
< |
NPTim<RealIntegrator>* myNPTim = NULL; |
1473 |
< |
NPTfm<RealIntegrator>* myNPTfm = NULL; |
1474 |
< |
|
1475 |
< |
for(k=0; k<nInfo; k++){ |
1476 |
< |
|
1477 |
< |
switch( ensembleCase ){ |
1478 |
< |
|
1479 |
< |
case NVE_ENS: |
1480 |
< |
if (globals->haveZconstraints()){ |
1481 |
< |
setupZConstraint(info[k]); |
1482 |
< |
new ZConstraint<NVE<RealIntegrator> >( &(info[k]), the_ff ); |
1469 |
> |
NVE<RealIntegrator>* myNVE = NULL; |
1470 |
> |
NVT<RealIntegrator>* myNVT = NULL; |
1471 |
> |
NPTi<NPT<RealIntegrator> >* myNPTi = NULL; |
1472 |
> |
NPTf<NPT<RealIntegrator> >* myNPTf = NULL; |
1473 |
> |
NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL; |
1474 |
> |
|
1475 |
> |
for (k = 0; k < nInfo; k++){ |
1476 |
> |
switch (ensembleCase){ |
1477 |
> |
case NVE_ENS: |
1478 |
> |
if (globals->haveZconstraints()){ |
1479 |
> |
setupZConstraint(info[k]); |
1480 |
> |
myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1481 |
> |
} |
1482 |
> |
else{ |
1483 |
> |
myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1484 |
|
} |
1485 |
+ |
|
1486 |
+ |
info->the_integrator = myNVE; |
1487 |
+ |
break; |
1488 |
|
|
1489 |
< |
else |
1490 |
< |
new NVE<RealIntegrator>( &(info[k]), the_ff ); |
1491 |
< |
break; |
1492 |
< |
|
1493 |
< |
case NVT_ENS: |
1494 |
< |
if (globals->haveZconstraints()){ |
1495 |
< |
setupZConstraint(info[k]); |
1373 |
< |
myNVT = new ZConstraint<NVT<RealIntegrator> >( &(info[k]), the_ff ); |
1374 |
< |
} |
1375 |
< |
else |
1376 |
< |
myNVT = new NVT<RealIntegrator>( &(info[k]), the_ff ); |
1489 |
> |
case NVT_ENS: |
1490 |
> |
if (globals->haveZconstraints()){ |
1491 |
> |
setupZConstraint(info[k]); |
1492 |
> |
myNVT = new ZConstraint<NVT<RealIntegrator> >(&(info[k]), the_ff); |
1493 |
> |
} |
1494 |
> |
else |
1495 |
> |
myNVT = new NVT<RealIntegrator>(&(info[k]), the_ff); |
1496 |
|
|
1497 |
< |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1379 |
< |
|
1380 |
< |
if (globals->haveTauThermostat()) |
1381 |
< |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1382 |
< |
|
1383 |
< |
else { |
1384 |
< |
sprintf( painCave.errMsg, |
1385 |
< |
"SimSetup error: If you use the NVT\n" |
1386 |
< |
" ensemble, you must set tauThermostat.\n"); |
1387 |
< |
painCave.isFatal = 1; |
1388 |
< |
simError(); |
1389 |
< |
} |
1390 |
< |
break; |
1391 |
< |
|
1392 |
< |
case NPTi_ENS: |
1393 |
< |
if (globals->haveZconstraints()){ |
1394 |
< |
setupZConstraint(info[k]); |
1395 |
< |
myNPTi = new ZConstraint<NPTi<RealIntegrator> >( &(info[k]), the_ff ); |
1396 |
< |
} |
1397 |
< |
else |
1398 |
< |
myNPTi = new NPTi<RealIntegrator>( &(info[k]), the_ff ); |
1497 |
> |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1498 |
|
|
1499 |
< |
myNPTi->setTargetTemp( globals->getTargetTemp() ); |
1500 |
< |
|
1501 |
< |
if (globals->haveTargetPressure()) |
1502 |
< |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1503 |
< |
else { |
1504 |
< |
sprintf( painCave.errMsg, |
1505 |
< |
"SimSetup error: If you use a constant pressure\n" |
1506 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1507 |
< |
painCave.isFatal = 1; |
1409 |
< |
simError(); |
1410 |
< |
} |
1411 |
< |
|
1412 |
< |
if( globals->haveTauThermostat() ) |
1413 |
< |
myNPTi->setTauThermostat( globals->getTauThermostat() ); |
1414 |
< |
else{ |
1415 |
< |
sprintf( painCave.errMsg, |
1416 |
< |
"SimSetup error: If you use an NPT\n" |
1417 |
< |
" ensemble, you must set tauThermostat.\n"); |
1418 |
< |
painCave.isFatal = 1; |
1419 |
< |
simError(); |
1420 |
< |
} |
1421 |
< |
|
1422 |
< |
if( globals->haveTauBarostat() ) |
1423 |
< |
myNPTi->setTauBarostat( globals->getTauBarostat() ); |
1424 |
< |
else{ |
1425 |
< |
sprintf( painCave.errMsg, |
1426 |
< |
"SimSetup error: If you use an NPT\n" |
1427 |
< |
" ensemble, you must set tauBarostat.\n"); |
1428 |
< |
painCave.isFatal = 1; |
1429 |
< |
simError(); |
1430 |
< |
} |
1431 |
< |
break; |
1432 |
< |
|
1433 |
< |
case NPTf_ENS: |
1434 |
< |
if (globals->haveZconstraints()){ |
1435 |
< |
setupZConstraint(info[k]); |
1436 |
< |
myNPTf = new ZConstraint<NPTf<RealIntegrator> >( &(info[k]), the_ff ); |
1437 |
< |
} |
1438 |
< |
else |
1439 |
< |
myNPTf = new NPTf<RealIntegrator>( &(info[k]), the_ff ); |
1499 |
> |
if (globals->haveTauThermostat()) |
1500 |
> |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1501 |
> |
else{ |
1502 |
> |
sprintf(painCave.errMsg, |
1503 |
> |
"SimSetup error: If you use the NVT\n" |
1504 |
> |
"\tensemble, you must set tauThermostat.\n"); |
1505 |
> |
painCave.isFatal = 1; |
1506 |
> |
simError(); |
1507 |
> |
} |
1508 |
|
|
1509 |
< |
myNPTf->setTargetTemp( globals->getTargetTemp()); |
1510 |
< |
|
1443 |
< |
if (globals->haveTargetPressure()) |
1444 |
< |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1445 |
< |
else { |
1446 |
< |
sprintf( painCave.errMsg, |
1447 |
< |
"SimSetup error: If you use a constant pressure\n" |
1448 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1449 |
< |
painCave.isFatal = 1; |
1450 |
< |
simError(); |
1451 |
< |
} |
1452 |
< |
|
1453 |
< |
if( globals->haveTauThermostat() ) |
1454 |
< |
myNPTf->setTauThermostat( globals->getTauThermostat() ); |
1455 |
< |
else{ |
1456 |
< |
sprintf( painCave.errMsg, |
1457 |
< |
"SimSetup error: If you use an NPT\n" |
1458 |
< |
" ensemble, you must set tauThermostat.\n"); |
1459 |
< |
painCave.isFatal = 1; |
1460 |
< |
simError(); |
1461 |
< |
} |
1462 |
< |
|
1463 |
< |
if( globals->haveTauBarostat() ) |
1464 |
< |
myNPTf->setTauBarostat( globals->getTauBarostat() ); |
1465 |
< |
else{ |
1466 |
< |
sprintf( painCave.errMsg, |
1467 |
< |
"SimSetup error: If you use an NPT\n" |
1468 |
< |
" ensemble, you must set tauBarostat.\n"); |
1469 |
< |
painCave.isFatal = 1; |
1470 |
< |
simError(); |
1471 |
< |
} |
1472 |
< |
break; |
1473 |
< |
|
1474 |
< |
case NPTim_ENS: |
1475 |
< |
if (globals->haveZconstraints()){ |
1476 |
< |
setupZConstraint(info[k]); |
1477 |
< |
myNPTim = new ZConstraint<NPTim<RealIntegrator> >( &(info[k]), the_ff ); |
1478 |
< |
} |
1479 |
< |
else |
1480 |
< |
myNPTim = new NPTim<RealIntegrator>( &(info[k]), the_ff ); |
1509 |
> |
info->the_integrator = myNVT; |
1510 |
> |
break; |
1511 |
|
|
1512 |
< |
myNPTim->setTargetTemp( globals->getTargetTemp()); |
1513 |
< |
|
1514 |
< |
if (globals->haveTargetPressure()) |
1515 |
< |
myNPTim->setTargetPressure(globals->getTargetPressure()); |
1516 |
< |
else { |
1517 |
< |
sprintf( painCave.errMsg, |
1518 |
< |
"SimSetup error: If you use a constant pressure\n" |
1489 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1490 |
< |
painCave.isFatal = 1; |
1491 |
< |
simError(); |
1492 |
< |
} |
1493 |
< |
|
1494 |
< |
if( globals->haveTauThermostat() ) |
1495 |
< |
myNPTim->setTauThermostat( globals->getTauThermostat() ); |
1496 |
< |
else{ |
1497 |
< |
sprintf( painCave.errMsg, |
1498 |
< |
"SimSetup error: If you use an NPT\n" |
1499 |
< |
" ensemble, you must set tauThermostat.\n"); |
1500 |
< |
painCave.isFatal = 1; |
1501 |
< |
simError(); |
1502 |
< |
} |
1503 |
< |
|
1504 |
< |
if( globals->haveTauBarostat() ) |
1505 |
< |
myNPTim->setTauBarostat( globals->getTauBarostat() ); |
1506 |
< |
else{ |
1507 |
< |
sprintf( painCave.errMsg, |
1508 |
< |
"SimSetup error: If you use an NPT\n" |
1509 |
< |
" ensemble, you must set tauBarostat.\n"); |
1510 |
< |
painCave.isFatal = 1; |
1511 |
< |
simError(); |
1512 |
< |
} |
1513 |
< |
break; |
1514 |
< |
|
1515 |
< |
case NPTfm_ENS: |
1516 |
< |
if (globals->haveZconstraints()){ |
1517 |
< |
setupZConstraint(info[k]); |
1518 |
< |
myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >( &(info[k]), the_ff ); |
1519 |
< |
} |
1520 |
< |
else |
1521 |
< |
myNPTfm = new NPTfm<RealIntegrator>( &(info[k]), the_ff ); |
1512 |
> |
case NPTi_ENS: |
1513 |
> |
if (globals->haveZconstraints()){ |
1514 |
> |
setupZConstraint(info[k]); |
1515 |
> |
myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1516 |
> |
} |
1517 |
> |
else |
1518 |
> |
myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff); |
1519 |
|
|
1520 |
< |
myNPTfm->setTargetTemp( globals->getTargetTemp()); |
1521 |
< |
|
1522 |
< |
if (globals->haveTargetPressure()) |
1523 |
< |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1524 |
< |
else { |
1525 |
< |
sprintf( painCave.errMsg, |
1526 |
< |
"SimSetup error: If you use a constant pressure\n" |
1527 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1528 |
< |
painCave.isFatal = 1; |
1529 |
< |
simError(); |
1530 |
< |
} |
1531 |
< |
|
1532 |
< |
if( globals->haveTauThermostat() ) |
1533 |
< |
myNPTfm->setTauThermostat( globals->getTauThermostat() ); |
1534 |
< |
else{ |
1535 |
< |
sprintf( painCave.errMsg, |
1536 |
< |
"SimSetup error: If you use an NPT\n" |
1537 |
< |
" ensemble, you must set tauThermostat.\n"); |
1538 |
< |
painCave.isFatal = 1; |
1539 |
< |
simError(); |
1540 |
< |
} |
1541 |
< |
|
1542 |
< |
if( globals->haveTauBarostat() ) |
1543 |
< |
myNPTfm->setTauBarostat( globals->getTauBarostat() ); |
1544 |
< |
else{ |
1545 |
< |
sprintf( painCave.errMsg, |
1546 |
< |
"SimSetup error: If you use an NPT\n" |
1547 |
< |
" ensemble, you must set tauBarostat.\n"); |
1548 |
< |
painCave.isFatal = 1; |
1549 |
< |
simError(); |
1550 |
< |
} |
1551 |
< |
break; |
1552 |
< |
|
1553 |
< |
default: |
1554 |
< |
sprintf( painCave.errMsg, |
1555 |
< |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1556 |
< |
painCave.isFatal = 1; |
1557 |
< |
simError(); |
1520 |
> |
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1521 |
> |
|
1522 |
> |
if (globals->haveTargetPressure()) |
1523 |
> |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1524 |
> |
else{ |
1525 |
> |
sprintf(painCave.errMsg, |
1526 |
> |
"SimSetup error: If you use a constant pressure\n" |
1527 |
> |
"\tensemble, you must set targetPressure in the BASS file.\n"); |
1528 |
> |
painCave.isFatal = 1; |
1529 |
> |
simError(); |
1530 |
> |
} |
1531 |
> |
|
1532 |
> |
if (globals->haveTauThermostat()) |
1533 |
> |
myNPTi->setTauThermostat(globals->getTauThermostat()); |
1534 |
> |
else{ |
1535 |
> |
sprintf(painCave.errMsg, |
1536 |
> |
"SimSetup error: If you use an NPT\n" |
1537 |
> |
"\tensemble, you must set tauThermostat.\n"); |
1538 |
> |
painCave.isFatal = 1; |
1539 |
> |
simError(); |
1540 |
> |
} |
1541 |
> |
|
1542 |
> |
if (globals->haveTauBarostat()) |
1543 |
> |
myNPTi->setTauBarostat(globals->getTauBarostat()); |
1544 |
> |
else{ |
1545 |
> |
sprintf(painCave.errMsg, |
1546 |
> |
"SimSetup error: If you use an NPT\n" |
1547 |
> |
"\tensemble, you must set tauBarostat.\n"); |
1548 |
> |
painCave.isFatal = 1; |
1549 |
> |
simError(); |
1550 |
> |
} |
1551 |
> |
|
1552 |
> |
info->the_integrator = myNPTi; |
1553 |
> |
break; |
1554 |
> |
|
1555 |
> |
case NPTf_ENS: |
1556 |
> |
if (globals->haveZconstraints()){ |
1557 |
> |
setupZConstraint(info[k]); |
1558 |
> |
myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1559 |
> |
} |
1560 |
> |
else |
1561 |
> |
myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1562 |
> |
|
1563 |
> |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1564 |
> |
|
1565 |
> |
if (globals->haveTargetPressure()) |
1566 |
> |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1567 |
> |
else{ |
1568 |
> |
sprintf(painCave.errMsg, |
1569 |
> |
"SimSetup error: If you use a constant pressure\n" |
1570 |
> |
"\tensemble, you must set targetPressure in the BASS file.\n"); |
1571 |
> |
painCave.isFatal = 1; |
1572 |
> |
simError(); |
1573 |
> |
} |
1574 |
> |
|
1575 |
> |
if (globals->haveTauThermostat()) |
1576 |
> |
myNPTf->setTauThermostat(globals->getTauThermostat()); |
1577 |
> |
|
1578 |
> |
else{ |
1579 |
> |
sprintf(painCave.errMsg, |
1580 |
> |
"SimSetup error: If you use an NPT\n" |
1581 |
> |
"\tensemble, you must set tauThermostat.\n"); |
1582 |
> |
painCave.isFatal = 1; |
1583 |
> |
simError(); |
1584 |
> |
} |
1585 |
> |
|
1586 |
> |
if (globals->haveTauBarostat()) |
1587 |
> |
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1588 |
> |
|
1589 |
> |
else{ |
1590 |
> |
sprintf(painCave.errMsg, |
1591 |
> |
"SimSetup error: If you use an NPT\n" |
1592 |
> |
"\tensemble, you must set tauBarostat.\n"); |
1593 |
> |
painCave.isFatal = 1; |
1594 |
> |
simError(); |
1595 |
> |
} |
1596 |
> |
|
1597 |
> |
info->the_integrator = myNPTf; |
1598 |
> |
break; |
1599 |
> |
|
1600 |
> |
case NPTxyz_ENS: |
1601 |
> |
if (globals->haveZconstraints()){ |
1602 |
> |
setupZConstraint(info[k]); |
1603 |
> |
myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1604 |
> |
} |
1605 |
> |
else |
1606 |
> |
myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1607 |
> |
|
1608 |
> |
myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1609 |
> |
|
1610 |
> |
if (globals->haveTargetPressure()) |
1611 |
> |
myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1612 |
> |
else{ |
1613 |
> |
sprintf(painCave.errMsg, |
1614 |
> |
"SimSetup error: If you use a constant pressure\n" |
1615 |
> |
"\tensemble, you must set targetPressure in the BASS file.\n"); |
1616 |
> |
painCave.isFatal = 1; |
1617 |
> |
simError(); |
1618 |
> |
} |
1619 |
> |
|
1620 |
> |
if (globals->haveTauThermostat()) |
1621 |
> |
myNPTxyz->setTauThermostat(globals->getTauThermostat()); |
1622 |
> |
else{ |
1623 |
> |
sprintf(painCave.errMsg, |
1624 |
> |
"SimSetup error: If you use an NPT\n" |
1625 |
> |
"\tensemble, you must set tauThermostat.\n"); |
1626 |
> |
painCave.isFatal = 1; |
1627 |
> |
simError(); |
1628 |
> |
} |
1629 |
> |
|
1630 |
> |
if (globals->haveTauBarostat()) |
1631 |
> |
myNPTxyz->setTauBarostat(globals->getTauBarostat()); |
1632 |
> |
else{ |
1633 |
> |
sprintf(painCave.errMsg, |
1634 |
> |
"SimSetup error: If you use an NPT\n" |
1635 |
> |
"\tensemble, you must set tauBarostat.\n"); |
1636 |
> |
painCave.isFatal = 1; |
1637 |
> |
simError(); |
1638 |
> |
} |
1639 |
> |
|
1640 |
> |
info->the_integrator = myNPTxyz; |
1641 |
> |
break; |
1642 |
> |
|
1643 |
> |
default: |
1644 |
> |
sprintf(painCave.errMsg, |
1645 |
> |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1646 |
> |
painCave.isFatal = 1; |
1647 |
> |
simError(); |
1648 |
|
} |
1649 |
|
} |
1650 |
|
} |
1651 |
|
|
1652 |
< |
void SimSetup::initFortran( void ){ |
1566 |
< |
|
1652 |
> |
void SimSetup::initFortran(void){ |
1653 |
|
info[0].refreshSim(); |
1654 |
< |
|
1655 |
< |
if( !strcmp( info[0].mixingRule, "standard") ){ |
1656 |
< |
the_ff->initForceField( LB_MIXING_RULE ); |
1654 |
> |
|
1655 |
> |
if (!strcmp(info[0].mixingRule, "standard")){ |
1656 |
> |
the_ff->initForceField(LB_MIXING_RULE); |
1657 |
|
} |
1658 |
< |
else if( !strcmp( info[0].mixingRule, "explicit") ){ |
1659 |
< |
the_ff->initForceField( EXPLICIT_MIXING_RULE ); |
1658 |
> |
else if (!strcmp(info[0].mixingRule, "explicit")){ |
1659 |
> |
the_ff->initForceField(EXPLICIT_MIXING_RULE); |
1660 |
|
} |
1661 |
|
else{ |
1662 |
< |
sprintf( painCave.errMsg, |
1663 |
< |
"SimSetup Error: unknown mixing rule -> \"%s\"\n", |
1578 |
< |
info[0].mixingRule ); |
1662 |
> |
sprintf(painCave.errMsg, "SimSetup Error: unknown mixing rule -> \"%s\"\n", |
1663 |
> |
info[0].mixingRule); |
1664 |
|
painCave.isFatal = 1; |
1665 |
|
simError(); |
1666 |
|
} |
1667 |
|
|
1668 |
|
|
1669 |
|
#ifdef IS_MPI |
1670 |
< |
strcpy( checkPointMsg, |
1586 |
< |
"Successfully intialized the mixingRule for Fortran." ); |
1670 |
> |
strcpy(checkPointMsg, "Successfully intialized the mixingRule for Fortran."); |
1671 |
|
MPIcheckPoint(); |
1672 |
|
#endif // is_mpi |
1589 |
– |
|
1673 |
|
} |
1674 |
|
|
1675 |
< |
void SimSetup::setupZConstraint(SimInfo& theInfo) |
1676 |
< |
{ |
1677 |
< |
int nZConstraints; |
1595 |
< |
ZconStamp** zconStamp; |
1596 |
< |
|
1597 |
< |
if(globals->haveZconstraintTime()){ |
1598 |
< |
|
1599 |
< |
//add sample time of z-constraint into SimInfo's property list |
1600 |
< |
DoubleData* zconsTimeProp = new DoubleData(); |
1601 |
< |
zconsTimeProp->setID(ZCONSTIME_ID); |
1602 |
< |
zconsTimeProp->setData(globals->getZconsTime()); |
1603 |
< |
theInfo.addProperty(zconsTimeProp); |
1604 |
< |
} |
1605 |
< |
else{ |
1606 |
< |
sprintf( painCave.errMsg, |
1607 |
< |
"ZConstraint error: If you use an ZConstraint\n" |
1608 |
< |
" , you must set sample time.\n"); |
1609 |
< |
painCave.isFatal = 1; |
1610 |
< |
simError(); |
1611 |
< |
} |
1675 |
> |
void SimSetup::setupZConstraint(SimInfo& theInfo){ |
1676 |
> |
int nZConstraints; |
1677 |
> |
ZconStamp** zconStamp; |
1678 |
|
|
1679 |
< |
// |
1680 |
< |
nZConstraints = globals->getNzConstraints(); |
1681 |
< |
zconStamp = globals->getZconStamp(); |
1682 |
< |
ZConsParaItem tempParaItem; |
1679 |
> |
if (globals->haveZconstraintTime()){ |
1680 |
> |
//add sample time of z-constraint into SimInfo's property list |
1681 |
> |
DoubleData* zconsTimeProp = new DoubleData(); |
1682 |
> |
zconsTimeProp->setID(ZCONSTIME_ID); |
1683 |
> |
zconsTimeProp->setData(globals->getZconsTime()); |
1684 |
> |
theInfo.addProperty(zconsTimeProp); |
1685 |
> |
} |
1686 |
> |
else{ |
1687 |
> |
sprintf(painCave.errMsg, |
1688 |
> |
"ZConstraint error: If you use a ZConstraint,\n" |
1689 |
> |
"\tyou must set zconsTime.\n"); |
1690 |
> |
painCave.isFatal = 1; |
1691 |
> |
simError(); |
1692 |
> |
} |
1693 |
|
|
1694 |
< |
ZConsParaData* zconsParaData = new ZConsParaData(); |
1695 |
< |
zconsParaData->setID(ZCONSPARADATA_ID); |
1696 |
< |
|
1697 |
< |
for(int i = 0; i < nZConstraints; i++){ |
1694 |
> |
//push zconsTol into siminfo, if user does not specify |
1695 |
> |
//value for zconsTol, a default value will be used |
1696 |
> |
DoubleData* zconsTol = new DoubleData(); |
1697 |
> |
zconsTol->setID(ZCONSTOL_ID); |
1698 |
> |
if (globals->haveZconsTol()){ |
1699 |
> |
zconsTol->setData(globals->getZconsTol()); |
1700 |
> |
} |
1701 |
> |
else{ |
1702 |
> |
double defaultZConsTol = 0.01; |
1703 |
> |
sprintf(painCave.errMsg, |
1704 |
> |
"ZConstraint Warning: Tolerance for z-constraint method is not specified.\n" |
1705 |
> |
"\tOOPSE will use a default value of %f.\n" |
1706 |
> |
"\tTo set the tolerance, use the zconsTol variable.\n", |
1707 |
> |
defaultZConsTol); |
1708 |
> |
painCave.isFatal = 0; |
1709 |
> |
simError(); |
1710 |
> |
|
1711 |
> |
zconsTol->setData(defaultZConsTol); |
1712 |
> |
} |
1713 |
> |
theInfo.addProperty(zconsTol); |
1714 |
> |
|
1715 |
> |
//set Force Subtraction Policy |
1716 |
> |
StringData* zconsForcePolicy = new StringData(); |
1717 |
> |
zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); |
1718 |
> |
|
1719 |
> |
if (globals->haveZconsForcePolicy()){ |
1720 |
> |
zconsForcePolicy->setData(globals->getZconsForcePolicy()); |
1721 |
> |
} |
1722 |
> |
else{ |
1723 |
> |
sprintf(painCave.errMsg, |
1724 |
> |
"ZConstraint Warning: No force subtraction policy was set.\n" |
1725 |
> |
"\tOOPSE will use PolicyByMass.\n" |
1726 |
> |
"\tTo set the policy, use the zconsForcePolicy variable.\n"); |
1727 |
> |
painCave.isFatal = 0; |
1728 |
> |
simError(); |
1729 |
> |
zconsForcePolicy->setData("BYMASS"); |
1730 |
> |
} |
1731 |
> |
|
1732 |
> |
theInfo.addProperty(zconsForcePolicy); |
1733 |
> |
|
1734 |
> |
//set zcons gap |
1735 |
> |
DoubleData* zconsGap = new DoubleData(); |
1736 |
> |
zconsGap->setID(ZCONSGAP_ID); |
1737 |
> |
|
1738 |
> |
if (globals->haveZConsGap()){ |
1739 |
> |
zconsGap->setData(globals->getZconsGap()); |
1740 |
> |
theInfo.addProperty(zconsGap); |
1741 |
> |
} |
1742 |
> |
|
1743 |
> |
//set zcons fixtime |
1744 |
> |
DoubleData* zconsFixtime = new DoubleData(); |
1745 |
> |
zconsFixtime->setID(ZCONSFIXTIME_ID); |
1746 |
> |
|
1747 |
> |
if (globals->haveZConsFixTime()){ |
1748 |
> |
zconsFixtime->setData(globals->getZconsFixtime()); |
1749 |
> |
theInfo.addProperty(zconsFixtime); |
1750 |
> |
} |
1751 |
> |
|
1752 |
> |
//set zconsUsingSMD |
1753 |
> |
IntData* zconsUsingSMD = new IntData(); |
1754 |
> |
zconsUsingSMD->setID(ZCONSUSINGSMD_ID); |
1755 |
> |
|
1756 |
> |
if (globals->haveZConsUsingSMD()){ |
1757 |
> |
zconsUsingSMD->setData(globals->getZconsUsingSMD()); |
1758 |
> |
theInfo.addProperty(zconsUsingSMD); |
1759 |
> |
} |
1760 |
> |
|
1761 |
> |
//Determine the name of ouput file and add it into SimInfo's property list |
1762 |
> |
//Be careful, do not use inFileName, since it is a pointer which |
1763 |
> |
//point to a string at master node, and slave nodes do not contain that string |
1764 |
> |
|
1765 |
> |
string zconsOutput(theInfo.finalName); |
1766 |
> |
|
1767 |
> |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1768 |
> |
|
1769 |
> |
StringData* zconsFilename = new StringData(); |
1770 |
> |
zconsFilename->setID(ZCONSFILENAME_ID); |
1771 |
> |
zconsFilename->setData(zconsOutput); |
1772 |
> |
|
1773 |
> |
theInfo.addProperty(zconsFilename); |
1774 |
> |
|
1775 |
> |
//setup index, pos and other parameters of z-constraint molecules |
1776 |
> |
nZConstraints = globals->getNzConstraints(); |
1777 |
> |
theInfo.nZconstraints = nZConstraints; |
1778 |
> |
|
1779 |
> |
zconStamp = globals->getZconStamp(); |
1780 |
> |
ZConsParaItem tempParaItem; |
1781 |
> |
|
1782 |
> |
ZConsParaData* zconsParaData = new ZConsParaData(); |
1783 |
> |
zconsParaData->setID(ZCONSPARADATA_ID); |
1784 |
> |
|
1785 |
> |
for (int i = 0; i < nZConstraints; i++){ |
1786 |
|
tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
1787 |
|
tempParaItem.zPos = zconStamp[i]->getZpos(); |
1788 |
|
tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1789 |
|
tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1790 |
< |
|
1790 |
> |
tempParaItem.havingCantVel = zconStamp[i]->haveCantVel(); |
1791 |
> |
tempParaItem.cantVel = zconStamp[i]->getCantVel(); |
1792 |
|
zconsParaData->addItem(tempParaItem); |
1793 |
+ |
} |
1794 |
+ |
|
1795 |
+ |
//check the uniqueness of index |
1796 |
+ |
if(!zconsParaData->isIndexUnique()){ |
1797 |
+ |
sprintf(painCave.errMsg, |
1798 |
+ |
"ZConstraint Error: molIndex is not unique!\n"); |
1799 |
+ |
painCave.isFatal = 1; |
1800 |
+ |
simError(); |
1801 |
+ |
} |
1802 |
+ |
|
1803 |
+ |
//sort the parameters by index of molecules |
1804 |
+ |
zconsParaData->sortByIndex(); |
1805 |
+ |
|
1806 |
+ |
//push data into siminfo, therefore, we can retrieve later |
1807 |
+ |
theInfo.addProperty(zconsParaData); |
1808 |
+ |
} |
1809 |
+ |
|
1810 |
+ |
void SimSetup::makeMinimizer(){ |
1811 |
+ |
|
1812 |
+ |
OOPSEMinimizer* myOOPSEMinimizer; |
1813 |
+ |
MinimizerParameterSet* param; |
1814 |
+ |
char minimizerName[100]; |
1815 |
+ |
|
1816 |
+ |
for (int i = 0; i < nInfo; i++){ |
1817 |
+ |
|
1818 |
+ |
//prepare parameter set for minimizer |
1819 |
+ |
param = new MinimizerParameterSet(); |
1820 |
+ |
param->setDefaultParameter(); |
1821 |
+ |
|
1822 |
+ |
if (globals->haveMinimizer()){ |
1823 |
+ |
param->setFTol(globals->getMinFTol()); |
1824 |
|
} |
1825 |
|
|
1826 |
< |
//sort the parameters by index of molecules |
1827 |
< |
zconsParaData->sortByIndex(); |
1828 |
< |
|
1633 |
< |
//push data into siminfo, therefore, we can retrieve later |
1634 |
< |
theInfo.addProperty(zconsParaData); |
1826 |
> |
if (globals->haveMinGTol()){ |
1827 |
> |
param->setGTol(globals->getMinGTol()); |
1828 |
> |
} |
1829 |
|
|
1830 |
< |
//push zconsTol into siminfo, if user does not specify |
1831 |
< |
//value for zconsTol, a default value will be used |
1638 |
< |
DoubleData* zconsTol = new DoubleData(); |
1639 |
< |
zconsTol->setID(ZCONSTOL_ID); |
1640 |
< |
if(globals->haveZconsTol()){ |
1641 |
< |
zconsTol->setData(globals->getZconsTol()); |
1830 |
> |
if (globals->haveMinMaxIter()){ |
1831 |
> |
param->setMaxIteration(globals->getMinMaxIter()); |
1832 |
|
} |
1643 |
– |
else{ |
1644 |
– |
double defaultZConsTol = 1E-6; |
1645 |
– |
sprintf( painCave.errMsg, |
1646 |
– |
"ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1647 |
– |
" , default value %f is used.\n", defaultZConsTol); |
1648 |
– |
painCave.isFatal = 0; |
1649 |
– |
simError(); |
1833 |
|
|
1834 |
< |
zconsTol->setData(defaultZConsTol); |
1835 |
< |
} |
1836 |
< |
theInfo.addProperty(zconsTol); |
1837 |
< |
|
1838 |
< |
//Determine the name of ouput file and add it into SimInfo's property list |
1839 |
< |
//Be careful, do not use inFileName, since it is a pointer which |
1840 |
< |
//point to a string at master node, and slave nodes do not contain that string |
1834 |
> |
if (globals->haveMinWriteFrq()){ |
1835 |
> |
param->setMaxIteration(globals->getMinMaxIter()); |
1836 |
> |
} |
1837 |
> |
|
1838 |
> |
if (globals->haveMinWriteFrq()){ |
1839 |
> |
param->setWriteFrq(globals->getMinWriteFrq()); |
1840 |
> |
} |
1841 |
|
|
1842 |
< |
string zconsOutput(theInfo.finalName); |
1843 |
< |
|
1844 |
< |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1845 |
< |
|
1846 |
< |
StringData* zconsFilename = new StringData(); |
1847 |
< |
zconsFilename->setID(ZCONSFILENAME_ID); |
1848 |
< |
zconsFilename->setData(zconsOutput); |
1849 |
< |
|
1850 |
< |
theInfo.addProperty(zconsFilename); |
1842 |
> |
if (globals->haveMinStepSize()){ |
1843 |
> |
param->setStepSize(globals->getMinStepSize()); |
1844 |
> |
} |
1845 |
> |
|
1846 |
> |
if (globals->haveMinLSMaxIter()){ |
1847 |
> |
param->setLineSearchMaxIteration(globals->getMinLSMaxIter()); |
1848 |
> |
} |
1849 |
> |
|
1850 |
> |
if (globals->haveMinLSTol()){ |
1851 |
> |
param->setLineSearchTol(globals->getMinLSTol()); |
1852 |
> |
} |
1853 |
> |
|
1854 |
> |
strcpy(minimizerName, globals->getMinimizer()); |
1855 |
> |
|
1856 |
> |
if (!strcasecmp(minimizerName, "CG")){ |
1857 |
> |
myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param); |
1858 |
> |
} |
1859 |
> |
else if (!strcasecmp(minimizerName, "SD")){ |
1860 |
> |
//myOOPSEMinimizer = MinimizerFactory.creatMinimizer("", &(info[i]), the_ff, param); |
1861 |
> |
myOOPSEMinimizer = new SDMinimizer(&(info[i]), the_ff, param); |
1862 |
> |
} |
1863 |
> |
else{ |
1864 |
> |
sprintf(painCave.errMsg, |
1865 |
> |
"SimSetup error: Unrecognized Minimizer, use Conjugate Gradient \n"); |
1866 |
> |
painCave.isFatal = 0; |
1867 |
> |
simError(); |
1868 |
> |
|
1869 |
> |
myOOPSEMinimizer = new PRCGMinimizer(&(info[i]), the_ff, param); |
1870 |
> |
} |
1871 |
> |
info[i].the_integrator = myOOPSEMinimizer; |
1872 |
> |
|
1873 |
> |
//store the minimizer into simInfo |
1874 |
> |
info[i].the_minimizer = myOOPSEMinimizer; |
1875 |
> |
info[i].has_minimizer = true; |
1876 |
> |
} |
1877 |
> |
|
1878 |
|
} |