22 |
|
#define NPTf_ENS 3 |
23 |
|
#define NPTim_ENS 4 |
24 |
|
#define NPTfm_ENS 5 |
25 |
– |
#define NVEZCONS_ENS 6 |
26 |
– |
#define NVTZCONS_ENS 7 |
27 |
– |
#define NPTiZCONS_ENS 8 |
28 |
– |
#define NPTfZCONS_ENS 9 |
29 |
– |
#define NPTimZCONS_ENS 10 |
30 |
– |
#define NPTfmZCONS_ENS 11 |
25 |
|
|
26 |
|
#define FF_DUFF 0 |
27 |
|
#define FF_LJ 1 |
53 |
|
info = the_info; |
54 |
|
nInfo = theNinfo; |
55 |
|
isInfoArray = 1; |
56 |
< |
} |
56 |
> |
} |
57 |
|
|
58 |
|
|
59 |
|
void SimSetup::parseFile( char* fileName ){ |
91 |
|
|
92 |
|
#endif // is_mpi |
93 |
|
|
94 |
< |
void SimSetup::createSim( void ){ |
94 |
> |
void SimSetup::createSim(void){ |
95 |
|
|
96 |
|
int i, j, k, globalAtomIndex; |
97 |
|
|
109 |
|
|
110 |
|
// initialize the system coordinates |
111 |
|
|
112 |
< |
initSystemCoords(); |
119 |
< |
|
112 |
> |
if( !isInfoArray ) initSystemCoords(); |
113 |
|
|
114 |
|
// make the output filenames |
115 |
|
|
134 |
|
|
135 |
|
void SimSetup::makeMolecules( void ){ |
136 |
|
|
137 |
+ |
int k,l; |
138 |
|
int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; |
139 |
|
molInit molInfo; |
140 |
|
DirectionalAtom* dAtom; |
159 |
|
|
160 |
|
double ux, uy, uz, u, uSqr; |
161 |
|
|
162 |
< |
atomOffset = 0; |
169 |
< |
excludeOffset = 0; |
170 |
< |
for(i=0; i<info->n_mol; i++){ |
162 |
> |
for(k=0; k<nInfo; k++){ |
163 |
|
|
164 |
< |
stampID = the_molecules[i].getStampID(); |
164 |
> |
the_ff->setSimInfo( &(info[k]) ); |
165 |
|
|
166 |
< |
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
167 |
< |
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
168 |
< |
molInfo.nBends = comp_stamps[stampID]->getNBends(); |
169 |
< |
molInfo.nTorsions = comp_stamps[stampID]->getNTorsions(); |
170 |
< |
molInfo.nExcludes = molInfo.nBonds + molInfo.nBends + molInfo.nTorsions; |
166 |
> |
atomOffset = 0; |
167 |
> |
excludeOffset = 0; |
168 |
> |
for(i=0; i<info[k].n_mol; i++){ |
169 |
> |
|
170 |
> |
stampID = info[k].molecules[i].getStampID(); |
171 |
|
|
172 |
< |
molInfo.myAtoms = &the_atoms[atomOffset]; |
173 |
< |
molInfo.myExcludes = &the_excludes[excludeOffset]; |
174 |
< |
molInfo.myBonds = new Bond*[molInfo.nBonds]; |
175 |
< |
molInfo.myBends = new Bend*[molInfo.nBends]; |
176 |
< |
molInfo.myTorsions = new Torsion*[molInfo.nTorsions]; |
172 |
> |
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
173 |
> |
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
174 |
> |
molInfo.nBends = comp_stamps[stampID]->getNBends(); |
175 |
> |
molInfo.nTorsions = comp_stamps[stampID]->getNTorsions(); |
176 |
> |
molInfo.nExcludes = molInfo.nBonds + molInfo.nBends + molInfo.nTorsions; |
177 |
> |
|
178 |
> |
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]; |
183 |
|
|
184 |
< |
theBonds = new bond_pair[molInfo.nBonds]; |
185 |
< |
theBends = new bend_set[molInfo.nBends]; |
186 |
< |
theTorsions = new torsion_set[molInfo.nTorsions]; |
184 |
> |
theBonds = new bond_pair[molInfo.nBonds]; |
185 |
> |
theBends = new bend_set[molInfo.nBends]; |
186 |
> |
theTorsions = new torsion_set[molInfo.nTorsions]; |
187 |
|
|
188 |
< |
// make the Atoms |
188 |
> |
// make the Atoms |
189 |
|
|
190 |
< |
for(j=0; j<molInfo.nAtoms; j++){ |
193 |
< |
|
194 |
< |
currentAtom = comp_stamps[stampID]->getAtom( j ); |
195 |
< |
if( currentAtom->haveOrientation() ){ |
190 |
> |
for(j=0; j<molInfo.nAtoms; j++){ |
191 |
|
|
192 |
< |
dAtom = new DirectionalAtom(j + atomOffset); |
193 |
< |
info->n_oriented++; |
194 |
< |
molInfo.myAtoms[j] = dAtom; |
195 |
< |
|
196 |
< |
ux = currentAtom->getOrntX(); |
197 |
< |
uy = currentAtom->getOrntY(); |
198 |
< |
uz = currentAtom->getOrntZ(); |
199 |
< |
|
200 |
< |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
201 |
< |
|
202 |
< |
u = sqrt( uSqr ); |
203 |
< |
ux = ux / u; |
204 |
< |
uy = uy / u; |
205 |
< |
uz = uz / u; |
206 |
< |
|
207 |
< |
dAtom->setSUx( ux ); |
208 |
< |
dAtom->setSUy( uy ); |
209 |
< |
dAtom->setSUz( uz ); |
210 |
< |
} |
211 |
< |
else{ |
212 |
< |
molInfo.myAtoms[j] = new GeneralAtom(j + atomOffset); |
213 |
< |
} |
214 |
< |
molInfo.myAtoms[j]->setType( currentAtom->getType() ); |
192 |
> |
currentAtom = comp_stamps[stampID]->getAtom( j ); |
193 |
> |
if( currentAtom->haveOrientation() ){ |
194 |
> |
|
195 |
> |
dAtom = new DirectionalAtom( (j + atomOffset), |
196 |
> |
info[k].getConfiguration() ); |
197 |
> |
info[k].n_oriented++; |
198 |
> |
molInfo.myAtoms[j] = dAtom; |
199 |
> |
|
200 |
> |
ux = currentAtom->getOrntX(); |
201 |
> |
uy = currentAtom->getOrntY(); |
202 |
> |
uz = currentAtom->getOrntZ(); |
203 |
> |
|
204 |
> |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
205 |
> |
|
206 |
> |
u = sqrt( uSqr ); |
207 |
> |
ux = ux / u; |
208 |
> |
uy = uy / u; |
209 |
> |
uz = uz / u; |
210 |
> |
|
211 |
> |
dAtom->setSUx( ux ); |
212 |
> |
dAtom->setSUy( uy ); |
213 |
> |
dAtom->setSUz( uz ); |
214 |
> |
} |
215 |
> |
else{ |
216 |
> |
molInfo.myAtoms[j] = new GeneralAtom( (j + atomOffset), |
217 |
> |
info[k].getConfiguration() ); |
218 |
> |
} |
219 |
> |
molInfo.myAtoms[j]->setType( currentAtom->getType() ); |
220 |
|
|
221 |
|
#ifdef IS_MPI |
222 |
|
|
223 |
< |
molInfo.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
223 |
> |
molInfo.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
224 |
|
|
225 |
|
#endif // is_mpi |
226 |
< |
} |
226 |
> |
} |
227 |
|
|
228 |
|
// make the bonds |
229 |
< |
for(j=0; j<molInfo.nBonds; j++){ |
229 |
> |
for(j=0; j<molInfo.nBonds; j++){ |
230 |
|
|
231 |
< |
currentBond = comp_stamps[stampID]->getBond( j ); |
232 |
< |
theBonds[j].a = currentBond->getA() + atomOffset; |
233 |
< |
theBonds[j].b = currentBond->getB() + atomOffset; |
234 |
< |
|
235 |
< |
exI = theBonds[j].a; |
236 |
< |
exJ = theBonds[j].b; |
237 |
< |
|
238 |
< |
// exclude_I must always be the smaller of the pair |
239 |
< |
if( exI > exJ ){ |
240 |
< |
tempEx = exI; |
241 |
< |
exI = exJ; |
242 |
< |
exJ = tempEx; |
243 |
< |
} |
244 |
< |
#ifdef IS_MPI |
245 |
< |
tempEx = exI; |
246 |
< |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
247 |
< |
tempEx = exJ; |
248 |
< |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
249 |
< |
|
250 |
< |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
231 |
> |
currentBond = comp_stamps[stampID]->getBond( j ); |
232 |
> |
theBonds[j].a = currentBond->getA() + atomOffset; |
233 |
> |
theBonds[j].b = currentBond->getB() + atomOffset; |
234 |
> |
|
235 |
> |
exI = theBonds[j].a; |
236 |
> |
exJ = theBonds[j].b; |
237 |
> |
|
238 |
> |
// exclude_I must always be the smaller of the pair |
239 |
> |
if( exI > exJ ){ |
240 |
> |
tempEx = exI; |
241 |
> |
exI = exJ; |
242 |
> |
exJ = tempEx; |
243 |
> |
} |
244 |
> |
#ifdef IS_MPI |
245 |
> |
tempEx = exI; |
246 |
> |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
247 |
> |
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 |
< |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
252 |
> |
|
253 |
> |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
254 |
|
#endif //is_mpi |
255 |
< |
} |
256 |
< |
excludeOffset += molInfo.nBonds; |
257 |
< |
|
258 |
< |
//make the bends |
259 |
< |
for(j=0; j<molInfo.nBends; j++){ |
255 |
> |
} |
256 |
> |
excludeOffset += molInfo.nBonds; |
257 |
|
|
258 |
< |
currentBend = comp_stamps[stampID]->getBend( j ); |
259 |
< |
theBends[j].a = currentBend->getA() + atomOffset; |
260 |
< |
theBends[j].b = currentBend->getB() + atomOffset; |
261 |
< |
theBends[j].c = currentBend->getC() + atomOffset; |
258 |
> |
//make the bends |
259 |
> |
for(j=0; j<molInfo.nBends; j++){ |
260 |
> |
|
261 |
> |
currentBend = comp_stamps[stampID]->getBend( j ); |
262 |
> |
theBends[j].a = currentBend->getA() + atomOffset; |
263 |
> |
theBends[j].b = currentBend->getB() + atomOffset; |
264 |
> |
theBends[j].c = currentBend->getC() + atomOffset; |
265 |
> |
|
266 |
> |
if( currentBend->haveExtras() ){ |
267 |
|
|
268 |
< |
if( currentBend->haveExtras() ){ |
269 |
< |
|
270 |
< |
extras = currentBend->getExtras(); |
271 |
< |
current_extra = extras; |
272 |
< |
|
273 |
< |
while( current_extra != NULL ){ |
274 |
< |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
268 |
> |
extras = currentBend->getExtras(); |
269 |
> |
current_extra = extras; |
270 |
> |
|
271 |
> |
while( current_extra != NULL ){ |
272 |
> |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
273 |
> |
|
274 |
> |
switch( current_extra->getType() ){ |
275 |
|
|
276 |
< |
switch( current_extra->getType() ){ |
276 |
> |
case 0: |
277 |
> |
theBends[j].ghost = |
278 |
> |
current_extra->getInt() + atomOffset; |
279 |
> |
theBends[j].isGhost = 1; |
280 |
> |
break; |
281 |
> |
|
282 |
> |
case 1: |
283 |
> |
theBends[j].ghost = |
284 |
> |
(int)current_extra->getDouble() + atomOffset; |
285 |
> |
theBends[j].isGhost = 1; |
286 |
> |
break; |
287 |
> |
|
288 |
> |
default: |
289 |
> |
sprintf( painCave.errMsg, |
290 |
> |
"SimSetup Error: ghostVectorSource was neither a " |
291 |
> |
"double nor an int.\n" |
292 |
> |
"-->Bend[%d] in %s\n", |
293 |
> |
j, comp_stamps[stampID]->getID() ); |
294 |
> |
painCave.isFatal = 1; |
295 |
> |
simError(); |
296 |
> |
} |
297 |
> |
} |
298 |
> |
|
299 |
> |
else{ |
300 |
|
|
276 |
– |
case 0: |
277 |
– |
theBends[j].ghost = |
278 |
– |
current_extra->getInt() + atomOffset; |
279 |
– |
theBends[j].isGhost = 1; |
280 |
– |
break; |
281 |
– |
|
282 |
– |
case 1: |
283 |
– |
theBends[j].ghost = |
284 |
– |
(int)current_extra->getDouble() + atomOffset; |
285 |
– |
theBends[j].isGhost = 1; |
286 |
– |
break; |
287 |
– |
|
288 |
– |
default: |
301 |
|
sprintf( painCave.errMsg, |
302 |
< |
"SimSetup Error: ghostVectorSource was neither a " |
303 |
< |
"double nor an int.\n" |
304 |
< |
"-->Bend[%d] in %s\n", |
302 |
> |
"SimSetup Error: unhandled bend assignment:\n" |
303 |
> |
" -->%s in Bend[%d] in %s\n", |
304 |
> |
current_extra->getlhs(), |
305 |
|
j, comp_stamps[stampID]->getID() ); |
306 |
|
painCave.isFatal = 1; |
307 |
|
simError(); |
308 |
|
} |
297 |
– |
} |
298 |
– |
|
299 |
– |
else{ |
309 |
|
|
310 |
< |
sprintf( painCave.errMsg, |
302 |
< |
"SimSetup Error: unhandled bend assignment:\n" |
303 |
< |
" -->%s in Bend[%d] in %s\n", |
304 |
< |
current_extra->getlhs(), |
305 |
< |
j, comp_stamps[stampID]->getID() ); |
306 |
< |
painCave.isFatal = 1; |
307 |
< |
simError(); |
310 |
> |
current_extra = current_extra->getNext(); |
311 |
|
} |
312 |
+ |
} |
313 |
+ |
|
314 |
+ |
if( !theBends[j].isGhost ){ |
315 |
|
|
316 |
< |
current_extra = current_extra->getNext(); |
316 |
> |
exI = theBends[j].a; |
317 |
> |
exJ = theBends[j].c; |
318 |
|
} |
319 |
< |
} |
319 |
> |
else{ |
320 |
|
|
321 |
< |
if( !theBends[j].isGhost ){ |
322 |
< |
|
323 |
< |
exI = theBends[j].a; |
317 |
< |
exJ = theBends[j].c; |
318 |
< |
} |
319 |
< |
else{ |
321 |
> |
exI = theBends[j].a; |
322 |
> |
exJ = theBends[j].b; |
323 |
> |
} |
324 |
|
|
325 |
< |
exI = theBends[j].a; |
326 |
< |
exJ = theBends[j].b; |
327 |
< |
} |
328 |
< |
|
329 |
< |
// exclude_I must always be the smaller of the pair |
330 |
< |
if( exI > exJ ){ |
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 |
> |
} |
331 |
> |
#ifdef IS_MPI |
332 |
|
tempEx = exI; |
333 |
< |
exI = exJ; |
334 |
< |
exJ = tempEx; |
333 |
> |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
334 |
> |
tempEx = exJ; |
335 |
> |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
336 |
> |
|
337 |
> |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
338 |
> |
#else // isn't MPI |
339 |
> |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
340 |
> |
#endif //is_mpi |
341 |
|
} |
342 |
< |
#ifdef IS_MPI |
332 |
< |
tempEx = exI; |
333 |
< |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
334 |
< |
tempEx = exJ; |
335 |
< |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
342 |
> |
excludeOffset += molInfo.nBends; |
343 |
|
|
344 |
< |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
344 |
> |
for(j=0; j<molInfo.nTorsions; j++){ |
345 |
> |
|
346 |
> |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
347 |
> |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
348 |
> |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
349 |
> |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
350 |
> |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
351 |
> |
|
352 |
> |
exI = theTorsions[j].a; |
353 |
> |
exJ = theTorsions[j].d; |
354 |
> |
|
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 |
> |
} |
361 |
> |
#ifdef IS_MPI |
362 |
> |
tempEx = exI; |
363 |
> |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
364 |
> |
tempEx = exJ; |
365 |
> |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
366 |
> |
|
367 |
> |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
368 |
|
#else // isn't MPI |
369 |
< |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
369 |
> |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
370 |
|
#endif //is_mpi |
371 |
< |
} |
372 |
< |
excludeOffset += molInfo.nBends; |
343 |
< |
|
344 |
< |
for(j=0; j<molInfo.nTorsions; j++){ |
371 |
> |
} |
372 |
> |
excludeOffset += molInfo.nTorsions; |
373 |
|
|
346 |
– |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
347 |
– |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
348 |
– |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
349 |
– |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
350 |
– |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
374 |
|
|
375 |
< |
exI = theTorsions[j].a; |
376 |
< |
exJ = theTorsions[j].d; |
375 |
> |
// send the arrays off to the forceField for init. |
376 |
> |
|
377 |
> |
the_ff->initializeAtoms( molInfo.nAtoms, molInfo.myAtoms ); |
378 |
> |
the_ff->initializeBonds( molInfo.nBonds, molInfo.myBonds, theBonds ); |
379 |
> |
the_ff->initializeBends( molInfo.nBends, molInfo.myBends, theBends ); |
380 |
> |
the_ff->initializeTorsions( molInfo.nTorsions, molInfo.myTorsions, theTorsions ); |
381 |
> |
|
382 |
> |
|
383 |
> |
info[k].molecules[i].initialize( molInfo ); |
384 |
|
|
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 |
– |
} |
361 |
– |
#ifdef IS_MPI |
362 |
– |
tempEx = exI; |
363 |
– |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
364 |
– |
tempEx = exJ; |
365 |
– |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
385 |
|
|
386 |
< |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
387 |
< |
#else // isn't MPI |
388 |
< |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
389 |
< |
#endif //is_mpi |
386 |
> |
atomOffset += molInfo.nAtoms; |
387 |
> |
delete[] theBonds; |
388 |
> |
delete[] theBends; |
389 |
> |
delete[] theTorsions; |
390 |
|
} |
391 |
< |
excludeOffset += molInfo.nTorsions; |
392 |
< |
|
374 |
< |
|
375 |
< |
// send the arrays off to the forceField for init. |
376 |
< |
|
377 |
< |
the_ff->initializeAtoms( molInfo.nAtoms, molInfo.myAtoms ); |
378 |
< |
the_ff->initializeBonds( molInfo.nBonds, molInfo.myBonds, theBonds ); |
379 |
< |
the_ff->initializeBends( molInfo.nBends, molInfo.myBends, theBends ); |
380 |
< |
the_ff->initializeTorsions( molInfo.nTorsions, molInfo.myTorsions, theTorsions ); |
381 |
< |
|
382 |
< |
|
383 |
< |
the_molecules[i].initialize( molInfo ); |
384 |
< |
|
385 |
< |
|
386 |
< |
atomOffset += molInfo.nAtoms; |
387 |
< |
delete[] theBonds; |
388 |
< |
delete[] theBends; |
389 |
< |
delete[] theTorsions; |
390 |
< |
} |
391 |
< |
|
391 |
> |
} |
392 |
> |
|
393 |
|
#ifdef IS_MPI |
394 |
|
sprintf( checkPointMsg, "all molecules initialized succesfully" ); |
395 |
|
MPIcheckPoint(); |
396 |
|
#endif // is_mpi |
397 |
< |
|
397 |
> |
|
398 |
|
// clean up the forcefield |
399 |
+ |
|
400 |
|
the_ff->calcRcut(); |
401 |
|
the_ff->cleanMe(); |
402 |
< |
|
402 |
> |
|
403 |
|
} |
404 |
|
|
405 |
|
void SimSetup::initFromBass( void ){ |
412 |
|
int n_extra; |
413 |
|
int have_extra, done; |
414 |
|
|
415 |
+ |
double vel[3]; |
416 |
+ |
vel[0] = 0.0; |
417 |
+ |
vel[1] = 0.0; |
418 |
+ |
vel[2] = 0.0; |
419 |
+ |
|
420 |
|
temp1 = (double)tot_nmol / 4.0; |
421 |
|
temp2 = pow( temp1, ( 1.0 / 3.0 ) ); |
422 |
|
temp3 = ceil( temp2 ); |
426 |
|
have_extra =1; |
427 |
|
|
428 |
|
n_cells = (int)temp3 - 1; |
429 |
< |
cellx = info->boxL[0] / temp3; |
430 |
< |
celly = info->boxL[1] / temp3; |
431 |
< |
cellz = info->boxL[2] / temp3; |
429 |
> |
cellx = info[0].boxL[0] / temp3; |
430 |
> |
celly = info[0].boxL[1] / temp3; |
431 |
> |
cellz = info[0].boxL[2] / temp3; |
432 |
|
n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells ); |
433 |
|
temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) ); |
434 |
|
n_per_extra = (int)ceil( temp1 ); |
443 |
|
} |
444 |
|
else{ |
445 |
|
n_cells = (int)temp3; |
446 |
< |
cellx = info->boxL[0] / temp3; |
447 |
< |
celly = info->boxL[1] / temp3; |
448 |
< |
cellz = info->boxL[2] / temp3; |
446 |
> |
cellx = info[0].boxL[0] / temp3; |
447 |
> |
celly = info[0].boxL[1] / temp3; |
448 |
> |
cellz = info[0].boxL[2] / temp3; |
449 |
|
} |
450 |
|
|
451 |
|
current_mol = 0; |
524 |
|
} |
525 |
|
} |
526 |
|
|
527 |
< |
|
528 |
< |
for( i=0; i<info->n_atoms; i++ ){ |
522 |
< |
info->atoms[i]->set_vx( 0.0 ); |
523 |
< |
info->atoms[i]->set_vy( 0.0 ); |
524 |
< |
info->atoms[i]->set_vz( 0.0 ); |
527 |
> |
for( i=0; i<info[0].n_atoms; i++ ){ |
528 |
> |
info[0].atoms[i]->setVel( vel ); |
529 |
|
} |
530 |
|
} |
531 |
|
|
535 |
|
AtomStamp* current_atom; |
536 |
|
DirectionalAtom* dAtom; |
537 |
|
double rotMat[3][3]; |
538 |
+ |
double pos[3]; |
539 |
|
|
540 |
|
for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){ |
541 |
|
|
551 |
|
painCave.isFatal = 1; |
552 |
|
simError(); |
553 |
|
} |
554 |
+ |
|
555 |
+ |
pos[0] = x + current_atom->getPosX(); |
556 |
+ |
pos[1] = y + current_atom->getPosY(); |
557 |
+ |
pos[2] = z + current_atom->getPosZ(); |
558 |
+ |
|
559 |
+ |
info[0].atoms[current_atom_ndx]->setPos( pos ); |
560 |
|
|
561 |
< |
the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() ); |
551 |
< |
the_atoms[current_atom_ndx]->setY( y + current_atom->getPosY() ); |
552 |
< |
the_atoms[current_atom_ndx]->setZ( z + current_atom->getPosZ() ); |
561 |
> |
if( info[0].atoms[current_atom_ndx]->isDirectional() ){ |
562 |
|
|
563 |
< |
if( the_atoms[current_atom_ndx]->isDirectional() ){ |
555 |
< |
|
556 |
< |
dAtom = (DirectionalAtom *)the_atoms[current_atom_ndx]; |
563 |
> |
dAtom = (DirectionalAtom *)info[0].atoms[current_atom_ndx]; |
564 |
|
|
565 |
|
rotMat[0][0] = 1.0; |
566 |
|
rotMat[0][1] = 0.0; |
597 |
|
ensembleCase = -1; |
598 |
|
ffCase = -1; |
599 |
|
|
593 |
– |
// get the stamps and globals; |
594 |
– |
stamps = stamps; |
595 |
– |
globals = globals; |
596 |
– |
|
600 |
|
// set the easy ones first |
601 |
< |
info->target_temp = globals->getTargetTemp(); |
602 |
< |
info->dt = globals->getDt(); |
603 |
< |
info->run_time = globals->getRunTime(); |
601 |
> |
|
602 |
> |
for( i=0; i<nInfo; i++){ |
603 |
> |
info[i].target_temp = globals->getTargetTemp(); |
604 |
> |
info[i].dt = globals->getDt(); |
605 |
> |
info[i].run_time = globals->getRunTime(); |
606 |
> |
} |
607 |
|
n_components = globals->getNComponents(); |
608 |
|
|
609 |
|
|
633 |
|
else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; |
634 |
|
else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS; |
635 |
|
else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS; |
630 |
– |
|
631 |
– |
else if( !strcasecmp( ensemble, "NVEZCONS")) ensembleCase = NVEZCONS_ENS; |
632 |
– |
else if( !strcasecmp( ensemble, "NVTZCONS")) ensembleCase = NVTZCONS_ENS; |
633 |
– |
else if( !strcasecmp( ensemble, "NPTiZCONS") || !strcasecmp( ensemble, "NPT")) |
634 |
– |
ensembleCase = NPTiZCONS_ENS; |
635 |
– |
else if( !strcasecmp( ensemble, "NPTfCONS")) ensembleCase = NPTfZCONS_ENS; |
636 |
– |
else if( !strcasecmp( ensemble, "NPTimZCONS")) ensembleCase = NPTimZCONS_ENS; |
637 |
– |
else if( !strcasecmp( ensemble, "NPTfmCONS")) ensembleCase = NPTfmZCONS_ENS; |
638 |
– |
|
636 |
|
else{ |
637 |
|
sprintf( painCave.errMsg, |
638 |
|
"SimSetup Warning. Unrecognized Ensemble -> %s, " |
643 |
|
strcpy( ensemble, "NVE" ); |
644 |
|
ensembleCase = NVE_ENS; |
645 |
|
} |
646 |
< |
strcpy( info->ensemble, ensemble ); |
646 |
> |
|
647 |
> |
for(i=0; i<nInfo; i++){ |
648 |
> |
|
649 |
> |
strcpy( info[i].ensemble, ensemble ); |
650 |
|
|
651 |
< |
// get the mixing rule |
651 |
> |
// get the mixing rule |
652 |
|
|
653 |
< |
strcpy( info->mixingRule, globals->getMixingRule() ); |
654 |
< |
info->usePBC = globals->getPBC(); |
655 |
< |
|
653 |
> |
strcpy( info[i].mixingRule, globals->getMixingRule() ); |
654 |
> |
info[i].usePBC = globals->getPBC(); |
655 |
> |
} |
656 |
|
|
657 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
658 |
|
|
693 |
|
|
694 |
|
// set the status, sample, and thermal kick times |
695 |
|
|
696 |
< |
if( globals->haveSampleTime() ){ |
697 |
< |
info->sampleTime = globals->getSampleTime(); |
698 |
< |
info->statusTime = info->sampleTime; |
699 |
< |
info->thermalTime = info->sampleTime; |
700 |
< |
} |
701 |
< |
else{ |
702 |
< |
info->sampleTime = globals->getRunTime(); |
703 |
< |
info->statusTime = info->sampleTime; |
704 |
< |
info->thermalTime = info->sampleTime; |
705 |
< |
} |
696 |
> |
for(i=0; i<nInfo; i++){ |
697 |
|
|
698 |
< |
if( globals->haveStatusTime() ){ |
699 |
< |
info->statusTime = globals->getStatusTime(); |
700 |
< |
} |
701 |
< |
|
702 |
< |
if( globals->haveThermalTime() ){ |
703 |
< |
info->thermalTime = globals->getThermalTime(); |
704 |
< |
} |
705 |
< |
|
706 |
< |
// check for the temperature set flag |
707 |
< |
|
717 |
< |
if( globals->haveTempSet() ) info->setTemp = globals->getTempSet(); |
718 |
< |
|
719 |
< |
// get some of the tricky things that may still be in the globals |
720 |
< |
|
721 |
< |
double boxVector[3]; |
722 |
< |
if( globals->haveBox() ){ |
723 |
< |
boxVector[0] = globals->getBox(); |
724 |
< |
boxVector[1] = globals->getBox(); |
725 |
< |
boxVector[2] = globals->getBox(); |
698 |
> |
if( globals->haveSampleTime() ){ |
699 |
> |
info[i].sampleTime = globals->getSampleTime(); |
700 |
> |
info[i].statusTime = info[i].sampleTime; |
701 |
> |
info[i].thermalTime = info[i].sampleTime; |
702 |
> |
} |
703 |
> |
else{ |
704 |
> |
info[i].sampleTime = globals->getRunTime(); |
705 |
> |
info[i].statusTime = info[i].sampleTime; |
706 |
> |
info[i].thermalTime = info[i].sampleTime; |
707 |
> |
} |
708 |
|
|
709 |
< |
info->setBox( boxVector ); |
710 |
< |
} |
729 |
< |
else if( globals->haveDensity() ){ |
730 |
< |
|
731 |
< |
double vol; |
732 |
< |
vol = (double)tot_nmol / globals->getDensity(); |
733 |
< |
boxVector[0] = pow( vol, ( 1.0 / 3.0 ) ); |
734 |
< |
boxVector[1] = boxVector[0]; |
735 |
< |
boxVector[2] = boxVector[0]; |
736 |
< |
|
737 |
< |
info->setBox( boxVector ); |
738 |
< |
} |
739 |
< |
else{ |
740 |
< |
if( !globals->haveBoxX() ){ |
741 |
< |
sprintf( painCave.errMsg, |
742 |
< |
"SimSetup error, no periodic BoxX size given.\n" ); |
743 |
< |
painCave.isFatal = 1; |
744 |
< |
simError(); |
709 |
> |
if( globals->haveStatusTime() ){ |
710 |
> |
info[i].statusTime = globals->getStatusTime(); |
711 |
|
} |
712 |
< |
boxVector[0] = globals->getBoxX(); |
713 |
< |
|
714 |
< |
if( !globals->haveBoxY() ){ |
749 |
< |
sprintf( painCave.errMsg, |
750 |
< |
"SimSetup error, no periodic BoxY size given.\n" ); |
751 |
< |
painCave.isFatal = 1; |
752 |
< |
simError(); |
712 |
> |
|
713 |
> |
if( globals->haveThermalTime() ){ |
714 |
> |
info[i].thermalTime = globals->getThermalTime(); |
715 |
|
} |
754 |
– |
boxVector[1] = globals->getBoxY(); |
716 |
|
|
717 |
< |
if( !globals->haveBoxZ() ){ |
757 |
< |
sprintf( painCave.errMsg, |
758 |
< |
"SimSetup error, no periodic BoxZ size given.\n" ); |
759 |
< |
painCave.isFatal = 1; |
760 |
< |
simError(); |
761 |
< |
} |
762 |
< |
boxVector[2] = globals->getBoxZ(); |
717 |
> |
// check for the temperature set flag |
718 |
|
|
719 |
< |
info->setBox( boxVector ); |
719 |
> |
if( globals->haveTempSet() ) info[i].setTemp = globals->getTempSet(); |
720 |
> |
|
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 ); |
740 |
|
} |
741 |
+ |
else{ |
742 |
+ |
if( !globals->haveBoxX() ){ |
743 |
+ |
sprintf( painCave.errMsg, |
744 |
+ |
"SimSetup error, no periodic BoxX size given.\n" ); |
745 |
+ |
painCave.isFatal = 1; |
746 |
+ |
simError(); |
747 |
+ |
} |
748 |
+ |
boxVector[0] = globals->getBoxX(); |
749 |
+ |
|
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 ); |
767 |
+ |
} |
768 |
|
|
769 |
< |
|
769 |
> |
} |
770 |
|
|
771 |
|
#ifdef IS_MPI |
772 |
|
strcpy( checkPointMsg, "Succesfully gathered all information from Bass\n" ); |
779 |
|
void SimSetup::finalInfoCheck( void ){ |
780 |
|
int index; |
781 |
|
int usesDipoles; |
782 |
< |
|
782 |
> |
int i; |
783 |
|
|
784 |
< |
// check electrostatic parameters |
785 |
< |
|
784 |
< |
index = 0; |
785 |
< |
usesDipoles = 0; |
786 |
< |
while( (index < info->n_atoms) && !usesDipoles ){ |
787 |
< |
usesDipoles = ((info->atoms)[index])->hasDipole(); |
788 |
< |
index++; |
789 |
< |
} |
790 |
< |
|
791 |
< |
#ifdef IS_MPI |
792 |
< |
int myUse = usesDipoles; |
793 |
< |
MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
794 |
< |
#endif //is_mpi |
795 |
< |
|
796 |
< |
double theEcr, theEst; |
797 |
< |
|
798 |
< |
if (globals->getUseRF() ) { |
799 |
< |
info->useReactionField = 1; |
784 |
> |
for(i=0; i<nInfo; i++){ |
785 |
> |
// check electrostatic parameters |
786 |
|
|
787 |
< |
if( !globals->haveECR() ){ |
788 |
< |
sprintf( painCave.errMsg, |
789 |
< |
"SimSetup Warning: using default value of 1/2 the smallest " |
790 |
< |
"box length for the electrostaticCutoffRadius.\n" |
791 |
< |
"I hope you have a very fast processor!\n"); |
806 |
< |
painCave.isFatal = 0; |
807 |
< |
simError(); |
808 |
< |
double smallest; |
809 |
< |
smallest = info->boxL[0]; |
810 |
< |
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
811 |
< |
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
812 |
< |
theEcr = 0.5 * smallest; |
813 |
< |
} else { |
814 |
< |
theEcr = globals->getECR(); |
787 |
> |
index = 0; |
788 |
> |
usesDipoles = 0; |
789 |
> |
while( (index < info[i].n_atoms) && !usesDipoles ){ |
790 |
> |
usesDipoles = (info[i].atoms[index])->hasDipole(); |
791 |
> |
index++; |
792 |
|
} |
816 |
– |
|
817 |
– |
if( !globals->haveEST() ){ |
818 |
– |
sprintf( painCave.errMsg, |
819 |
– |
"SimSetup Warning: using default value of 0.05 * the " |
820 |
– |
"electrostaticCutoffRadius for the electrostaticSkinThickness\n" |
821 |
– |
); |
822 |
– |
painCave.isFatal = 0; |
823 |
– |
simError(); |
824 |
– |
theEst = 0.05 * theEcr; |
825 |
– |
} else { |
826 |
– |
theEst= globals->getEST(); |
827 |
– |
} |
828 |
– |
|
829 |
– |
info->setEcr( theEcr, theEst ); |
793 |
|
|
794 |
< |
if(!globals->haveDielectric() ){ |
795 |
< |
sprintf( painCave.errMsg, |
796 |
< |
"SimSetup Error: You are trying to use Reaction Field without" |
797 |
< |
"setting a dielectric constant!\n" |
798 |
< |
); |
799 |
< |
painCave.isFatal = 1; |
800 |
< |
simError(); |
801 |
< |
} |
802 |
< |
info->dielectric = globals->getDielectric(); |
840 |
< |
} |
841 |
< |
else { |
842 |
< |
if (usesDipoles) { |
794 |
> |
#ifdef IS_MPI |
795 |
> |
int myUse = usesDipoles; |
796 |
> |
MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
797 |
> |
#endif //is_mpi |
798 |
> |
|
799 |
> |
double theEcr, theEst; |
800 |
> |
|
801 |
> |
if (globals->getUseRF() ) { |
802 |
> |
info[i].useReactionField = 1; |
803 |
|
|
804 |
|
if( !globals->haveECR() ){ |
805 |
|
sprintf( painCave.errMsg, |
809 |
|
painCave.isFatal = 0; |
810 |
|
simError(); |
811 |
|
double smallest; |
812 |
< |
smallest = info->boxL[0]; |
813 |
< |
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
814 |
< |
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
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(); |
820 |
|
if( !globals->haveEST() ){ |
821 |
|
sprintf( painCave.errMsg, |
822 |
|
"SimSetup Warning: using default value of 0.05 * the " |
823 |
< |
"electrostaticCutoffRadius for the " |
864 |
< |
"electrostaticSkinThickness\n" |
823 |
> |
"electrostaticCutoffRadius for the electrostaticSkinThickness\n" |
824 |
|
); |
825 |
|
painCave.isFatal = 0; |
826 |
|
simError(); |
828 |
|
} else { |
829 |
|
theEst= globals->getEST(); |
830 |
|
} |
831 |
< |
|
832 |
< |
info->setEcr( theEcr, theEst ); |
833 |
< |
} |
834 |
< |
} |
831 |
> |
|
832 |
> |
info[i].setEcr( theEcr, theEst ); |
833 |
> |
|
834 |
> |
if(!globals->haveDielectric() ){ |
835 |
> |
sprintf( painCave.errMsg, |
836 |
> |
"SimSetup Error: You are trying to use Reaction Field without" |
837 |
> |
"setting a dielectric constant!\n" |
838 |
> |
); |
839 |
> |
painCave.isFatal = 1; |
840 |
> |
simError(); |
841 |
> |
} |
842 |
> |
info[i].dielectric = globals->getDielectric(); |
843 |
> |
} |
844 |
> |
else { |
845 |
> |
if (usesDipoles) { |
846 |
> |
|
847 |
> |
if( !globals->haveECR() ){ |
848 |
> |
sprintf( painCave.errMsg, |
849 |
> |
"SimSetup Warning: using default value of 1/2 the smallest " |
850 |
> |
"box length for the electrostaticCutoffRadius.\n" |
851 |
> |
"I hope you have a very fast processor!\n"); |
852 |
> |
painCave.isFatal = 0; |
853 |
> |
simError(); |
854 |
> |
double smallest; |
855 |
> |
smallest = info[i].boxL[0]; |
856 |
> |
if (info[i].boxL[1] <= smallest) smallest = info[i].boxL[1]; |
857 |
> |
if (info[i].boxL[2] <= smallest) smallest = info[i].boxL[2]; |
858 |
> |
theEcr = 0.5 * smallest; |
859 |
> |
} else { |
860 |
> |
theEcr = globals->getECR(); |
861 |
> |
} |
862 |
> |
|
863 |
> |
if( !globals->haveEST() ){ |
864 |
> |
sprintf( painCave.errMsg, |
865 |
> |
"SimSetup Warning: using default value of 0.05 * the " |
866 |
> |
"electrostaticCutoffRadius for the " |
867 |
> |
"electrostaticSkinThickness\n" |
868 |
> |
); |
869 |
> |
painCave.isFatal = 0; |
870 |
> |
simError(); |
871 |
> |
theEst = 0.05 * theEcr; |
872 |
> |
} else { |
873 |
> |
theEst= globals->getEST(); |
874 |
> |
} |
875 |
> |
|
876 |
> |
info[i].setEcr( theEcr, theEst ); |
877 |
> |
} |
878 |
> |
} |
879 |
> |
} |
880 |
|
|
881 |
|
#ifdef IS_MPI |
882 |
|
strcpy( checkPointMsg, "post processing checks out" ); |
886 |
|
} |
887 |
|
|
888 |
|
void SimSetup::initSystemCoords( void ){ |
889 |
+ |
int i; |
890 |
+ |
|
891 |
+ |
std::cerr << "Setting atom Coords\n"; |
892 |
|
|
893 |
< |
if( globals->haveInitialConfig() ){ |
894 |
< |
|
895 |
< |
InitializeFromFile* fileInit; |
893 |
> |
(info[0].getConfiguration())->createArrays( info[0].n_atoms ); |
894 |
> |
|
895 |
> |
for(i=0; i<info[0].n_atoms; i++) info[0].atoms[i]->setCoords(); |
896 |
> |
|
897 |
> |
if( globals->haveInitialConfig() ){ |
898 |
> |
|
899 |
> |
InitializeFromFile* fileInit; |
900 |
|
#ifdef IS_MPI // is_mpi |
901 |
< |
if( worldRank == 0 ){ |
901 |
> |
if( worldRank == 0 ){ |
902 |
|
#endif //is_mpi |
903 |
< |
fileInit = new InitializeFromFile( globals->getInitialConfig() ); |
903 |
> |
fileInit = new InitializeFromFile( globals->getInitialConfig() ); |
904 |
|
#ifdef IS_MPI |
905 |
< |
}else fileInit = new InitializeFromFile( NULL ); |
905 |
> |
}else fileInit = new InitializeFromFile( NULL ); |
906 |
|
#endif |
907 |
< |
fileInit->readInit( info ); // default velocities on |
908 |
< |
|
909 |
< |
delete fileInit; |
910 |
< |
} |
911 |
< |
else{ |
912 |
< |
|
907 |
> |
fileInit->readInit( info ); // default velocities on |
908 |
> |
|
909 |
> |
delete fileInit; |
910 |
> |
} |
911 |
> |
else{ |
912 |
> |
|
913 |
|
#ifdef IS_MPI |
914 |
< |
|
915 |
< |
// no init from bass |
916 |
< |
|
917 |
< |
sprintf( painCave.errMsg, |
918 |
< |
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
919 |
< |
painCave.isFatal; |
920 |
< |
simError(); |
921 |
< |
|
914 |
> |
|
915 |
> |
// no init from bass |
916 |
> |
|
917 |
> |
sprintf( painCave.errMsg, |
918 |
> |
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
919 |
> |
painCave.isFatal; |
920 |
> |
simError(); |
921 |
> |
|
922 |
|
#else |
923 |
< |
|
924 |
< |
initFromBass(); |
925 |
< |
|
926 |
< |
|
923 |
> |
|
924 |
> |
initFromBass(); |
925 |
> |
|
926 |
> |
|
927 |
|
#endif |
928 |
< |
} |
929 |
< |
|
928 |
> |
} |
929 |
> |
|
930 |
|
#ifdef IS_MPI |
931 |
|
strcpy( checkPointMsg, "Successfully read in the initial configuration" ); |
932 |
|
MPIcheckPoint(); |
933 |
|
#endif // is_mpi |
934 |
< |
|
934 |
> |
|
935 |
|
} |
936 |
|
|
937 |
|
|
938 |
|
void SimSetup::makeOutNames( void ){ |
939 |
+ |
|
940 |
+ |
int k; |
941 |
|
|
942 |
+ |
|
943 |
+ |
for(k=0; k<nInfo; k++){ |
944 |
+ |
|
945 |
|
#ifdef IS_MPI |
946 |
< |
if( worldRank == 0 ){ |
946 |
> |
if( worldRank == 0 ){ |
947 |
|
#endif // is_mpi |
948 |
< |
|
949 |
< |
if( globals->haveFinalConfig() ){ |
950 |
< |
strcpy( info->finalName, globals->getFinalConfig() ); |
935 |
< |
} |
936 |
< |
else{ |
937 |
< |
strcpy( info->finalName, inFileName ); |
938 |
< |
char* endTest; |
939 |
< |
int nameLength = strlen( info->finalName ); |
940 |
< |
endTest = &(info->finalName[nameLength - 5]); |
941 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
942 |
< |
strcpy( endTest, ".eor" ); |
948 |
> |
|
949 |
> |
if( globals->haveFinalConfig() ){ |
950 |
> |
strcpy( info[k].finalName, globals->getFinalConfig() ); |
951 |
|
} |
944 |
– |
else if( !strcmp( endTest, ".BASS" ) ){ |
945 |
– |
strcpy( endTest, ".eor" ); |
946 |
– |
} |
952 |
|
else{ |
953 |
< |
endTest = &(info->finalName[nameLength - 4]); |
954 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
953 |
> |
strcpy( info[k].finalName, inFileName ); |
954 |
> |
char* endTest; |
955 |
> |
int nameLength = strlen( info[k].finalName ); |
956 |
> |
endTest = &(info[k].finalName[nameLength - 5]); |
957 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
958 |
|
strcpy( endTest, ".eor" ); |
959 |
|
} |
960 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
960 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
961 |
|
strcpy( endTest, ".eor" ); |
962 |
|
} |
963 |
|
else{ |
964 |
< |
strcat( info->finalName, ".eor" ); |
964 |
> |
endTest = &(info[k].finalName[nameLength - 4]); |
965 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
966 |
> |
strcpy( endTest, ".eor" ); |
967 |
> |
} |
968 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
969 |
> |
strcpy( endTest, ".eor" ); |
970 |
> |
} |
971 |
> |
else{ |
972 |
> |
strcat( info[k].finalName, ".eor" ); |
973 |
> |
} |
974 |
|
} |
975 |
|
} |
976 |
< |
} |
977 |
< |
|
978 |
< |
// make the sample and status out names |
979 |
< |
|
980 |
< |
strcpy( info->sampleName, inFileName ); |
981 |
< |
char* endTest; |
982 |
< |
int nameLength = strlen( info->sampleName ); |
983 |
< |
endTest = &(info->sampleName[nameLength - 5]); |
967 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
968 |
< |
strcpy( endTest, ".dump" ); |
969 |
< |
} |
970 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
971 |
< |
strcpy( endTest, ".dump" ); |
972 |
< |
} |
973 |
< |
else{ |
974 |
< |
endTest = &(info->sampleName[nameLength - 4]); |
975 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
976 |
> |
|
977 |
> |
// make the sample and status out names |
978 |
> |
|
979 |
> |
strcpy( info[k].sampleName, inFileName ); |
980 |
> |
char* endTest; |
981 |
> |
int nameLength = strlen( info[k].sampleName ); |
982 |
> |
endTest = &(info[k].sampleName[nameLength - 5]); |
983 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
984 |
|
strcpy( endTest, ".dump" ); |
985 |
|
} |
986 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
986 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
987 |
|
strcpy( endTest, ".dump" ); |
988 |
|
} |
989 |
|
else{ |
990 |
< |
strcat( info->sampleName, ".dump" ); |
990 |
> |
endTest = &(info[k].sampleName[nameLength - 4]); |
991 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
992 |
> |
strcpy( endTest, ".dump" ); |
993 |
> |
} |
994 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
995 |
> |
strcpy( endTest, ".dump" ); |
996 |
> |
} |
997 |
> |
else{ |
998 |
> |
strcat( info[k].sampleName, ".dump" ); |
999 |
> |
} |
1000 |
|
} |
1001 |
< |
} |
1002 |
< |
|
1003 |
< |
strcpy( info->statusName, inFileName ); |
1004 |
< |
nameLength = strlen( info->statusName ); |
1005 |
< |
endTest = &(info->statusName[nameLength - 5]); |
989 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
990 |
< |
strcpy( endTest, ".stat" ); |
991 |
< |
} |
992 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
993 |
< |
strcpy( endTest, ".stat" ); |
994 |
< |
} |
995 |
< |
else{ |
996 |
< |
endTest = &(info->statusName[nameLength - 4]); |
997 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
1001 |
> |
|
1002 |
> |
strcpy( info[k].statusName, inFileName ); |
1003 |
> |
nameLength = strlen( info[k].statusName ); |
1004 |
> |
endTest = &(info[k].statusName[nameLength - 5]); |
1005 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
1006 |
|
strcpy( endTest, ".stat" ); |
1007 |
|
} |
1008 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
1008 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
1009 |
|
strcpy( endTest, ".stat" ); |
1010 |
|
} |
1011 |
|
else{ |
1012 |
< |
strcat( info->statusName, ".stat" ); |
1012 |
> |
endTest = &(info[k].statusName[nameLength - 4]); |
1013 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
1014 |
> |
strcpy( endTest, ".stat" ); |
1015 |
> |
} |
1016 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
1017 |
> |
strcpy( endTest, ".stat" ); |
1018 |
> |
} |
1019 |
> |
else{ |
1020 |
> |
strcat( info[k].statusName, ".stat" ); |
1021 |
> |
} |
1022 |
|
} |
1023 |
< |
} |
1007 |
< |
|
1023 |
> |
|
1024 |
|
#ifdef IS_MPI |
1025 |
< |
} |
1025 |
> |
} |
1026 |
|
#endif // is_mpi |
1027 |
< |
|
1027 |
> |
} |
1028 |
|
} |
1029 |
|
|
1030 |
|
|
1031 |
|
void SimSetup::sysObjectsCreation( void ){ |
1032 |
< |
|
1033 |
< |
int i; |
1034 |
< |
|
1032 |
> |
|
1033 |
> |
int i,k; |
1034 |
> |
|
1035 |
|
// create the forceField |
1036 |
< |
|
1036 |
> |
|
1037 |
|
createFF(); |
1038 |
|
|
1039 |
|
// extract componentList |
1057 |
|
// make and initialize the molecules (all but atomic coordinates) |
1058 |
|
|
1059 |
|
makeMolecules(); |
1044 |
– |
info->identArray = new int[info->n_atoms]; |
1045 |
– |
for(i=0; i<info->n_atoms; i++){ |
1046 |
– |
info->identArray[i] = the_atoms[i]->getIdent(); |
1047 |
– |
} |
1060 |
|
|
1061 |
< |
|
1062 |
< |
|
1061 |
> |
for(k=0; k<nInfo; k++){ |
1062 |
> |
info[k].identArray = new int[info[k].n_atoms]; |
1063 |
> |
for(i=0; i<info[k].n_atoms; i++){ |
1064 |
> |
info[k].identArray[i] = info[k].atoms[i]->getIdent(); |
1065 |
> |
} |
1066 |
> |
} |
1067 |
|
} |
1068 |
|
|
1069 |
|
|
1101 |
|
void SimSetup::compList( void ){ |
1102 |
|
|
1103 |
|
int i; |
1104 |
< |
|
1104 |
> |
char* id; |
1105 |
> |
LinkedMolStamp* headStamp = new LinkedMolStamp(); |
1106 |
> |
LinkedMolStamp* currentStamp = NULL; |
1107 |
|
comp_stamps = new MoleculeStamp*[n_components]; |
1108 |
< |
|
1108 |
> |
|
1109 |
|
// make an array of molecule stamps that match the components used. |
1110 |
|
// also extract the used stamps out into a separate linked list |
1093 |
– |
|
1094 |
– |
info->nComponents = n_components; |
1095 |
– |
info->componentsNmol = components_nmol; |
1096 |
– |
info->compStamps = comp_stamps; |
1097 |
– |
info->headStamp = new LinkedMolStamp(); |
1111 |
|
|
1112 |
< |
char* id; |
1113 |
< |
LinkedMolStamp* headStamp = info->headStamp; |
1114 |
< |
LinkedMolStamp* currentStamp = NULL; |
1112 |
> |
for(i=0; i<nInfo; i++){ |
1113 |
> |
info[i].nComponents = n_components; |
1114 |
> |
info[i].componentsNmol = components_nmol; |
1115 |
> |
info[i].compStamps = comp_stamps; |
1116 |
> |
info[i].headStamp = headStamp; |
1117 |
> |
} |
1118 |
> |
|
1119 |
> |
|
1120 |
|
for( i=0; i<n_components; i++ ){ |
1121 |
|
|
1122 |
|
id = the_components[i]->getType(); |
1154 |
|
|
1155 |
|
void SimSetup::calcSysValues( void ){ |
1156 |
|
int i, j, k; |
1157 |
< |
|
1158 |
< |
|
1157 |
> |
|
1158 |
> |
int *molMembershipArray; |
1159 |
> |
|
1160 |
|
tot_atoms = 0; |
1161 |
|
tot_bonds = 0; |
1162 |
|
tot_bends = 0; |
1168 |
|
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
1169 |
|
tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions(); |
1170 |
|
} |
1171 |
< |
|
1171 |
> |
|
1172 |
|
tot_SRI = tot_bonds + tot_bends + tot_torsions; |
1173 |
< |
|
1155 |
< |
info->n_atoms = tot_atoms; |
1156 |
< |
info->n_bonds = tot_bonds; |
1157 |
< |
info->n_bends = tot_bends; |
1158 |
< |
info->n_torsions = tot_torsions; |
1159 |
< |
info->n_SRI = tot_SRI; |
1160 |
< |
info->n_mol = tot_nmol; |
1173 |
> |
molMembershipArray = new int[tot_atoms]; |
1174 |
|
|
1175 |
< |
info->molMembershipArray = new int[tot_atoms]; |
1175 |
> |
for(i=0; i<nInfo; i++){ |
1176 |
> |
info[i].n_atoms = tot_atoms; |
1177 |
> |
info[i].n_bonds = tot_bonds; |
1178 |
> |
info[i].n_bends = tot_bends; |
1179 |
> |
info[i].n_torsions = tot_torsions; |
1180 |
> |
info[i].n_SRI = tot_SRI; |
1181 |
> |
info[i].n_mol = tot_nmol; |
1182 |
> |
|
1183 |
> |
info[i].molMembershipArray = molMembershipArray; |
1184 |
> |
} |
1185 |
|
} |
1186 |
|
|
1165 |
– |
|
1187 |
|
#ifdef IS_MPI |
1188 |
|
|
1189 |
|
void SimSetup::mpiMolDivide( void ){ |
1223 |
|
localMol++; |
1224 |
|
} |
1225 |
|
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1226 |
< |
info->molMembershipArray[globalAtomIndex] = allMol; |
1226 |
> |
info[0].molMembershipArray[globalAtomIndex] = allMol; |
1227 |
|
globalAtomIndex++; |
1228 |
|
} |
1229 |
|
|
1232 |
|
} |
1233 |
|
local_SRI = local_bonds + local_bends + local_torsions; |
1234 |
|
|
1235 |
< |
info->n_atoms = mpiSim->getMyNlocal(); |
1235 |
> |
info[0].n_atoms = mpiSim->getMyNlocal(); |
1236 |
|
|
1237 |
< |
if( local_atoms != info->n_atoms ){ |
1237 |
> |
if( local_atoms != info[0].n_atoms ){ |
1238 |
|
sprintf( painCave.errMsg, |
1239 |
|
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
1240 |
|
" localAtom (%d) are not equal.\n", |
1241 |
< |
info->n_atoms, |
1241 |
> |
info[0].n_atoms, |
1242 |
|
local_atoms ); |
1243 |
|
painCave.isFatal = 1; |
1244 |
|
simError(); |
1245 |
|
} |
1246 |
|
|
1247 |
< |
info->n_bonds = local_bonds; |
1248 |
< |
info->n_bends = local_bends; |
1249 |
< |
info->n_torsions = local_torsions; |
1250 |
< |
info->n_SRI = local_SRI; |
1251 |
< |
info->n_mol = localMol; |
1247 |
> |
info[0].n_bonds = local_bonds; |
1248 |
> |
info[0].n_bends = local_bends; |
1249 |
> |
info[0].n_torsions = local_torsions; |
1250 |
> |
info[0].n_SRI = local_SRI; |
1251 |
> |
info[0].n_mol = localMol; |
1252 |
|
|
1253 |
|
strcpy( checkPointMsg, "Passed nlocal consistency check." ); |
1254 |
|
MPIcheckPoint(); |
1255 |
|
} |
1256 |
< |
|
1256 |
> |
|
1257 |
|
#endif // is_mpi |
1258 |
|
|
1259 |
|
|
1260 |
|
void SimSetup::makeSysArrays( void ){ |
1261 |
< |
int i, j, k; |
1261 |
> |
int i, j, k, l; |
1262 |
|
|
1263 |
< |
|
1264 |
< |
// create the atom and short range interaction arrays |
1265 |
< |
|
1266 |
< |
Atom::createArrays(info->n_atoms); |
1267 |
< |
the_atoms = new Atom*[info->n_atoms]; |
1268 |
< |
the_molecules = new Molecule[info->n_mol]; |
1248 |
< |
int molIndex; |
1249 |
< |
|
1250 |
< |
// initialize the molecule's stampID's |
1251 |
< |
|
1252 |
< |
#ifdef IS_MPI |
1253 |
< |
|
1254 |
< |
|
1255 |
< |
molIndex = 0; |
1256 |
< |
for(i=0; i<mpiSim->getTotNmol(); i++){ |
1257 |
< |
|
1258 |
< |
if(mol2proc[i] == worldRank ){ |
1259 |
< |
the_molecules[molIndex].setStampID( molCompType[i] ); |
1260 |
< |
the_molecules[molIndex].setMyIndex( molIndex ); |
1261 |
< |
the_molecules[molIndex].setGlobalIndex( i ); |
1262 |
< |
molIndex++; |
1263 |
< |
} |
1264 |
< |
} |
1265 |
< |
|
1266 |
< |
#else // is_mpi |
1267 |
< |
|
1268 |
< |
molIndex = 0; |
1269 |
< |
globalAtomIndex = 0; |
1270 |
< |
for(i=0; i<n_components; i++){ |
1271 |
< |
for(j=0; j<components_nmol[i]; j++ ){ |
1272 |
< |
the_molecules[molIndex].setStampID( i ); |
1273 |
< |
the_molecules[molIndex].setMyIndex( molIndex ); |
1274 |
< |
the_molecules[molIndex].setGlobalIndex( molIndex ); |
1275 |
< |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1276 |
< |
info->molMembershipArray[globalAtomIndex] = molIndex; |
1277 |
< |
globalAtomIndex++; |
1278 |
< |
} |
1279 |
< |
molIndex++; |
1280 |
< |
} |
1281 |
< |
} |
1263 |
> |
Atom** the_atoms; |
1264 |
> |
Molecule* the_molecules; |
1265 |
> |
Exclude** the_excludes; |
1266 |
> |
|
1267 |
> |
|
1268 |
> |
for(l=0; l<nInfo; l++){ |
1269 |
|
|
1270 |
+ |
// create the atom and short range interaction arrays |
1271 |
+ |
|
1272 |
+ |
the_atoms = new Atom*[info[l].n_atoms]; |
1273 |
+ |
the_molecules = new Molecule[info[l].n_mol]; |
1274 |
+ |
int molIndex; |
1275 |
|
|
1276 |
+ |
// initialize the molecule's stampID's |
1277 |
+ |
|
1278 |
+ |
#ifdef IS_MPI |
1279 |
+ |
|
1280 |
+ |
|
1281 |
+ |
molIndex = 0; |
1282 |
+ |
for(i=0; i<mpiSim->getTotNmol(); i++){ |
1283 |
+ |
|
1284 |
+ |
if(mol2proc[i] == worldRank ){ |
1285 |
+ |
the_molecules[molIndex].setStampID( molCompType[i] ); |
1286 |
+ |
the_molecules[molIndex].setMyIndex( molIndex ); |
1287 |
+ |
the_molecules[molIndex].setGlobalIndex( i ); |
1288 |
+ |
molIndex++; |
1289 |
+ |
} |
1290 |
+ |
} |
1291 |
+ |
|
1292 |
+ |
#else // is_mpi |
1293 |
+ |
|
1294 |
+ |
molIndex = 0; |
1295 |
+ |
globalAtomIndex = 0; |
1296 |
+ |
for(i=0; i<n_components; i++){ |
1297 |
+ |
for(j=0; j<components_nmol[i]; j++ ){ |
1298 |
+ |
the_molecules[molIndex].setStampID( i ); |
1299 |
+ |
the_molecules[molIndex].setMyIndex( molIndex ); |
1300 |
+ |
the_molecules[molIndex].setGlobalIndex( molIndex ); |
1301 |
+ |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1302 |
+ |
info[l].molMembershipArray[globalAtomIndex] = molIndex; |
1303 |
+ |
globalAtomIndex++; |
1304 |
+ |
} |
1305 |
+ |
molIndex++; |
1306 |
+ |
} |
1307 |
+ |
} |
1308 |
+ |
|
1309 |
+ |
|
1310 |
|
#endif // is_mpi |
1311 |
|
|
1312 |
|
|
1313 |
< |
if( info->n_SRI ){ |
1313 |
> |
if( info[l].n_SRI ){ |
1314 |
|
|
1315 |
< |
Exclude::createArray(info->n_SRI); |
1316 |
< |
the_excludes = new Exclude*[info->n_SRI]; |
1317 |
< |
for( int ex=0; ex<info->n_SRI; ex++) the_excludes[ex] = new Exclude(ex); |
1318 |
< |
info->globalExcludes = new int; |
1319 |
< |
info->n_exclude = info->n_SRI; |
1320 |
< |
} |
1321 |
< |
else{ |
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->globalExcludes = new int; |
1330 |
< |
info->globalExcludes[0] = 0; |
1331 |
< |
info->n_exclude = 0; |
1332 |
< |
} |
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 |
> |
} |
1333 |
|
|
1334 |
< |
// set the arrays into the SimInfo object |
1334 |
> |
// set the arrays into the SimInfo object |
1335 |
|
|
1336 |
< |
info->atoms = the_atoms; |
1337 |
< |
info->molecules = the_molecules; |
1338 |
< |
info->nGlobalExcludes = 0; |
1339 |
< |
info->excludes = the_excludes; |
1336 |
> |
info[l].atoms = the_atoms; |
1337 |
> |
info[l].molecules = the_molecules; |
1338 |
> |
info[l].nGlobalExcludes = 0; |
1339 |
> |
info[l].excludes = the_excludes; |
1340 |
|
|
1341 |
< |
the_ff->setSimInfo( info ); |
1342 |
< |
|
1341 |
> |
the_ff->setSimInfo( info ); |
1342 |
> |
|
1343 |
> |
} |
1344 |
|
} |
1345 |
|
|
1346 |
|
void SimSetup::makeIntegrator( void ){ |
1347 |
|
|
1348 |
+ |
int k; |
1349 |
+ |
|
1350 |
|
NVT<RealIntegrator>* myNVT = NULL; |
1351 |
|
NPTi<RealIntegrator>* myNPTi = NULL; |
1352 |
|
NPTf<RealIntegrator>* myNPTf = NULL; |
1353 |
|
NPTim<RealIntegrator>* myNPTim = NULL; |
1354 |
|
NPTfm<RealIntegrator>* myNPTfm = NULL; |
1355 |
< |
ZConstraint<NVE<RealIntegrator> >* myNVEZCons = NULL; |
1356 |
< |
ZConstraint<NVT<RealIntegrator> >* myNVTZCons = NULL; |
1357 |
< |
ZConstraint<NPTi<RealIntegrator> >* myNPTiZCons = NULL; |
1358 |
< |
ZConstraint<NPTf<RealIntegrator> >* myNPTfZCons = NULL; |
1328 |
< |
ZConstraint<NPTim<RealIntegrator> >* myNPTimZCons = NULL; |
1329 |
< |
ZConstraint<NPTfm<RealIntegrator> >* myNPTfmZCons = NULL; |
1355 |
> |
|
1356 |
> |
for(k=0; k<nInfo; k++){ |
1357 |
> |
|
1358 |
> |
switch( ensembleCase ){ |
1359 |
|
|
1360 |
< |
cerr << "setting integrator" <<endl; |
1361 |
< |
|
1362 |
< |
switch( ensembleCase ){ |
1360 |
> |
case NVE_ENS: |
1361 |
> |
if (haveZConstraint){ |
1362 |
> |
setupZConstraint(); |
1363 |
> |
new ZConstraint<NVE<RealIntegrator> >( &(info[k]), the_ff ); |
1364 |
> |
} |
1365 |
|
|
1366 |
< |
case NVE_ENS: |
1367 |
< |
new NVE<RealIntegrator>( info, the_ff ); |
1368 |
< |
break; |
1366 |
> |
else |
1367 |
> |
new NVE<RealIntegrator>( &(info[k]), the_ff ); |
1368 |
> |
break; |
1369 |
> |
|
1370 |
> |
case NVT_ENS: |
1371 |
> |
if (haveZConstraint){ |
1372 |
> |
setupZConstraint(); |
1373 |
> |
myNVT = new ZConstraint<NVT<RealIntegrator> >( &(info[k]), the_ff ); |
1374 |
> |
} |
1375 |
> |
else |
1376 |
> |
myNVT = new NVT<RealIntegrator>( &(info[k]), the_ff ); |
1377 |
|
|
1378 |
< |
case NVT_ENS: |
1379 |
< |
myNVT = new NVT<RealIntegrator>( info, the_ff ); |
1380 |
< |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1378 |
> |
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 (haveZConstraint){ |
1394 |
> |
setupZConstraint(); |
1395 |
> |
myNPTi = new ZConstraint<NPTi<RealIntegrator> >( &(info[k]), the_ff ); |
1396 |
> |
} |
1397 |
> |
else |
1398 |
> |
myNPTi = new NPTi<RealIntegrator>( &(info[k]), the_ff ); |
1399 |
|
|
1400 |
< |
if (globals->haveTauThermostat()) |
1401 |
< |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1400 |
> |
myNPTi->setTargetTemp( globals->getTargetTemp() ); |
1401 |
> |
|
1402 |
> |
if (globals->haveTargetPressure()) |
1403 |
> |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1404 |
> |
else { |
1405 |
> |
sprintf( painCave.errMsg, |
1406 |
> |
"SimSetup error: If you use a constant pressure\n" |
1407 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1408 |
> |
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 (haveZConstraint){ |
1435 |
> |
setupZConstraint(); |
1436 |
> |
myNPTf = new ZConstraint<NPTf<RealIntegrator> >( &(info[k]), the_ff ); |
1437 |
> |
} |
1438 |
> |
else |
1439 |
> |
myNPTf = new NPTf<RealIntegrator>( &(info[k]), the_ff ); |
1440 |
|
|
1441 |
< |
else { |
1442 |
< |
sprintf( painCave.errMsg, |
1443 |
< |
"SimSetup error: If you use the NVT\n" |
1441 |
> |
myNPTf->setTargetTemp( globals->getTargetTemp()); |
1442 |
> |
|
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 |
< |
break; |
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 (haveZConstraint){ |
1476 |
> |
setupZConstraint(); |
1477 |
> |
myNPTim = new ZConstraint<NPTim<RealIntegrator> >( &(info[k]), the_ff ); |
1478 |
> |
} |
1479 |
> |
else |
1480 |
> |
myNPTim = new NPTim<RealIntegrator>( &(info[k]), the_ff ); |
1481 |
|
|
1482 |
< |
case NPTi_ENS: |
1483 |
< |
myNPTi = new NPTi<RealIntegrator>( info, the_ff ); |
1484 |
< |
myNPTi->setTargetTemp( globals->getTargetTemp() ); |
1485 |
< |
|
1486 |
< |
if (globals->haveTargetPressure()) |
1487 |
< |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1488 |
< |
else { |
1482 |
> |
myNPTim->setTargetTemp( globals->getTargetTemp()); |
1483 |
> |
|
1484 |
> |
if (globals->haveTargetPressure()) |
1485 |
> |
myNPTim->setTargetPressure(globals->getTargetPressure()); |
1486 |
> |
else { |
1487 |
> |
sprintf( painCave.errMsg, |
1488 |
> |
"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, |
1363 |
– |
"SimSetup error: If you use a constant pressure\n" |
1364 |
– |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1365 |
– |
painCave.isFatal = 1; |
1366 |
– |
simError(); |
1367 |
– |
} |
1368 |
– |
|
1369 |
– |
if( globals->haveTauThermostat() ) |
1370 |
– |
myNPTi->setTauThermostat( globals->getTauThermostat() ); |
1371 |
– |
else{ |
1372 |
– |
sprintf( painCave.errMsg, |
1508 |
|
"SimSetup error: If you use an NPT\n" |
1374 |
– |
" ensemble, you must set tauThermostat.\n"); |
1375 |
– |
painCave.isFatal = 1; |
1376 |
– |
simError(); |
1377 |
– |
} |
1378 |
– |
|
1379 |
– |
if( globals->haveTauBarostat() ) |
1380 |
– |
myNPTi->setTauBarostat( globals->getTauBarostat() ); |
1381 |
– |
else{ |
1382 |
– |
sprintf( painCave.errMsg, |
1383 |
– |
"SimSetup error: If you use an NPT\n" |
1509 |
|
" ensemble, you must set tauBarostat.\n"); |
1510 |
|
painCave.isFatal = 1; |
1511 |
|
simError(); |
1512 |
< |
} |
1513 |
< |
break; |
1512 |
> |
} |
1513 |
> |
break; |
1514 |
> |
|
1515 |
> |
case NPTfm_ENS: |
1516 |
> |
if (haveZConstraint){ |
1517 |
> |
setupZConstraint(); |
1518 |
> |
myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >( &(info[k]), the_ff ); |
1519 |
> |
} |
1520 |
> |
else |
1521 |
> |
myNPTfm = new NPTfm<RealIntegrator>( &(info[k]), the_ff ); |
1522 |
|
|
1523 |
< |
case NPTf_ENS: |
1391 |
< |
myNPTf = new NPTf<RealIntegrator>( info, the_ff ); |
1392 |
< |
myNPTf->setTargetTemp( globals->getTargetTemp()); |
1393 |
< |
|
1394 |
< |
if (globals->haveTargetPressure()) |
1395 |
< |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1396 |
< |
else { |
1397 |
< |
sprintf( painCave.errMsg, |
1398 |
< |
"SimSetup error: If you use a constant pressure\n" |
1399 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1400 |
< |
painCave.isFatal = 1; |
1401 |
< |
simError(); |
1402 |
< |
} |
1403 |
< |
|
1404 |
< |
if( globals->haveTauThermostat() ) |
1405 |
< |
myNPTf->setTauThermostat( globals->getTauThermostat() ); |
1406 |
< |
else{ |
1407 |
< |
sprintf( painCave.errMsg, |
1408 |
< |
"SimSetup error: If you use an NPT\n" |
1409 |
< |
" ensemble, you must set tauThermostat.\n"); |
1410 |
< |
painCave.isFatal = 1; |
1411 |
< |
simError(); |
1412 |
< |
} |
1413 |
< |
|
1414 |
< |
if( globals->haveTauBarostat() ) |
1415 |
< |
myNPTf->setTauBarostat( globals->getTauBarostat() ); |
1416 |
< |
else{ |
1417 |
< |
sprintf( painCave.errMsg, |
1418 |
< |
"SimSetup error: If you use an NPT\n" |
1419 |
< |
" ensemble, you must set tauBarostat.\n"); |
1420 |
< |
painCave.isFatal = 1; |
1421 |
< |
simError(); |
1422 |
< |
} |
1423 |
< |
break; |
1424 |
< |
|
1425 |
< |
case NPTim_ENS: |
1426 |
< |
myNPTim = new NPTim<RealIntegrator>( info, the_ff ); |
1427 |
< |
myNPTim->setTargetTemp( globals->getTargetTemp()); |
1428 |
< |
|
1429 |
< |
if (globals->haveTargetPressure()) |
1430 |
< |
myNPTim->setTargetPressure(globals->getTargetPressure()); |
1431 |
< |
else { |
1432 |
< |
sprintf( painCave.errMsg, |
1433 |
< |
"SimSetup error: If you use a constant pressure\n" |
1434 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1435 |
< |
painCave.isFatal = 1; |
1436 |
< |
simError(); |
1437 |
< |
} |
1438 |
< |
|
1439 |
< |
if( globals->haveTauThermostat() ) |
1440 |
< |
myNPTim->setTauThermostat( globals->getTauThermostat() ); |
1441 |
< |
else{ |
1442 |
< |
sprintf( painCave.errMsg, |
1443 |
< |
"SimSetup error: If you use an NPT\n" |
1444 |
< |
" ensemble, you must set tauThermostat.\n"); |
1445 |
< |
painCave.isFatal = 1; |
1446 |
< |
simError(); |
1447 |
< |
} |
1448 |
< |
|
1449 |
< |
if( globals->haveTauBarostat() ) |
1450 |
< |
myNPTim->setTauBarostat( globals->getTauBarostat() ); |
1451 |
< |
else{ |
1452 |
< |
sprintf( painCave.errMsg, |
1453 |
< |
"SimSetup error: If you use an NPT\n" |
1454 |
< |
" ensemble, you must set tauBarostat.\n"); |
1455 |
< |
painCave.isFatal = 1; |
1456 |
< |
simError(); |
1457 |
< |
} |
1458 |
< |
break; |
1459 |
< |
|
1460 |
< |
case NPTfm_ENS: |
1461 |
< |
myNPTfm = new NPTfm<RealIntegrator>( info, the_ff ); |
1462 |
< |
myNPTfm->setTargetTemp( globals->getTargetTemp()); |
1463 |
< |
|
1464 |
< |
if (globals->haveTargetPressure()) |
1465 |
< |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1466 |
< |
else { |
1467 |
< |
sprintf( painCave.errMsg, |
1468 |
< |
"SimSetup error: If you use a constant pressure\n" |
1469 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1470 |
< |
painCave.isFatal = 1; |
1471 |
< |
simError(); |
1472 |
< |
} |
1473 |
< |
|
1474 |
< |
if( globals->haveTauThermostat() ) |
1475 |
< |
myNPTfm->setTauThermostat( globals->getTauThermostat() ); |
1476 |
< |
else{ |
1477 |
< |
sprintf( painCave.errMsg, |
1478 |
< |
"SimSetup error: If you use an NPT\n" |
1479 |
< |
" ensemble, you must set tauThermostat.\n"); |
1480 |
< |
painCave.isFatal = 1; |
1481 |
< |
simError(); |
1482 |
< |
} |
1483 |
< |
|
1484 |
< |
if( globals->haveTauBarostat() ) |
1485 |
< |
myNPTfm->setTauBarostat( globals->getTauBarostat() ); |
1486 |
< |
else{ |
1487 |
< |
sprintf( painCave.errMsg, |
1488 |
< |
"SimSetup error: If you use an NPT\n" |
1489 |
< |
" ensemble, you must set tauBarostat.\n"); |
1490 |
< |
painCave.isFatal = 1; |
1491 |
< |
simError(); |
1492 |
< |
} |
1493 |
< |
break; |
1494 |
< |
|
1495 |
< |
case NVEZCONS_ENS: |
1496 |
< |
|
1497 |
< |
|
1498 |
< |
//setup index of z-constraint molecules, z-constraint sampel time |
1499 |
< |
//and z-constraint force output name. These parameter should be known |
1500 |
< |
//before constructing the z-constraint integrator |
1501 |
< |
setupZConstraint(); |
1523 |
> |
myNPTfm->setTargetTemp( globals->getTargetTemp()); |
1524 |
|
|
1525 |
< |
myNVEZCons = new ZConstraint<NVE<RealIntegrator> >( info, the_ff ); |
1526 |
< |
|
1527 |
< |
break; |
1528 |
< |
|
1529 |
< |
|
1530 |
< |
case NVTZCONS_ENS: |
1531 |
< |
|
1532 |
< |
setupZConstraint(); |
1533 |
< |
|
1512 |
< |
myNVTZCons = new ZConstraint<NVT<RealIntegrator> >( info, the_ff ); |
1513 |
< |
myNVTZCons->setTargetTemp(globals->getTargetTemp()); |
1514 |
< |
|
1515 |
< |
if (globals->haveTauThermostat()) |
1516 |
< |
myNVTZCons->setTauThermostat(globals->getTauThermostat()); |
1517 |
< |
|
1518 |
< |
else { |
1519 |
< |
sprintf( painCave.errMsg, |
1520 |
< |
"SimSetup error: If you use the NVT\n" |
1521 |
< |
" ensemble, you must set tauThermostat.\n"); |
1522 |
< |
painCave.isFatal = 1; |
1523 |
< |
simError(); |
1524 |
< |
} |
1525 |
< |
break; |
1526 |
< |
|
1527 |
< |
case NPTiZCONS_ENS: |
1528 |
< |
|
1529 |
< |
setupZConstraint(); |
1530 |
< |
|
1531 |
< |
myNPTiZCons = new ZConstraint<NPTi<RealIntegrator> >( info, the_ff ); |
1532 |
< |
myNPTiZCons->setTargetTemp( globals->getTargetTemp() ); |
1533 |
< |
|
1534 |
< |
if (globals->haveTargetPressure()) |
1535 |
< |
myNPTiZCons->setTargetPressure(globals->getTargetPressure()); |
1536 |
< |
else { |
1537 |
< |
sprintf( painCave.errMsg, |
1538 |
< |
"SimSetup error: If you use a constant pressure\n" |
1539 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1540 |
< |
painCave.isFatal = 1; |
1541 |
< |
simError(); |
1542 |
< |
} |
1543 |
< |
|
1544 |
< |
if( globals->haveTauThermostat() ) |
1545 |
< |
myNPTiZCons->setTauThermostat( globals->getTauThermostat() ); |
1546 |
< |
else{ |
1547 |
< |
sprintf( painCave.errMsg, |
1548 |
< |
"SimSetup error: If you use an NPT\n" |
1549 |
< |
" ensemble, you must set tauThermostat.\n"); |
1550 |
< |
painCave.isFatal = 1; |
1551 |
< |
simError(); |
1552 |
< |
} |
1553 |
< |
|
1554 |
< |
if( globals->haveTauBarostat() ) |
1555 |
< |
myNPTiZCons->setTauBarostat( globals->getTauBarostat() ); |
1556 |
< |
else{ |
1557 |
< |
sprintf( painCave.errMsg, |
1558 |
< |
"SimSetup error: If you use an NPT\n" |
1559 |
< |
" ensemble, you must set tauBarostat.\n"); |
1560 |
< |
painCave.isFatal = 1; |
1561 |
< |
simError(); |
1562 |
< |
} |
1563 |
< |
|
1564 |
< |
break; |
1565 |
< |
|
1566 |
< |
case NPTfZCONS_ENS: |
1567 |
< |
|
1568 |
< |
setupZConstraint(); |
1569 |
< |
|
1570 |
< |
myNPTfZCons = new ZConstraint<NPTf<RealIntegrator> >( info, the_ff ); |
1571 |
< |
myNPTfZCons->setTargetTemp( globals->getTargetTemp()); |
1572 |
< |
|
1573 |
< |
if (globals->haveTargetPressure()) |
1574 |
< |
myNPTfZCons->setTargetPressure(globals->getTargetPressure()); |
1575 |
< |
else { |
1576 |
< |
sprintf( painCave.errMsg, |
1577 |
< |
"SimSetup error: If you use a constant pressure\n" |
1578 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1579 |
< |
painCave.isFatal = 1; |
1580 |
< |
simError(); |
1581 |
< |
} |
1582 |
< |
|
1583 |
< |
if( globals->haveTauThermostat() ) |
1584 |
< |
myNPTfZCons->setTauThermostat( globals->getTauThermostat() ); |
1585 |
< |
else{ |
1586 |
< |
sprintf( painCave.errMsg, |
1587 |
< |
"SimSetup error: If you use an NPT\n" |
1588 |
< |
" ensemble, you must set tauThermostat.\n"); |
1589 |
< |
painCave.isFatal = 1; |
1590 |
< |
simError(); |
1591 |
< |
} |
1592 |
< |
|
1593 |
< |
if( globals->haveTauBarostat() ) |
1594 |
< |
myNPTfZCons->setTauBarostat( globals->getTauBarostat() ); |
1595 |
< |
else{ |
1596 |
< |
sprintf( painCave.errMsg, |
1597 |
< |
"SimSetup error: If you use an NPT\n" |
1598 |
< |
" ensemble, you must set tauBarostat.\n"); |
1599 |
< |
painCave.isFatal = 1; |
1600 |
< |
simError(); |
1601 |
< |
} |
1602 |
< |
|
1603 |
< |
break; |
1525 |
> |
if (globals->haveTargetPressure()) |
1526 |
> |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1527 |
> |
else { |
1528 |
> |
sprintf( painCave.errMsg, |
1529 |
> |
"SimSetup error: If you use a constant pressure\n" |
1530 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1531 |
> |
painCave.isFatal = 1; |
1532 |
> |
simError(); |
1533 |
> |
} |
1534 |
|
|
1535 |
< |
case NPTimZCONS_ENS: |
1536 |
< |
|
1537 |
< |
setupZConstraint(); |
1538 |
< |
|
1539 |
< |
myNPTimZCons = new ZConstraint<NPTim<RealIntegrator> >( info, the_ff ); |
1540 |
< |
myNPTimZCons->setTargetTemp( globals->getTargetTemp()); |
1541 |
< |
|
1542 |
< |
if (globals->haveTargetPressure()) |
1543 |
< |
myNPTimZCons->setTargetPressure(globals->getTargetPressure()); |
1544 |
< |
else { |
1535 |
> |
if( globals->haveTauThermostat() ) |
1536 |
> |
myNPTfm->setTauThermostat( globals->getTauThermostat() ); |
1537 |
> |
else{ |
1538 |
> |
sprintf( painCave.errMsg, |
1539 |
> |
"SimSetup error: If you use an NPT\n" |
1540 |
> |
" ensemble, you must set tauThermostat.\n"); |
1541 |
> |
painCave.isFatal = 1; |
1542 |
> |
simError(); |
1543 |
> |
} |
1544 |
> |
|
1545 |
> |
if( globals->haveTauBarostat() ) |
1546 |
> |
myNPTfm->setTauBarostat( globals->getTauBarostat() ); |
1547 |
> |
else{ |
1548 |
> |
sprintf( painCave.errMsg, |
1549 |
> |
"SimSetup error: If you use an NPT\n" |
1550 |
> |
" ensemble, you must set tauBarostat.\n"); |
1551 |
> |
painCave.isFatal = 1; |
1552 |
> |
simError(); |
1553 |
> |
} |
1554 |
> |
break; |
1555 |
> |
|
1556 |
> |
default: |
1557 |
|
sprintf( painCave.errMsg, |
1558 |
< |
"SimSetup error: If you use a constant pressure\n" |
1617 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1558 |
> |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1559 |
|
painCave.isFatal = 1; |
1560 |
|
simError(); |
1561 |
|
} |
1621 |
– |
|
1622 |
– |
if( globals->haveTauThermostat() ) |
1623 |
– |
myNPTimZCons->setTauThermostat( globals->getTauThermostat() ); |
1624 |
– |
else{ |
1625 |
– |
sprintf( painCave.errMsg, |
1626 |
– |
"SimSetup error: If you use an NPT\n" |
1627 |
– |
" ensemble, you must set tauThermostat.\n"); |
1628 |
– |
painCave.isFatal = 1; |
1629 |
– |
simError(); |
1630 |
– |
} |
1631 |
– |
|
1632 |
– |
if( globals->haveTauBarostat() ) |
1633 |
– |
myNPTimZCons->setTauBarostat( globals->getTauBarostat() ); |
1634 |
– |
else{ |
1635 |
– |
sprintf( painCave.errMsg, |
1636 |
– |
"SimSetup error: If you use an NPT\n" |
1637 |
– |
" ensemble, you must set tauBarostat.\n"); |
1638 |
– |
painCave.isFatal = 1; |
1639 |
– |
simError(); |
1640 |
– |
} |
1641 |
– |
|
1642 |
– |
break; |
1643 |
– |
|
1644 |
– |
case NPTfmZCONS_ENS: |
1645 |
– |
|
1646 |
– |
setupZConstraint(); |
1647 |
– |
|
1648 |
– |
myNPTfmZCons = new ZConstraint<NPTfm<RealIntegrator> >( info, the_ff ); |
1649 |
– |
myNPTfmZCons->setTargetTemp( globals->getTargetTemp()); |
1650 |
– |
|
1651 |
– |
if (globals->haveTargetPressure()) |
1652 |
– |
myNPTfmZCons->setTargetPressure(globals->getTargetPressure()); |
1653 |
– |
else { |
1654 |
– |
sprintf( painCave.errMsg, |
1655 |
– |
"SimSetup error: If you use a constant pressure\n" |
1656 |
– |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1657 |
– |
painCave.isFatal = 1; |
1658 |
– |
simError(); |
1659 |
– |
} |
1660 |
– |
|
1661 |
– |
if( globals->haveTauThermostat() ) |
1662 |
– |
myNPTfmZCons->setTauThermostat( globals->getTauThermostat() ); |
1663 |
– |
else{ |
1664 |
– |
sprintf( painCave.errMsg, |
1665 |
– |
"SimSetup error: If you use an NPT\n" |
1666 |
– |
" ensemble, you must set tauThermostat.\n"); |
1667 |
– |
painCave.isFatal = 1; |
1668 |
– |
simError(); |
1669 |
– |
} |
1670 |
– |
|
1671 |
– |
if( globals->haveTauBarostat() ) |
1672 |
– |
myNPTfmZCons->setTauBarostat( globals->getTauBarostat() ); |
1673 |
– |
else{ |
1674 |
– |
sprintf( painCave.errMsg, |
1675 |
– |
"SimSetup error: If you use an NPT\n" |
1676 |
– |
" ensemble, you must set tauBarostat.\n"); |
1677 |
– |
painCave.isFatal = 1; |
1678 |
– |
simError(); |
1679 |
– |
} |
1680 |
– |
break; |
1681 |
– |
|
1682 |
– |
|
1683 |
– |
|
1684 |
– |
default: |
1685 |
– |
sprintf( painCave.errMsg, |
1686 |
– |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1687 |
– |
painCave.isFatal = 1; |
1688 |
– |
simError(); |
1562 |
|
} |
1690 |
– |
|
1563 |
|
} |
1564 |
|
|
1565 |
|
void SimSetup::initFortran( void ){ |
1566 |
|
|
1567 |
< |
info->refreshSim(); |
1567 |
> |
info[0].refreshSim(); |
1568 |
|
|
1569 |
< |
if( !strcmp( info->mixingRule, "standard") ){ |
1569 |
> |
if( !strcmp( info[0].mixingRule, "standard") ){ |
1570 |
|
the_ff->initForceField( LB_MIXING_RULE ); |
1571 |
|
} |
1572 |
< |
else if( !strcmp( info->mixingRule, "explicit") ){ |
1572 |
> |
else if( !strcmp( info[0].mixingRule, "explicit") ){ |
1573 |
|
the_ff->initForceField( EXPLICIT_MIXING_RULE ); |
1574 |
|
} |
1575 |
|
else{ |
1576 |
|
sprintf( painCave.errMsg, |
1577 |
|
"SimSetup Error: unknown mixing rule -> \"%s\"\n", |
1578 |
< |
info->mixingRule ); |
1578 |
> |
info[0].mixingRule ); |
1579 |
|
painCave.isFatal = 1; |
1580 |
|
simError(); |
1581 |
|
} |
1591 |
|
|
1592 |
|
void SimSetup::setupZConstraint() |
1593 |
|
{ |
1594 |
< |
if(globals->haveZConsTime()){ |
1595 |
< |
|
1596 |
< |
//add sample time of z-constraint into SimInfo's property list |
1597 |
< |
DoubleData* zconsTimeProp = new DoubleData(); |
1598 |
< |
zconsTimeProp->setID("zconstime"); |
1727 |
< |
zconsTimeProp->setData(globals->getZConsTime()); |
1728 |
< |
info->addProperty(zconsTimeProp); |
1729 |
< |
} |
1730 |
< |
else{ |
1731 |
< |
sprintf( painCave.errMsg, |
1732 |
< |
"ZConstraint error: If you use an ZConstraint\n" |
1733 |
< |
" , you must set sample time.\n"); |
1734 |
< |
painCave.isFatal = 1; |
1735 |
< |
simError(); |
1736 |
< |
} |
1594 |
> |
int k; |
1595 |
> |
|
1596 |
> |
for(k=0; k<nInfo; k++){ |
1597 |
> |
|
1598 |
> |
if(globals->haveZConsTime()){ |
1599 |
|
|
1600 |
< |
if(globals->haveIndexOfAllZConsMols()){ |
1600 |
> |
//add sample time of z-constraint into SimInfo's property list |
1601 |
> |
DoubleData* zconsTimeProp = new DoubleData(); |
1602 |
> |
zconsTimeProp->setID("zconstime"); |
1603 |
> |
zconsTimeProp->setData(globals->getZConsTime()); |
1604 |
> |
info[k].addProperty(zconsTimeProp); |
1605 |
> |
} |
1606 |
> |
else{ |
1607 |
> |
sprintf( painCave.errMsg, |
1608 |
> |
"ZConstraint error: If you use an ZConstraint\n" |
1609 |
> |
" , you must set sample time.\n"); |
1610 |
> |
painCave.isFatal = 1; |
1611 |
> |
simError(); |
1612 |
> |
} |
1613 |
> |
|
1614 |
> |
if(globals->haveIndexOfAllZConsMols()){ |
1615 |
|
|
1616 |
< |
//add index of z-constraint molecules into SimInfo's property list |
1617 |
< |
vector<int> tempIndex = globals->getIndexOfAllZConsMols(); |
1742 |
< |
|
1743 |
< |
//sort the index |
1744 |
< |
sort(tempIndex.begin(), tempIndex.end()); |
1745 |
< |
|
1746 |
< |
IndexData* zconsIndex = new IndexData(); |
1747 |
< |
zconsIndex->setID("zconsindex"); |
1748 |
< |
zconsIndex->setIndexData(tempIndex); |
1749 |
< |
info->addProperty(zconsIndex); |
1750 |
< |
} |
1751 |
< |
else{ |
1752 |
< |
sprintf( painCave.errMsg, |
1753 |
< |
"SimSetup error: If you use an ZConstraint\n" |
1754 |
< |
" , you must set index of z-constraint molecules.\n"); |
1755 |
< |
painCave.isFatal = 1; |
1756 |
< |
simError(); |
1616 |
> |
//add index of z-constraint molecules into SimInfo's property list |
1617 |
> |
vector<int> tempIndex = globals->getIndexOfAllZConsMols(); |
1618 |
|
|
1619 |
+ |
//sort the index |
1620 |
+ |
sort(tempIndex.begin(), tempIndex.end()); |
1621 |
+ |
|
1622 |
+ |
IndexData* zconsIndex = new IndexData(); |
1623 |
+ |
zconsIndex->setID("zconsindex"); |
1624 |
+ |
zconsIndex->setIndexData(tempIndex); |
1625 |
+ |
info[k].addProperty(zconsIndex); |
1626 |
+ |
} |
1627 |
+ |
else{ |
1628 |
+ |
sprintf( painCave.errMsg, |
1629 |
+ |
"SimSetup error: If you use an ZConstraint\n" |
1630 |
+ |
" , you must set index of z-constraint molecules.\n"); |
1631 |
+ |
painCave.isFatal = 1; |
1632 |
+ |
simError(); |
1633 |
+ |
|
1634 |
+ |
} |
1635 |
+ |
|
1636 |
+ |
//Determine the name of ouput file and add it into SimInfo's property list |
1637 |
+ |
//Be careful, do not use inFileName, since it is a pointer which |
1638 |
+ |
//point to a string at master node, and slave nodes do not contain that string |
1639 |
+ |
|
1640 |
+ |
string zconsOutput(info[k].finalName); |
1641 |
+ |
|
1642 |
+ |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1643 |
+ |
|
1644 |
+ |
StringData* zconsFilename = new StringData(); |
1645 |
+ |
zconsFilename->setID("zconsfilename"); |
1646 |
+ |
zconsFilename->setData(zconsOutput); |
1647 |
+ |
|
1648 |
+ |
info[k].addProperty(zconsFilename); |
1649 |
|
} |
1759 |
– |
|
1760 |
– |
//Determine the name of ouput file and add it into SimInfo's property list |
1761 |
– |
//Be careful, do not use inFileName, since it is a pointer which |
1762 |
– |
//point to a string at master node, and slave nodes do not contain that string |
1763 |
– |
|
1764 |
– |
string zconsOutput(info->finalName); |
1765 |
– |
|
1766 |
– |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1767 |
– |
|
1768 |
– |
StringData* zconsFilename = new StringData(); |
1769 |
– |
zconsFilename->setID("zconsfilename"); |
1770 |
– |
zconsFilename->setData(zconsOutput); |
1771 |
– |
|
1772 |
– |
info->addProperty(zconsFilename); |
1773 |
– |
|
1650 |
|
} |