1 |
+ |
#include <algorithm> |
2 |
|
#include <cstdlib> |
3 |
|
#include <iostream> |
4 |
|
#include <cmath> |
5 |
+ |
#include <string> |
6 |
|
|
7 |
|
#include "SimSetup.hpp" |
8 |
+ |
#include "ReadWrite.hpp" |
9 |
|
#include "parse_me.h" |
10 |
|
#include "Integrator.hpp" |
11 |
|
#include "simError.h" |
17 |
|
|
18 |
|
// some defines for ensemble and Forcefield cases |
19 |
|
|
20 |
< |
#define NVE_ENS 0 |
21 |
< |
#define NVT_ENS 1 |
22 |
< |
#define NPTi_ENS 2 |
23 |
< |
#define NPTf_ENS 3 |
24 |
< |
#define NPTim_ENS 4 |
25 |
< |
#define NPTfm_ENS 5 |
20 |
> |
#define NVE_ENS 0 |
21 |
> |
#define NVT_ENS 1 |
22 |
> |
#define NPTi_ENS 2 |
23 |
> |
#define NPTf_ENS 3 |
24 |
> |
#define NPTim_ENS 4 |
25 |
> |
#define NPTfm_ENS 5 |
26 |
|
|
24 |
– |
|
27 |
|
#define FF_DUFF 0 |
28 |
|
#define FF_LJ 1 |
29 |
|
#define FF_EAM 2 |
30 |
|
|
31 |
+ |
using namespace std; |
32 |
+ |
|
33 |
|
SimSetup::SimSetup(){ |
34 |
|
|
35 |
|
isInfoArray = 0; |
54 |
|
info = the_info; |
55 |
|
nInfo = theNinfo; |
56 |
|
isInfoArray = 1; |
57 |
< |
} |
57 |
> |
} |
58 |
|
|
59 |
|
|
60 |
|
void SimSetup::parseFile( char* fileName ){ |
92 |
|
|
93 |
|
#endif // is_mpi |
94 |
|
|
95 |
< |
void SimSetup::createSim( void ){ |
95 |
> |
void SimSetup::createSim(void){ |
96 |
|
|
97 |
|
int i, j, k, globalAtomIndex; |
98 |
|
|
99 |
|
// gather all of the information from the Bass file |
100 |
< |
|
100 |
> |
|
101 |
> |
std::cerr << "gathering info\n"; |
102 |
> |
|
103 |
|
gatherInfo(); |
104 |
|
|
105 |
|
// creation of complex system objects |
106 |
|
|
107 |
+ |
std::cerr << "creating system objects\n"; |
108 |
+ |
|
109 |
|
sysObjectsCreation(); |
110 |
|
|
111 |
|
// check on the post processing info |
112 |
|
|
113 |
+ |
std::cerr << "performing final info check.\n"; |
114 |
+ |
|
115 |
|
finalInfoCheck(); |
116 |
|
|
117 |
|
// initialize the system coordinates |
118 |
|
|
119 |
< |
initSystemCoords(); |
110 |
< |
|
119 |
> |
std::cerr << "about to init coords\n"; |
120 |
|
|
121 |
+ |
if( !isInfoArray ) initSystemCoords(); |
122 |
+ |
|
123 |
|
// make the output filenames |
124 |
|
|
125 |
|
makeOutNames(); |
143 |
|
|
144 |
|
void SimSetup::makeMolecules( void ){ |
145 |
|
|
146 |
+ |
int k,l; |
147 |
|
int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; |
148 |
|
molInit molInfo; |
149 |
|
DirectionalAtom* dAtom; |
168 |
|
|
169 |
|
double ux, uy, uz, u, uSqr; |
170 |
|
|
171 |
< |
atomOffset = 0; |
160 |
< |
excludeOffset = 0; |
161 |
< |
for(i=0; i<info->n_mol; i++){ |
171 |
> |
for(k=0; k<nInfo; k++){ |
172 |
|
|
173 |
< |
stampID = the_molecules[i].getStampID(); |
173 |
> |
the_ff->setSimInfo( &(info[k]) ); |
174 |
|
|
175 |
< |
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
176 |
< |
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
177 |
< |
molInfo.nBends = comp_stamps[stampID]->getNBends(); |
178 |
< |
molInfo.nTorsions = comp_stamps[stampID]->getNTorsions(); |
179 |
< |
molInfo.nExcludes = molInfo.nBonds + molInfo.nBends + molInfo.nTorsions; |
175 |
> |
atomOffset = 0; |
176 |
> |
excludeOffset = 0; |
177 |
> |
for(i=0; i<info[k].n_mol; i++){ |
178 |
> |
|
179 |
> |
stampID = info[k].molecules[i].getStampID(); |
180 |
|
|
181 |
< |
molInfo.myAtoms = &the_atoms[atomOffset]; |
182 |
< |
molInfo.myExcludes = &the_excludes[excludeOffset]; |
183 |
< |
molInfo.myBonds = new Bond*[molInfo.nBonds]; |
184 |
< |
molInfo.myBends = new Bend*[molInfo.nBends]; |
185 |
< |
molInfo.myTorsions = new Torsion*[molInfo.nTorsions]; |
181 |
> |
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
182 |
> |
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
183 |
> |
molInfo.nBends = comp_stamps[stampID]->getNBends(); |
184 |
> |
molInfo.nTorsions = comp_stamps[stampID]->getNTorsions(); |
185 |
> |
molInfo.nExcludes = molInfo.nBonds + molInfo.nBends + molInfo.nTorsions; |
186 |
> |
|
187 |
> |
molInfo.myAtoms = &(info[k].atoms[atomOffset]); |
188 |
> |
molInfo.myExcludes = &(info[k].excludes[excludeOffset]); |
189 |
> |
molInfo.myBonds = new Bond*[molInfo.nBonds]; |
190 |
> |
molInfo.myBends = new Bend*[molInfo.nBends]; |
191 |
> |
molInfo.myTorsions = new Torsion*[molInfo.nTorsions]; |
192 |
|
|
193 |
< |
theBonds = new bond_pair[molInfo.nBonds]; |
194 |
< |
theBends = new bend_set[molInfo.nBends]; |
195 |
< |
theTorsions = new torsion_set[molInfo.nTorsions]; |
193 |
> |
theBonds = new bond_pair[molInfo.nBonds]; |
194 |
> |
theBends = new bend_set[molInfo.nBends]; |
195 |
> |
theTorsions = new torsion_set[molInfo.nTorsions]; |
196 |
|
|
197 |
< |
// make the Atoms |
197 |
> |
// make the Atoms |
198 |
|
|
199 |
< |
for(j=0; j<molInfo.nAtoms; j++){ |
184 |
< |
|
185 |
< |
currentAtom = comp_stamps[stampID]->getAtom( j ); |
186 |
< |
if( currentAtom->haveOrientation() ){ |
199 |
> |
for(j=0; j<molInfo.nAtoms; j++){ |
200 |
|
|
201 |
< |
dAtom = new DirectionalAtom(j + atomOffset); |
202 |
< |
info->n_oriented++; |
203 |
< |
molInfo.myAtoms[j] = dAtom; |
204 |
< |
|
205 |
< |
ux = currentAtom->getOrntX(); |
206 |
< |
uy = currentAtom->getOrntY(); |
207 |
< |
uz = currentAtom->getOrntZ(); |
208 |
< |
|
209 |
< |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
210 |
< |
|
211 |
< |
u = sqrt( uSqr ); |
212 |
< |
ux = ux / u; |
213 |
< |
uy = uy / u; |
214 |
< |
uz = uz / u; |
215 |
< |
|
216 |
< |
dAtom->setSUx( ux ); |
217 |
< |
dAtom->setSUy( uy ); |
218 |
< |
dAtom->setSUz( uz ); |
219 |
< |
} |
220 |
< |
else{ |
221 |
< |
molInfo.myAtoms[j] = new GeneralAtom(j + atomOffset); |
222 |
< |
} |
223 |
< |
molInfo.myAtoms[j]->setType( currentAtom->getType() ); |
201 |
> |
currentAtom = comp_stamps[stampID]->getAtom( j ); |
202 |
> |
if( currentAtom->haveOrientation() ){ |
203 |
> |
|
204 |
> |
dAtom = new DirectionalAtom( (j + atomOffset), |
205 |
> |
info[k].getConfiguration() ); |
206 |
> |
info[k].n_oriented++; |
207 |
> |
molInfo.myAtoms[j] = dAtom; |
208 |
> |
|
209 |
> |
ux = currentAtom->getOrntX(); |
210 |
> |
uy = currentAtom->getOrntY(); |
211 |
> |
uz = currentAtom->getOrntZ(); |
212 |
> |
|
213 |
> |
uSqr = (ux * ux) + (uy * uy) + (uz * uz); |
214 |
> |
|
215 |
> |
u = sqrt( uSqr ); |
216 |
> |
ux = ux / u; |
217 |
> |
uy = uy / u; |
218 |
> |
uz = uz / u; |
219 |
> |
|
220 |
> |
dAtom->setSUx( ux ); |
221 |
> |
dAtom->setSUy( uy ); |
222 |
> |
dAtom->setSUz( uz ); |
223 |
> |
} |
224 |
> |
else{ |
225 |
> |
molInfo.myAtoms[j] = new GeneralAtom( (j + atomOffset), |
226 |
> |
info[k].getConfiguration() ); |
227 |
> |
} |
228 |
> |
molInfo.myAtoms[j]->setType( currentAtom->getType() ); |
229 |
|
|
230 |
|
#ifdef IS_MPI |
231 |
|
|
232 |
< |
molInfo.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
232 |
> |
molInfo.myAtoms[j]->setGlobalIndex( globalIndex[j+atomOffset] ); |
233 |
|
|
234 |
|
#endif // is_mpi |
235 |
< |
} |
235 |
> |
} |
236 |
|
|
237 |
|
// make the bonds |
238 |
< |
for(j=0; j<molInfo.nBonds; j++){ |
238 |
> |
for(j=0; j<molInfo.nBonds; j++){ |
239 |
|
|
240 |
< |
currentBond = comp_stamps[stampID]->getBond( j ); |
241 |
< |
theBonds[j].a = currentBond->getA() + atomOffset; |
242 |
< |
theBonds[j].b = currentBond->getB() + atomOffset; |
243 |
< |
|
244 |
< |
exI = theBonds[j].a; |
245 |
< |
exJ = theBonds[j].b; |
246 |
< |
|
247 |
< |
// exclude_I must always be the smaller of the pair |
248 |
< |
if( exI > exJ ){ |
249 |
< |
tempEx = exI; |
250 |
< |
exI = exJ; |
251 |
< |
exJ = tempEx; |
252 |
< |
} |
240 |
> |
currentBond = comp_stamps[stampID]->getBond( j ); |
241 |
> |
theBonds[j].a = currentBond->getA() + atomOffset; |
242 |
> |
theBonds[j].b = currentBond->getB() + atomOffset; |
243 |
> |
|
244 |
> |
exI = theBonds[j].a; |
245 |
> |
exJ = theBonds[j].b; |
246 |
> |
|
247 |
> |
// exclude_I must always be the smaller of the pair |
248 |
> |
if( exI > exJ ){ |
249 |
> |
tempEx = exI; |
250 |
> |
exI = exJ; |
251 |
> |
exJ = tempEx; |
252 |
> |
} |
253 |
|
#ifdef IS_MPI |
254 |
< |
tempEx = exI; |
255 |
< |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
256 |
< |
tempEx = exJ; |
257 |
< |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
258 |
< |
|
259 |
< |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
254 |
> |
tempEx = exI; |
255 |
> |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
256 |
> |
tempEx = exJ; |
257 |
> |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
258 |
> |
|
259 |
> |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
260 |
|
#else // isn't MPI |
261 |
< |
|
262 |
< |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
261 |
> |
|
262 |
> |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
263 |
|
#endif //is_mpi |
264 |
< |
} |
265 |
< |
excludeOffset += molInfo.nBonds; |
248 |
< |
|
249 |
< |
//make the bends |
250 |
< |
for(j=0; j<molInfo.nBends; j++){ |
264 |
> |
} |
265 |
> |
excludeOffset += molInfo.nBonds; |
266 |
|
|
267 |
< |
currentBend = comp_stamps[stampID]->getBend( j ); |
268 |
< |
theBends[j].a = currentBend->getA() + atomOffset; |
269 |
< |
theBends[j].b = currentBend->getB() + atomOffset; |
270 |
< |
theBends[j].c = currentBend->getC() + atomOffset; |
267 |
> |
//make the bends |
268 |
> |
for(j=0; j<molInfo.nBends; j++){ |
269 |
> |
|
270 |
> |
currentBend = comp_stamps[stampID]->getBend( j ); |
271 |
> |
theBends[j].a = currentBend->getA() + atomOffset; |
272 |
> |
theBends[j].b = currentBend->getB() + atomOffset; |
273 |
> |
theBends[j].c = currentBend->getC() + atomOffset; |
274 |
> |
|
275 |
> |
if( currentBend->haveExtras() ){ |
276 |
|
|
277 |
< |
if( currentBend->haveExtras() ){ |
278 |
< |
|
279 |
< |
extras = currentBend->getExtras(); |
280 |
< |
current_extra = extras; |
281 |
< |
|
262 |
< |
while( current_extra != NULL ){ |
263 |
< |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
264 |
< |
|
265 |
< |
switch( current_extra->getType() ){ |
277 |
> |
extras = currentBend->getExtras(); |
278 |
> |
current_extra = extras; |
279 |
> |
|
280 |
> |
while( current_extra != NULL ){ |
281 |
> |
if( !strcmp( current_extra->getlhs(), "ghostVectorSource" )){ |
282 |
|
|
283 |
< |
case 0: |
284 |
< |
theBends[j].ghost = |
285 |
< |
current_extra->getInt() + atomOffset; |
286 |
< |
theBends[j].isGhost = 1; |
287 |
< |
break; |
288 |
< |
|
289 |
< |
case 1: |
290 |
< |
theBends[j].ghost = |
291 |
< |
(int)current_extra->getDouble() + atomOffset; |
292 |
< |
theBends[j].isGhost = 1; |
293 |
< |
break; |
294 |
< |
|
295 |
< |
default: |
283 |
> |
switch( current_extra->getType() ){ |
284 |
> |
|
285 |
> |
case 0: |
286 |
> |
theBends[j].ghost = |
287 |
> |
current_extra->getInt() + atomOffset; |
288 |
> |
theBends[j].isGhost = 1; |
289 |
> |
break; |
290 |
> |
|
291 |
> |
case 1: |
292 |
> |
theBends[j].ghost = |
293 |
> |
(int)current_extra->getDouble() + atomOffset; |
294 |
> |
theBends[j].isGhost = 1; |
295 |
> |
break; |
296 |
> |
|
297 |
> |
default: |
298 |
> |
sprintf( painCave.errMsg, |
299 |
> |
"SimSetup Error: ghostVectorSource was neither a " |
300 |
> |
"double nor an int.\n" |
301 |
> |
"-->Bend[%d] in %s\n", |
302 |
> |
j, comp_stamps[stampID]->getID() ); |
303 |
> |
painCave.isFatal = 1; |
304 |
> |
simError(); |
305 |
> |
} |
306 |
> |
} |
307 |
> |
|
308 |
> |
else{ |
309 |
> |
|
310 |
|
sprintf( painCave.errMsg, |
311 |
< |
"SimSetup Error: ghostVectorSource was neither a " |
312 |
< |
"double nor an int.\n" |
313 |
< |
"-->Bend[%d] in %s\n", |
311 |
> |
"SimSetup Error: unhandled bend assignment:\n" |
312 |
> |
" -->%s in Bend[%d] in %s\n", |
313 |
> |
current_extra->getlhs(), |
314 |
|
j, comp_stamps[stampID]->getID() ); |
315 |
|
painCave.isFatal = 1; |
316 |
|
simError(); |
317 |
|
} |
288 |
– |
} |
289 |
– |
|
290 |
– |
else{ |
318 |
|
|
319 |
< |
sprintf( painCave.errMsg, |
293 |
< |
"SimSetup Error: unhandled bend assignment:\n" |
294 |
< |
" -->%s in Bend[%d] in %s\n", |
295 |
< |
current_extra->getlhs(), |
296 |
< |
j, comp_stamps[stampID]->getID() ); |
297 |
< |
painCave.isFatal = 1; |
298 |
< |
simError(); |
319 |
> |
current_extra = current_extra->getNext(); |
320 |
|
} |
321 |
+ |
} |
322 |
+ |
|
323 |
+ |
if( !theBends[j].isGhost ){ |
324 |
|
|
325 |
< |
current_extra = current_extra->getNext(); |
325 |
> |
exI = theBends[j].a; |
326 |
> |
exJ = theBends[j].c; |
327 |
|
} |
328 |
< |
} |
328 |
> |
else{ |
329 |
|
|
330 |
< |
if( !theBends[j].isGhost ){ |
331 |
< |
|
332 |
< |
exI = theBends[j].a; |
308 |
< |
exJ = theBends[j].c; |
309 |
< |
} |
310 |
< |
else{ |
330 |
> |
exI = theBends[j].a; |
331 |
> |
exJ = theBends[j].b; |
332 |
> |
} |
333 |
|
|
334 |
< |
exI = theBends[j].a; |
335 |
< |
exJ = theBends[j].b; |
336 |
< |
} |
337 |
< |
|
338 |
< |
// exclude_I must always be the smaller of the pair |
339 |
< |
if( exI > exJ ){ |
334 |
> |
// exclude_I must always be the smaller of the pair |
335 |
> |
if( exI > exJ ){ |
336 |
> |
tempEx = exI; |
337 |
> |
exI = exJ; |
338 |
> |
exJ = tempEx; |
339 |
> |
} |
340 |
> |
#ifdef IS_MPI |
341 |
|
tempEx = exI; |
342 |
< |
exI = exJ; |
343 |
< |
exJ = tempEx; |
342 |
> |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
343 |
> |
tempEx = exJ; |
344 |
> |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
345 |
> |
|
346 |
> |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
347 |
> |
#else // isn't MPI |
348 |
> |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
349 |
> |
#endif //is_mpi |
350 |
|
} |
351 |
< |
#ifdef IS_MPI |
323 |
< |
tempEx = exI; |
324 |
< |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
325 |
< |
tempEx = exJ; |
326 |
< |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
351 |
> |
excludeOffset += molInfo.nBends; |
352 |
|
|
353 |
< |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
353 |
> |
for(j=0; j<molInfo.nTorsions; j++){ |
354 |
> |
|
355 |
> |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
356 |
> |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
357 |
> |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
358 |
> |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
359 |
> |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
360 |
> |
|
361 |
> |
exI = theTorsions[j].a; |
362 |
> |
exJ = theTorsions[j].d; |
363 |
> |
|
364 |
> |
// exclude_I must always be the smaller of the pair |
365 |
> |
if( exI > exJ ){ |
366 |
> |
tempEx = exI; |
367 |
> |
exI = exJ; |
368 |
> |
exJ = tempEx; |
369 |
> |
} |
370 |
> |
#ifdef IS_MPI |
371 |
> |
tempEx = exI; |
372 |
> |
exI = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
373 |
> |
tempEx = exJ; |
374 |
> |
exJ = info[k].atoms[tempEx]->getGlobalIndex() + 1; |
375 |
> |
|
376 |
> |
info[k].excludes[j+excludeOffset]->setPair( exI, exJ ); |
377 |
|
#else // isn't MPI |
378 |
< |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
378 |
> |
info[k].excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
379 |
|
#endif //is_mpi |
380 |
< |
} |
381 |
< |
excludeOffset += molInfo.nBends; |
334 |
< |
|
335 |
< |
for(j=0; j<molInfo.nTorsions; j++){ |
380 |
> |
} |
381 |
> |
excludeOffset += molInfo.nTorsions; |
382 |
|
|
337 |
– |
currentTorsion = comp_stamps[stampID]->getTorsion( j ); |
338 |
– |
theTorsions[j].a = currentTorsion->getA() + atomOffset; |
339 |
– |
theTorsions[j].b = currentTorsion->getB() + atomOffset; |
340 |
– |
theTorsions[j].c = currentTorsion->getC() + atomOffset; |
341 |
– |
theTorsions[j].d = currentTorsion->getD() + atomOffset; |
383 |
|
|
384 |
< |
exI = theTorsions[j].a; |
385 |
< |
exJ = theTorsions[j].d; |
384 |
> |
// send the arrays off to the forceField for init. |
385 |
> |
|
386 |
> |
the_ff->initializeAtoms( molInfo.nAtoms, molInfo.myAtoms ); |
387 |
> |
the_ff->initializeBonds( molInfo.nBonds, molInfo.myBonds, theBonds ); |
388 |
> |
the_ff->initializeBends( molInfo.nBends, molInfo.myBends, theBends ); |
389 |
> |
the_ff->initializeTorsions( molInfo.nTorsions, molInfo.myTorsions, theTorsions ); |
390 |
> |
|
391 |
> |
|
392 |
> |
info[k].molecules[i].initialize( molInfo ); |
393 |
|
|
346 |
– |
// exclude_I must always be the smaller of the pair |
347 |
– |
if( exI > exJ ){ |
348 |
– |
tempEx = exI; |
349 |
– |
exI = exJ; |
350 |
– |
exJ = tempEx; |
351 |
– |
} |
352 |
– |
#ifdef IS_MPI |
353 |
– |
tempEx = exI; |
354 |
– |
exI = the_atoms[tempEx]->getGlobalIndex() + 1; |
355 |
– |
tempEx = exJ; |
356 |
– |
exJ = the_atoms[tempEx]->getGlobalIndex() + 1; |
394 |
|
|
395 |
< |
the_excludes[j+excludeOffset]->setPair( exI, exJ ); |
396 |
< |
#else // isn't MPI |
397 |
< |
the_excludes[j+excludeOffset]->setPair( (exI+1), (exJ+1) ); |
398 |
< |
#endif //is_mpi |
395 |
> |
atomOffset += molInfo.nAtoms; |
396 |
> |
delete[] theBonds; |
397 |
> |
delete[] theBends; |
398 |
> |
delete[] theTorsions; |
399 |
|
} |
363 |
– |
excludeOffset += molInfo.nTorsions; |
364 |
– |
|
365 |
– |
|
366 |
– |
// send the arrays off to the forceField for init. |
367 |
– |
|
368 |
– |
the_ff->initializeAtoms( molInfo.nAtoms, molInfo.myAtoms ); |
369 |
– |
the_ff->initializeBonds( molInfo.nBonds, molInfo.myBonds, theBonds ); |
370 |
– |
the_ff->initializeBends( molInfo.nBends, molInfo.myBends, theBends ); |
371 |
– |
the_ff->initializeTorsions( molInfo.nTorsions, molInfo.myTorsions, theTorsions ); |
372 |
– |
|
373 |
– |
|
374 |
– |
the_molecules[i].initialize( molInfo ); |
375 |
– |
|
376 |
– |
|
377 |
– |
atomOffset += molInfo.nAtoms; |
378 |
– |
delete[] theBonds; |
379 |
– |
delete[] theBends; |
380 |
– |
delete[] theTorsions; |
400 |
|
} |
401 |
< |
|
401 |
> |
|
402 |
|
#ifdef IS_MPI |
403 |
|
sprintf( checkPointMsg, "all molecules initialized succesfully" ); |
404 |
|
MPIcheckPoint(); |
405 |
|
#endif // is_mpi |
406 |
< |
|
406 |
> |
|
407 |
|
// clean up the forcefield |
408 |
+ |
|
409 |
|
the_ff->calcRcut(); |
410 |
|
the_ff->cleanMe(); |
411 |
< |
|
411 |
> |
|
412 |
|
} |
413 |
|
|
414 |
|
void SimSetup::initFromBass( void ){ |
421 |
|
int n_extra; |
422 |
|
int have_extra, done; |
423 |
|
|
424 |
+ |
double vel[3]; |
425 |
+ |
vel[0] = 0.0; |
426 |
+ |
vel[1] = 0.0; |
427 |
+ |
vel[2] = 0.0; |
428 |
+ |
|
429 |
|
temp1 = (double)tot_nmol / 4.0; |
430 |
|
temp2 = pow( temp1, ( 1.0 / 3.0 ) ); |
431 |
|
temp3 = ceil( temp2 ); |
435 |
|
have_extra =1; |
436 |
|
|
437 |
|
n_cells = (int)temp3 - 1; |
438 |
< |
cellx = info->boxL[0] / temp3; |
439 |
< |
celly = info->boxL[1] / temp3; |
440 |
< |
cellz = info->boxL[2] / temp3; |
438 |
> |
cellx = info[0].boxL[0] / temp3; |
439 |
> |
celly = info[0].boxL[1] / temp3; |
440 |
> |
cellz = info[0].boxL[2] / temp3; |
441 |
|
n_extra = tot_nmol - ( 4 * n_cells * n_cells * n_cells ); |
442 |
|
temp1 = ((double)n_extra) / ( pow( temp3, 3.0 ) - pow( n_cells, 3.0 ) ); |
443 |
|
n_per_extra = (int)ceil( temp1 ); |
452 |
|
} |
453 |
|
else{ |
454 |
|
n_cells = (int)temp3; |
455 |
< |
cellx = info->boxL[0] / temp3; |
456 |
< |
celly = info->boxL[1] / temp3; |
457 |
< |
cellz = info->boxL[2] / temp3; |
455 |
> |
cellx = info[0].boxL[0] / temp3; |
456 |
> |
celly = info[0].boxL[1] / temp3; |
457 |
> |
cellz = info[0].boxL[2] / temp3; |
458 |
|
} |
459 |
|
|
460 |
|
current_mol = 0; |
533 |
|
} |
534 |
|
} |
535 |
|
|
536 |
< |
|
537 |
< |
for( i=0; i<info->n_atoms; i++ ){ |
513 |
< |
info->atoms[i]->set_vx( 0.0 ); |
514 |
< |
info->atoms[i]->set_vy( 0.0 ); |
515 |
< |
info->atoms[i]->set_vz( 0.0 ); |
536 |
> |
for( i=0; i<info[0].n_atoms; i++ ){ |
537 |
> |
info[0].atoms[i]->setVel( vel ); |
538 |
|
} |
539 |
|
} |
540 |
|
|
544 |
|
AtomStamp* current_atom; |
545 |
|
DirectionalAtom* dAtom; |
546 |
|
double rotMat[3][3]; |
547 |
+ |
double pos[3]; |
548 |
|
|
549 |
|
for( k=0; k<comp_stamps[current_comp]->getNAtoms(); k++ ){ |
550 |
|
|
560 |
|
painCave.isFatal = 1; |
561 |
|
simError(); |
562 |
|
} |
563 |
+ |
|
564 |
+ |
pos[0] = x + current_atom->getPosX(); |
565 |
+ |
pos[1] = y + current_atom->getPosY(); |
566 |
+ |
pos[2] = z + current_atom->getPosZ(); |
567 |
+ |
|
568 |
+ |
info[0].atoms[current_atom_ndx]->setPos( pos ); |
569 |
|
|
570 |
< |
the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() ); |
542 |
< |
the_atoms[current_atom_ndx]->setY( y + current_atom->getPosY() ); |
543 |
< |
the_atoms[current_atom_ndx]->setZ( z + current_atom->getPosZ() ); |
570 |
> |
if( info[0].atoms[current_atom_ndx]->isDirectional() ){ |
571 |
|
|
572 |
< |
if( the_atoms[current_atom_ndx]->isDirectional() ){ |
572 |
> |
dAtom = (DirectionalAtom *)info[0].atoms[current_atom_ndx]; |
573 |
|
|
547 |
– |
dAtom = (DirectionalAtom *)the_atoms[current_atom_ndx]; |
548 |
– |
|
574 |
|
rotMat[0][0] = 1.0; |
575 |
|
rotMat[0][1] = 0.0; |
576 |
|
rotMat[0][2] = 0.0; |
606 |
|
ensembleCase = -1; |
607 |
|
ffCase = -1; |
608 |
|
|
584 |
– |
// get the stamps and globals; |
585 |
– |
stamps = stamps; |
586 |
– |
globals = globals; |
587 |
– |
|
609 |
|
// set the easy ones first |
610 |
< |
info->target_temp = globals->getTargetTemp(); |
611 |
< |
info->dt = globals->getDt(); |
612 |
< |
info->run_time = globals->getRunTime(); |
610 |
> |
|
611 |
> |
for( i=0; i<nInfo; i++){ |
612 |
> |
info[i].target_temp = globals->getTargetTemp(); |
613 |
> |
info[i].dt = globals->getDt(); |
614 |
> |
info[i].run_time = globals->getRunTime(); |
615 |
> |
} |
616 |
|
n_components = globals->getNComponents(); |
617 |
|
|
618 |
|
|
652 |
|
strcpy( ensemble, "NVE" ); |
653 |
|
ensembleCase = NVE_ENS; |
654 |
|
} |
655 |
< |
strcpy( info->ensemble, ensemble ); |
655 |
> |
|
656 |
> |
for(i=0; i<nInfo; i++){ |
657 |
> |
|
658 |
> |
strcpy( info[i].ensemble, ensemble ); |
659 |
|
|
660 |
< |
// get the mixing rule |
660 |
> |
// get the mixing rule |
661 |
|
|
662 |
< |
strcpy( info->mixingRule, globals->getMixingRule() ); |
663 |
< |
info->usePBC = globals->getPBC(); |
664 |
< |
|
662 |
> |
strcpy( info[i].mixingRule, globals->getMixingRule() ); |
663 |
> |
info[i].usePBC = globals->getPBC(); |
664 |
> |
} |
665 |
|
|
666 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
667 |
|
|
702 |
|
|
703 |
|
// set the status, sample, and thermal kick times |
704 |
|
|
705 |
< |
if( globals->haveSampleTime() ){ |
679 |
< |
info->sampleTime = globals->getSampleTime(); |
680 |
< |
info->statusTime = info->sampleTime; |
681 |
< |
info->thermalTime = info->sampleTime; |
682 |
< |
} |
683 |
< |
else{ |
684 |
< |
info->sampleTime = globals->getRunTime(); |
685 |
< |
info->statusTime = info->sampleTime; |
686 |
< |
info->thermalTime = info->sampleTime; |
687 |
< |
} |
705 |
> |
for(i=0; i<nInfo; i++){ |
706 |
|
|
707 |
< |
if( globals->haveStatusTime() ){ |
708 |
< |
info->statusTime = globals->getStatusTime(); |
709 |
< |
} |
707 |
> |
if( globals->haveSampleTime() ){ |
708 |
> |
info[i].sampleTime = globals->getSampleTime(); |
709 |
> |
info[i].statusTime = info[i].sampleTime; |
710 |
> |
info[i].thermalTime = info[i].sampleTime; |
711 |
> |
} |
712 |
> |
else{ |
713 |
> |
info[i].sampleTime = globals->getRunTime(); |
714 |
> |
info[i].statusTime = info[i].sampleTime; |
715 |
> |
info[i].thermalTime = info[i].sampleTime; |
716 |
> |
} |
717 |
> |
|
718 |
> |
if( globals->haveStatusTime() ){ |
719 |
> |
info[i].statusTime = globals->getStatusTime(); |
720 |
> |
} |
721 |
> |
|
722 |
> |
if( globals->haveThermalTime() ){ |
723 |
> |
info[i].thermalTime = globals->getThermalTime(); |
724 |
> |
} |
725 |
|
|
726 |
< |
if( globals->haveThermalTime() ){ |
694 |
< |
info->thermalTime = globals->getThermalTime(); |
695 |
< |
} |
726 |
> |
// check for the temperature set flag |
727 |
|
|
728 |
< |
// check for the temperature set flag |
698 |
< |
|
699 |
< |
if( globals->haveTempSet() ) info->setTemp = globals->getTempSet(); |
700 |
< |
|
701 |
< |
// get some of the tricky things that may still be in the globals |
702 |
< |
|
703 |
< |
double boxVector[3]; |
704 |
< |
if( globals->haveBox() ){ |
705 |
< |
boxVector[0] = globals->getBox(); |
706 |
< |
boxVector[1] = globals->getBox(); |
707 |
< |
boxVector[2] = globals->getBox(); |
728 |
> |
if( globals->haveTempSet() ) info[i].setTemp = globals->getTempSet(); |
729 |
|
|
730 |
< |
info->setBox( boxVector ); |
730 |
> |
// get some of the tricky things that may still be in the globals |
731 |
> |
|
732 |
> |
double boxVector[3]; |
733 |
> |
if( globals->haveBox() ){ |
734 |
> |
boxVector[0] = globals->getBox(); |
735 |
> |
boxVector[1] = globals->getBox(); |
736 |
> |
boxVector[2] = globals->getBox(); |
737 |
> |
|
738 |
> |
info[i].setBox( boxVector ); |
739 |
> |
} |
740 |
> |
else if( globals->haveDensity() ){ |
741 |
> |
|
742 |
> |
double vol; |
743 |
> |
vol = (double)tot_nmol / globals->getDensity(); |
744 |
> |
boxVector[0] = pow( vol, ( 1.0 / 3.0 ) ); |
745 |
> |
boxVector[1] = boxVector[0]; |
746 |
> |
boxVector[2] = boxVector[0]; |
747 |
> |
|
748 |
> |
info[i].setBox( boxVector ); |
749 |
|
} |
750 |
< |
else if( globals->haveDensity() ){ |
751 |
< |
|
752 |
< |
double vol; |
753 |
< |
vol = (double)tot_nmol / globals->getDensity(); |
754 |
< |
boxVector[0] = pow( vol, ( 1.0 / 3.0 ) ); |
755 |
< |
boxVector[1] = boxVector[0]; |
756 |
< |
boxVector[2] = boxVector[0]; |
757 |
< |
|
758 |
< |
info->setBox( boxVector ); |
759 |
< |
} |
760 |
< |
else{ |
761 |
< |
if( !globals->haveBoxX() ){ |
762 |
< |
sprintf( painCave.errMsg, |
763 |
< |
"SimSetup error, no periodic BoxX size given.\n" ); |
764 |
< |
painCave.isFatal = 1; |
765 |
< |
simError(); |
750 |
> |
else{ |
751 |
> |
if( !globals->haveBoxX() ){ |
752 |
> |
sprintf( painCave.errMsg, |
753 |
> |
"SimSetup error, no periodic BoxX size given.\n" ); |
754 |
> |
painCave.isFatal = 1; |
755 |
> |
simError(); |
756 |
> |
} |
757 |
> |
boxVector[0] = globals->getBoxX(); |
758 |
> |
|
759 |
> |
if( !globals->haveBoxY() ){ |
760 |
> |
sprintf( painCave.errMsg, |
761 |
> |
"SimSetup error, no periodic BoxY size given.\n" ); |
762 |
> |
painCave.isFatal = 1; |
763 |
> |
simError(); |
764 |
> |
} |
765 |
> |
boxVector[1] = globals->getBoxY(); |
766 |
> |
|
767 |
> |
if( !globals->haveBoxZ() ){ |
768 |
> |
sprintf( painCave.errMsg, |
769 |
> |
"SimSetup error, no periodic BoxZ size given.\n" ); |
770 |
> |
painCave.isFatal = 1; |
771 |
> |
simError(); |
772 |
> |
} |
773 |
> |
boxVector[2] = globals->getBoxZ(); |
774 |
> |
|
775 |
> |
info[i].setBox( boxVector ); |
776 |
|
} |
728 |
– |
boxVector[0] = globals->getBoxX(); |
777 |
|
|
730 |
– |
if( !globals->haveBoxY() ){ |
731 |
– |
sprintf( painCave.errMsg, |
732 |
– |
"SimSetup error, no periodic BoxY size given.\n" ); |
733 |
– |
painCave.isFatal = 1; |
734 |
– |
simError(); |
735 |
– |
} |
736 |
– |
boxVector[1] = globals->getBoxY(); |
737 |
– |
|
738 |
– |
if( !globals->haveBoxZ() ){ |
739 |
– |
sprintf( painCave.errMsg, |
740 |
– |
"SimSetup error, no periodic BoxZ size given.\n" ); |
741 |
– |
painCave.isFatal = 1; |
742 |
– |
simError(); |
743 |
– |
} |
744 |
– |
boxVector[2] = globals->getBoxZ(); |
745 |
– |
|
746 |
– |
info->setBox( boxVector ); |
778 |
|
} |
748 |
– |
|
749 |
– |
|
779 |
|
|
780 |
|
#ifdef IS_MPI |
781 |
|
strcpy( checkPointMsg, "Succesfully gathered all information from Bass\n" ); |
788 |
|
void SimSetup::finalInfoCheck( void ){ |
789 |
|
int index; |
790 |
|
int usesDipoles; |
791 |
< |
|
791 |
> |
int i; |
792 |
|
|
793 |
< |
// check electrostatic parameters |
794 |
< |
|
795 |
< |
index = 0; |
796 |
< |
usesDipoles = 0; |
797 |
< |
while( (index < info->n_atoms) && !usesDipoles ){ |
798 |
< |
usesDipoles = ((info->atoms)[index])->hasDipole(); |
799 |
< |
index++; |
800 |
< |
} |
801 |
< |
|
793 |
> |
for(i=0; i<nInfo; i++){ |
794 |
> |
// check electrostatic parameters |
795 |
> |
|
796 |
> |
index = 0; |
797 |
> |
usesDipoles = 0; |
798 |
> |
while( (index < info[i].n_atoms) && !usesDipoles ){ |
799 |
> |
usesDipoles = (info[i].atoms[index])->hasDipole(); |
800 |
> |
index++; |
801 |
> |
} |
802 |
> |
|
803 |
|
#ifdef IS_MPI |
804 |
< |
int myUse = usesDipoles; |
805 |
< |
MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
804 |
> |
int myUse = usesDipoles; |
805 |
> |
MPI_Allreduce( &myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
806 |
|
#endif //is_mpi |
777 |
– |
|
778 |
– |
double theEcr, theEst; |
779 |
– |
|
780 |
– |
if (globals->getUseRF() ) { |
781 |
– |
info->useReactionField = 1; |
807 |
|
|
808 |
< |
if( !globals->haveECR() ){ |
809 |
< |
sprintf( painCave.errMsg, |
810 |
< |
"SimSetup Warning: using default value of 1/2 the smallest " |
811 |
< |
"box length for the electrostaticCutoffRadius.\n" |
787 |
< |
"I hope you have a very fast processor!\n"); |
788 |
< |
painCave.isFatal = 0; |
789 |
< |
simError(); |
790 |
< |
double smallest; |
791 |
< |
smallest = info->boxL[0]; |
792 |
< |
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
793 |
< |
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
794 |
< |
theEcr = 0.5 * smallest; |
795 |
< |
} else { |
796 |
< |
theEcr = globals->getECR(); |
797 |
< |
} |
798 |
< |
|
799 |
< |
if( !globals->haveEST() ){ |
800 |
< |
sprintf( painCave.errMsg, |
801 |
< |
"SimSetup Warning: using default value of 0.05 * the " |
802 |
< |
"electrostaticCutoffRadius for the electrostaticSkinThickness\n" |
803 |
< |
); |
804 |
< |
painCave.isFatal = 0; |
805 |
< |
simError(); |
806 |
< |
theEst = 0.05 * theEcr; |
807 |
< |
} else { |
808 |
< |
theEst= globals->getEST(); |
809 |
< |
} |
810 |
< |
|
811 |
< |
info->setEcr( theEcr, theEst ); |
812 |
< |
|
813 |
< |
if(!globals->haveDielectric() ){ |
814 |
< |
sprintf( painCave.errMsg, |
815 |
< |
"SimSetup Error: You are trying to use Reaction Field without" |
816 |
< |
"setting a dielectric constant!\n" |
817 |
< |
); |
818 |
< |
painCave.isFatal = 1; |
819 |
< |
simError(); |
820 |
< |
} |
821 |
< |
info->dielectric = globals->getDielectric(); |
822 |
< |
} |
823 |
< |
else { |
824 |
< |
if (usesDipoles) { |
808 |
> |
double theEcr, theEst; |
809 |
> |
|
810 |
> |
if (globals->getUseRF() ) { |
811 |
> |
info[i].useReactionField = 1; |
812 |
|
|
813 |
|
if( !globals->haveECR() ){ |
814 |
|
sprintf( painCave.errMsg, |
818 |
|
painCave.isFatal = 0; |
819 |
|
simError(); |
820 |
|
double smallest; |
821 |
< |
smallest = info->boxL[0]; |
822 |
< |
if (info->boxL[1] <= smallest) smallest = info->boxL[1]; |
823 |
< |
if (info->boxL[2] <= smallest) smallest = info->boxL[2]; |
821 |
> |
smallest = info[i].boxL[0]; |
822 |
> |
if (info[i].boxL[1] <= smallest) smallest = info[i].boxL[1]; |
823 |
> |
if (info[i].boxL[2] <= smallest) smallest = info[i].boxL[2]; |
824 |
|
theEcr = 0.5 * smallest; |
825 |
|
} else { |
826 |
|
theEcr = globals->getECR(); |
829 |
|
if( !globals->haveEST() ){ |
830 |
|
sprintf( painCave.errMsg, |
831 |
|
"SimSetup Warning: using default value of 0.05 * the " |
832 |
< |
"electrostaticCutoffRadius for the " |
846 |
< |
"electrostaticSkinThickness\n" |
832 |
> |
"electrostaticCutoffRadius for the electrostaticSkinThickness\n" |
833 |
|
); |
834 |
|
painCave.isFatal = 0; |
835 |
|
simError(); |
837 |
|
} else { |
838 |
|
theEst= globals->getEST(); |
839 |
|
} |
840 |
+ |
|
841 |
+ |
info[i].setEcr( theEcr, theEst ); |
842 |
+ |
|
843 |
+ |
if(!globals->haveDielectric() ){ |
844 |
+ |
sprintf( painCave.errMsg, |
845 |
+ |
"SimSetup Error: You are trying to use Reaction Field without" |
846 |
+ |
"setting a dielectric constant!\n" |
847 |
+ |
); |
848 |
+ |
painCave.isFatal = 1; |
849 |
+ |
simError(); |
850 |
+ |
} |
851 |
+ |
info[i].dielectric = globals->getDielectric(); |
852 |
+ |
} |
853 |
+ |
else { |
854 |
+ |
if (usesDipoles) { |
855 |
+ |
|
856 |
+ |
if( !globals->haveECR() ){ |
857 |
+ |
sprintf( painCave.errMsg, |
858 |
+ |
"SimSetup Warning: using default value of 1/2 the smallest " |
859 |
+ |
"box length for the electrostaticCutoffRadius.\n" |
860 |
+ |
"I hope you have a very fast processor!\n"); |
861 |
+ |
painCave.isFatal = 0; |
862 |
+ |
simError(); |
863 |
+ |
double smallest; |
864 |
+ |
smallest = info[i].boxL[0]; |
865 |
+ |
if (info[i].boxL[1] <= smallest) smallest = info[i].boxL[1]; |
866 |
+ |
if (info[i].boxL[2] <= smallest) smallest = info[i].boxL[2]; |
867 |
+ |
theEcr = 0.5 * smallest; |
868 |
+ |
} else { |
869 |
+ |
theEcr = globals->getECR(); |
870 |
+ |
} |
871 |
+ |
|
872 |
+ |
if( !globals->haveEST() ){ |
873 |
+ |
sprintf( painCave.errMsg, |
874 |
+ |
"SimSetup Warning: using default value of 0.05 * the " |
875 |
+ |
"electrostaticCutoffRadius for the " |
876 |
+ |
"electrostaticSkinThickness\n" |
877 |
+ |
); |
878 |
+ |
painCave.isFatal = 0; |
879 |
+ |
simError(); |
880 |
+ |
theEst = 0.05 * theEcr; |
881 |
+ |
} else { |
882 |
+ |
theEst= globals->getEST(); |
883 |
+ |
} |
884 |
+ |
|
885 |
+ |
info[i].setEcr( theEcr, theEst ); |
886 |
+ |
} |
887 |
+ |
} |
888 |
+ |
} |
889 |
|
|
855 |
– |
info->setEcr( theEcr, theEst ); |
856 |
– |
} |
857 |
– |
} |
858 |
– |
|
890 |
|
#ifdef IS_MPI |
891 |
|
strcpy( checkPointMsg, "post processing checks out" ); |
892 |
|
MPIcheckPoint(); |
895 |
|
} |
896 |
|
|
897 |
|
void SimSetup::initSystemCoords( void ){ |
898 |
+ |
int i; |
899 |
+ |
|
900 |
+ |
char* inName; |
901 |
|
|
902 |
< |
if( globals->haveInitialConfig() ){ |
903 |
< |
|
904 |
< |
InitializeFromFile* fileInit; |
902 |
> |
std::cerr << "Setting atom Coords\n"; |
903 |
> |
|
904 |
> |
(info[0].getConfiguration())->createArrays( info[0].n_atoms ); |
905 |
> |
|
906 |
> |
for(i=0; i<info[0].n_atoms; i++) info[0].atoms[i]->setCoords(); |
907 |
> |
|
908 |
> |
if( globals->haveInitialConfig() ){ |
909 |
> |
|
910 |
> |
InitializeFromFile* fileInit; |
911 |
|
#ifdef IS_MPI // is_mpi |
912 |
< |
if( worldRank == 0 ){ |
912 |
> |
if( worldRank == 0 ){ |
913 |
|
#endif //is_mpi |
914 |
< |
fileInit = new InitializeFromFile( globals->getInitialConfig() ); |
914 |
> |
inName = globals->getInitialConfig(); |
915 |
> |
fileInit = new InitializeFromFile( inName ); |
916 |
|
#ifdef IS_MPI |
917 |
< |
}else fileInit = new InitializeFromFile( NULL ); |
917 |
> |
}else fileInit = new InitializeFromFile( NULL ); |
918 |
|
#endif |
919 |
< |
fileInit->readInit( info ); // default velocities on |
920 |
< |
|
921 |
< |
delete fileInit; |
922 |
< |
} |
923 |
< |
else{ |
924 |
< |
|
919 |
> |
fileInit->readInit( info ); // default velocities on |
920 |
> |
|
921 |
> |
delete fileInit; |
922 |
> |
} |
923 |
> |
else{ |
924 |
> |
|
925 |
|
#ifdef IS_MPI |
926 |
< |
|
927 |
< |
// no init from bass |
928 |
< |
|
929 |
< |
sprintf( painCave.errMsg, |
930 |
< |
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
931 |
< |
painCave.isFatal; |
932 |
< |
simError(); |
933 |
< |
|
926 |
> |
|
927 |
> |
// no init from bass |
928 |
> |
|
929 |
> |
sprintf( painCave.errMsg, |
930 |
> |
"Cannot intialize a parallel simulation without an initial configuration file.\n" ); |
931 |
> |
painCave.isFatal; |
932 |
> |
simError(); |
933 |
> |
|
934 |
|
#else |
935 |
< |
|
936 |
< |
initFromBass(); |
937 |
< |
|
938 |
< |
|
935 |
> |
|
936 |
> |
initFromBass(); |
937 |
> |
|
938 |
> |
|
939 |
|
#endif |
940 |
< |
} |
941 |
< |
|
940 |
> |
} |
941 |
> |
|
942 |
|
#ifdef IS_MPI |
943 |
|
strcpy( checkPointMsg, "Successfully read in the initial configuration" ); |
944 |
|
MPIcheckPoint(); |
945 |
|
#endif // is_mpi |
946 |
< |
|
946 |
> |
|
947 |
|
} |
948 |
|
|
949 |
|
|
950 |
|
void SimSetup::makeOutNames( void ){ |
951 |
+ |
|
952 |
+ |
int k; |
953 |
|
|
954 |
+ |
|
955 |
+ |
for(k=0; k<nInfo; k++){ |
956 |
+ |
|
957 |
|
#ifdef IS_MPI |
958 |
< |
if( worldRank == 0 ){ |
958 |
> |
if( worldRank == 0 ){ |
959 |
|
#endif // is_mpi |
960 |
< |
|
961 |
< |
if( globals->haveFinalConfig() ){ |
962 |
< |
strcpy( info->finalName, globals->getFinalConfig() ); |
917 |
< |
} |
918 |
< |
else{ |
919 |
< |
strcpy( info->finalName, inFileName ); |
920 |
< |
char* endTest; |
921 |
< |
int nameLength = strlen( info->finalName ); |
922 |
< |
endTest = &(info->finalName[nameLength - 5]); |
923 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
924 |
< |
strcpy( endTest, ".eor" ); |
960 |
> |
|
961 |
> |
if( globals->haveFinalConfig() ){ |
962 |
> |
strcpy( info[k].finalName, globals->getFinalConfig() ); |
963 |
|
} |
926 |
– |
else if( !strcmp( endTest, ".BASS" ) ){ |
927 |
– |
strcpy( endTest, ".eor" ); |
928 |
– |
} |
964 |
|
else{ |
965 |
< |
endTest = &(info->finalName[nameLength - 4]); |
966 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
965 |
> |
strcpy( info[k].finalName, inFileName ); |
966 |
> |
char* endTest; |
967 |
> |
int nameLength = strlen( info[k].finalName ); |
968 |
> |
endTest = &(info[k].finalName[nameLength - 5]); |
969 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
970 |
|
strcpy( endTest, ".eor" ); |
971 |
|
} |
972 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
972 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
973 |
|
strcpy( endTest, ".eor" ); |
974 |
|
} |
975 |
|
else{ |
976 |
< |
strcat( info->finalName, ".eor" ); |
976 |
> |
endTest = &(info[k].finalName[nameLength - 4]); |
977 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
978 |
> |
strcpy( endTest, ".eor" ); |
979 |
> |
} |
980 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
981 |
> |
strcpy( endTest, ".eor" ); |
982 |
> |
} |
983 |
> |
else{ |
984 |
> |
strcat( info[k].finalName, ".eor" ); |
985 |
> |
} |
986 |
|
} |
987 |
|
} |
988 |
< |
} |
989 |
< |
|
990 |
< |
// make the sample and status out names |
991 |
< |
|
992 |
< |
strcpy( info->sampleName, inFileName ); |
993 |
< |
char* endTest; |
994 |
< |
int nameLength = strlen( info->sampleName ); |
995 |
< |
endTest = &(info->sampleName[nameLength - 5]); |
949 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
950 |
< |
strcpy( endTest, ".dump" ); |
951 |
< |
} |
952 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
953 |
< |
strcpy( endTest, ".dump" ); |
954 |
< |
} |
955 |
< |
else{ |
956 |
< |
endTest = &(info->sampleName[nameLength - 4]); |
957 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
988 |
> |
|
989 |
> |
// make the sample and status out names |
990 |
> |
|
991 |
> |
strcpy( info[k].sampleName, inFileName ); |
992 |
> |
char* endTest; |
993 |
> |
int nameLength = strlen( info[k].sampleName ); |
994 |
> |
endTest = &(info[k].sampleName[nameLength - 5]); |
995 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
996 |
|
strcpy( endTest, ".dump" ); |
997 |
|
} |
998 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
998 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
999 |
|
strcpy( endTest, ".dump" ); |
1000 |
|
} |
1001 |
|
else{ |
1002 |
< |
strcat( info->sampleName, ".dump" ); |
1002 |
> |
endTest = &(info[k].sampleName[nameLength - 4]); |
1003 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
1004 |
> |
strcpy( endTest, ".dump" ); |
1005 |
> |
} |
1006 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
1007 |
> |
strcpy( endTest, ".dump" ); |
1008 |
> |
} |
1009 |
> |
else{ |
1010 |
> |
strcat( info[k].sampleName, ".dump" ); |
1011 |
> |
} |
1012 |
|
} |
1013 |
< |
} |
1014 |
< |
|
1015 |
< |
strcpy( info->statusName, inFileName ); |
1016 |
< |
nameLength = strlen( info->statusName ); |
1017 |
< |
endTest = &(info->statusName[nameLength - 5]); |
971 |
< |
if( !strcmp( endTest, ".bass" ) ){ |
972 |
< |
strcpy( endTest, ".stat" ); |
973 |
< |
} |
974 |
< |
else if( !strcmp( endTest, ".BASS" ) ){ |
975 |
< |
strcpy( endTest, ".stat" ); |
976 |
< |
} |
977 |
< |
else{ |
978 |
< |
endTest = &(info->statusName[nameLength - 4]); |
979 |
< |
if( !strcmp( endTest, ".bss" ) ){ |
1013 |
> |
|
1014 |
> |
strcpy( info[k].statusName, inFileName ); |
1015 |
> |
nameLength = strlen( info[k].statusName ); |
1016 |
> |
endTest = &(info[k].statusName[nameLength - 5]); |
1017 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
1018 |
|
strcpy( endTest, ".stat" ); |
1019 |
|
} |
1020 |
< |
else if( !strcmp( endTest, ".mdl" ) ){ |
1020 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
1021 |
|
strcpy( endTest, ".stat" ); |
1022 |
|
} |
1023 |
|
else{ |
1024 |
< |
strcat( info->statusName, ".stat" ); |
1024 |
> |
endTest = &(info[k].statusName[nameLength - 4]); |
1025 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
1026 |
> |
strcpy( endTest, ".stat" ); |
1027 |
> |
} |
1028 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
1029 |
> |
strcpy( endTest, ".stat" ); |
1030 |
> |
} |
1031 |
> |
else{ |
1032 |
> |
strcat( info[k].statusName, ".stat" ); |
1033 |
> |
} |
1034 |
|
} |
1035 |
< |
} |
989 |
< |
|
1035 |
> |
|
1036 |
|
#ifdef IS_MPI |
1037 |
< |
} |
1037 |
> |
} |
1038 |
|
#endif // is_mpi |
1039 |
< |
|
1039 |
> |
} |
1040 |
|
} |
1041 |
|
|
1042 |
|
|
1043 |
|
void SimSetup::sysObjectsCreation( void ){ |
1044 |
< |
|
1045 |
< |
int i; |
1046 |
< |
|
1044 |
> |
|
1045 |
> |
int i,k; |
1046 |
> |
|
1047 |
|
// create the forceField |
1048 |
|
|
1049 |
|
createFF(); |
1063 |
|
#endif //is_mpi |
1064 |
|
|
1065 |
|
// create the atom and SRI arrays. Also initialize Molecule Stamp ID's |
1066 |
< |
|
1066 |
> |
|
1067 |
|
makeSysArrays(); |
1068 |
|
|
1069 |
|
// make and initialize the molecules (all but atomic coordinates) |
1070 |
< |
|
1070 |
> |
|
1071 |
|
makeMolecules(); |
1026 |
– |
info->identArray = new int[info->n_atoms]; |
1027 |
– |
for(i=0; i<info->n_atoms; i++){ |
1028 |
– |
info->identArray[i] = the_atoms[i]->getIdent(); |
1029 |
– |
} |
1072 |
|
|
1073 |
< |
|
1074 |
< |
|
1073 |
> |
for(k=0; k<nInfo; k++){ |
1074 |
> |
info[k].identArray = new int[info[k].n_atoms]; |
1075 |
> |
for(i=0; i<info[k].n_atoms; i++){ |
1076 |
> |
info[k].identArray[i] = info[k].atoms[i]->getIdent(); |
1077 |
> |
} |
1078 |
> |
} |
1079 |
|
} |
1080 |
|
|
1081 |
|
|
1113 |
|
void SimSetup::compList( void ){ |
1114 |
|
|
1115 |
|
int i; |
1116 |
< |
|
1116 |
> |
char* id; |
1117 |
> |
LinkedMolStamp* headStamp = new LinkedMolStamp(); |
1118 |
> |
LinkedMolStamp* currentStamp = NULL; |
1119 |
|
comp_stamps = new MoleculeStamp*[n_components]; |
1120 |
< |
|
1120 |
> |
|
1121 |
|
// make an array of molecule stamps that match the components used. |
1122 |
|
// also extract the used stamps out into a separate linked list |
1075 |
– |
|
1076 |
– |
info->nComponents = n_components; |
1077 |
– |
info->componentsNmol = components_nmol; |
1078 |
– |
info->compStamps = comp_stamps; |
1079 |
– |
info->headStamp = new LinkedMolStamp(); |
1123 |
|
|
1124 |
< |
char* id; |
1125 |
< |
LinkedMolStamp* headStamp = info->headStamp; |
1126 |
< |
LinkedMolStamp* currentStamp = NULL; |
1124 |
> |
for(i=0; i<nInfo; i++){ |
1125 |
> |
info[i].nComponents = n_components; |
1126 |
> |
info[i].componentsNmol = components_nmol; |
1127 |
> |
info[i].compStamps = comp_stamps; |
1128 |
> |
info[i].headStamp = headStamp; |
1129 |
> |
} |
1130 |
> |
|
1131 |
> |
|
1132 |
|
for( i=0; i<n_components; i++ ){ |
1133 |
|
|
1134 |
|
id = the_components[i]->getType(); |
1166 |
|
|
1167 |
|
void SimSetup::calcSysValues( void ){ |
1168 |
|
int i, j, k; |
1169 |
< |
|
1170 |
< |
|
1169 |
> |
|
1170 |
> |
int *molMembershipArray; |
1171 |
> |
|
1172 |
|
tot_atoms = 0; |
1173 |
|
tot_bonds = 0; |
1174 |
|
tot_bends = 0; |
1180 |
|
tot_bends += components_nmol[i] * comp_stamps[i]->getNBends(); |
1181 |
|
tot_torsions += components_nmol[i] * comp_stamps[i]->getNTorsions(); |
1182 |
|
} |
1183 |
< |
|
1183 |
> |
|
1184 |
|
tot_SRI = tot_bonds + tot_bends + tot_torsions; |
1185 |
< |
|
1137 |
< |
info->n_atoms = tot_atoms; |
1138 |
< |
info->n_bonds = tot_bonds; |
1139 |
< |
info->n_bends = tot_bends; |
1140 |
< |
info->n_torsions = tot_torsions; |
1141 |
< |
info->n_SRI = tot_SRI; |
1142 |
< |
info->n_mol = tot_nmol; |
1185 |
> |
molMembershipArray = new int[tot_atoms]; |
1186 |
|
|
1187 |
< |
info->molMembershipArray = new int[tot_atoms]; |
1187 |
> |
for(i=0; i<nInfo; i++){ |
1188 |
> |
info[i].n_atoms = tot_atoms; |
1189 |
> |
info[i].n_bonds = tot_bonds; |
1190 |
> |
info[i].n_bends = tot_bends; |
1191 |
> |
info[i].n_torsions = tot_torsions; |
1192 |
> |
info[i].n_SRI = tot_SRI; |
1193 |
> |
info[i].n_mol = tot_nmol; |
1194 |
> |
|
1195 |
> |
info[i].molMembershipArray = molMembershipArray; |
1196 |
> |
} |
1197 |
|
} |
1198 |
|
|
1147 |
– |
|
1199 |
|
#ifdef IS_MPI |
1200 |
|
|
1201 |
|
void SimSetup::mpiMolDivide( void ){ |
1235 |
|
localMol++; |
1236 |
|
} |
1237 |
|
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1238 |
< |
info->molMembershipArray[globalAtomIndex] = allMol; |
1238 |
> |
info[0].molMembershipArray[globalAtomIndex] = allMol; |
1239 |
|
globalAtomIndex++; |
1240 |
|
} |
1241 |
|
|
1244 |
|
} |
1245 |
|
local_SRI = local_bonds + local_bends + local_torsions; |
1246 |
|
|
1247 |
< |
info->n_atoms = mpiSim->getMyNlocal(); |
1247 |
> |
info[0].n_atoms = mpiSim->getMyNlocal(); |
1248 |
|
|
1249 |
< |
if( local_atoms != info->n_atoms ){ |
1249 |
> |
if( local_atoms != info[0].n_atoms ){ |
1250 |
|
sprintf( painCave.errMsg, |
1251 |
|
"SimSetup error: mpiSim's localAtom (%d) and SimSetup's" |
1252 |
|
" localAtom (%d) are not equal.\n", |
1253 |
< |
info->n_atoms, |
1253 |
> |
info[0].n_atoms, |
1254 |
|
local_atoms ); |
1255 |
|
painCave.isFatal = 1; |
1256 |
|
simError(); |
1257 |
|
} |
1258 |
|
|
1259 |
< |
info->n_bonds = local_bonds; |
1260 |
< |
info->n_bends = local_bends; |
1261 |
< |
info->n_torsions = local_torsions; |
1262 |
< |
info->n_SRI = local_SRI; |
1263 |
< |
info->n_mol = localMol; |
1259 |
> |
info[0].n_bonds = local_bonds; |
1260 |
> |
info[0].n_bends = local_bends; |
1261 |
> |
info[0].n_torsions = local_torsions; |
1262 |
> |
info[0].n_SRI = local_SRI; |
1263 |
> |
info[0].n_mol = localMol; |
1264 |
|
|
1265 |
|
strcpy( checkPointMsg, "Passed nlocal consistency check." ); |
1266 |
|
MPIcheckPoint(); |
1267 |
|
} |
1268 |
< |
|
1268 |
> |
|
1269 |
|
#endif // is_mpi |
1270 |
|
|
1271 |
|
|
1272 |
|
void SimSetup::makeSysArrays( void ){ |
1273 |
< |
int i, j, k; |
1273 |
> |
int i, j, k, l; |
1274 |
|
|
1275 |
< |
|
1276 |
< |
// create the atom and short range interaction arrays |
1275 |
> |
Atom** the_atoms; |
1276 |
> |
Molecule* the_molecules; |
1277 |
> |
Exclude** the_excludes; |
1278 |
|
|
1227 |
– |
Atom::createArrays(info->n_atoms); |
1228 |
– |
the_atoms = new Atom*[info->n_atoms]; |
1229 |
– |
the_molecules = new Molecule[info->n_mol]; |
1230 |
– |
int molIndex; |
1231 |
– |
|
1232 |
– |
// initialize the molecule's stampID's |
1233 |
– |
|
1234 |
– |
#ifdef IS_MPI |
1279 |
|
|
1280 |
+ |
for(l=0; l<nInfo; l++){ |
1281 |
+ |
|
1282 |
+ |
// create the atom and short range interaction arrays |
1283 |
+ |
|
1284 |
+ |
the_atoms = new Atom*[info[l].n_atoms]; |
1285 |
+ |
the_molecules = new Molecule[info[l].n_mol]; |
1286 |
+ |
int molIndex; |
1287 |
|
|
1288 |
< |
molIndex = 0; |
1238 |
< |
for(i=0; i<mpiSim->getTotNmol(); i++){ |
1288 |
> |
// initialize the molecule's stampID's |
1289 |
|
|
1290 |
< |
if(mol2proc[i] == worldRank ){ |
1291 |
< |
the_molecules[molIndex].setStampID( molCompType[i] ); |
1292 |
< |
the_molecules[molIndex].setMyIndex( molIndex ); |
1293 |
< |
the_molecules[molIndex].setGlobalIndex( i ); |
1294 |
< |
molIndex++; |
1290 |
> |
#ifdef IS_MPI |
1291 |
> |
|
1292 |
> |
|
1293 |
> |
molIndex = 0; |
1294 |
> |
for(i=0; i<mpiSim->getTotNmol(); i++){ |
1295 |
> |
|
1296 |
> |
if(mol2proc[i] == worldRank ){ |
1297 |
> |
the_molecules[molIndex].setStampID( molCompType[i] ); |
1298 |
> |
the_molecules[molIndex].setMyIndex( molIndex ); |
1299 |
> |
the_molecules[molIndex].setGlobalIndex( i ); |
1300 |
> |
molIndex++; |
1301 |
> |
} |
1302 |
|
} |
1303 |
< |
} |
1247 |
< |
|
1303 |
> |
|
1304 |
|
#else // is_mpi |
1305 |
< |
|
1306 |
< |
molIndex = 0; |
1307 |
< |
globalAtomIndex = 0; |
1308 |
< |
for(i=0; i<n_components; i++){ |
1309 |
< |
for(j=0; j<components_nmol[i]; j++ ){ |
1310 |
< |
the_molecules[molIndex].setStampID( i ); |
1311 |
< |
the_molecules[molIndex].setMyIndex( molIndex ); |
1312 |
< |
the_molecules[molIndex].setGlobalIndex( molIndex ); |
1313 |
< |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1314 |
< |
info->molMembershipArray[globalAtomIndex] = molIndex; |
1315 |
< |
globalAtomIndex++; |
1305 |
> |
|
1306 |
> |
molIndex = 0; |
1307 |
> |
globalAtomIndex = 0; |
1308 |
> |
for(i=0; i<n_components; i++){ |
1309 |
> |
for(j=0; j<components_nmol[i]; j++ ){ |
1310 |
> |
the_molecules[molIndex].setStampID( i ); |
1311 |
> |
the_molecules[molIndex].setMyIndex( molIndex ); |
1312 |
> |
the_molecules[molIndex].setGlobalIndex( molIndex ); |
1313 |
> |
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { |
1314 |
> |
info[l].molMembershipArray[globalAtomIndex] = molIndex; |
1315 |
> |
globalAtomIndex++; |
1316 |
> |
} |
1317 |
> |
molIndex++; |
1318 |
|
} |
1261 |
– |
molIndex++; |
1319 |
|
} |
1263 |
– |
} |
1320 |
|
|
1321 |
< |
|
1321 |
> |
|
1322 |
|
#endif // is_mpi |
1323 |
|
|
1324 |
|
|
1325 |
< |
if( info->n_SRI ){ |
1325 |
> |
if( info[l].n_SRI ){ |
1326 |
|
|
1327 |
< |
Exclude::createArray(info->n_SRI); |
1328 |
< |
the_excludes = new Exclude*[info->n_SRI]; |
1329 |
< |
for( int ex=0; ex<info->n_SRI; ex++) the_excludes[ex] = new Exclude(ex); |
1330 |
< |
info->globalExcludes = new int; |
1331 |
< |
info->n_exclude = info->n_SRI; |
1332 |
< |
} |
1333 |
< |
else{ |
1327 |
> |
Exclude::createArray(info[l].n_SRI); |
1328 |
> |
the_excludes = new Exclude*[info[l].n_SRI]; |
1329 |
> |
for( int ex=0; ex<info[l].n_SRI; ex++){ |
1330 |
> |
the_excludes[ex] = new Exclude(ex); |
1331 |
> |
} |
1332 |
> |
info[l].globalExcludes = new int; |
1333 |
> |
info[l].n_exclude = info[l].n_SRI; |
1334 |
> |
} |
1335 |
> |
else{ |
1336 |
|
|
1337 |
< |
Exclude::createArray( 1 ); |
1338 |
< |
the_excludes = new Exclude*; |
1339 |
< |
the_excludes[0] = new Exclude(0); |
1340 |
< |
the_excludes[0]->setPair( 0,0 ); |
1341 |
< |
info->globalExcludes = new int; |
1342 |
< |
info->globalExcludes[0] = 0; |
1343 |
< |
info->n_exclude = 0; |
1344 |
< |
} |
1337 |
> |
Exclude::createArray( 1 ); |
1338 |
> |
the_excludes = new Exclude*; |
1339 |
> |
the_excludes[0] = new Exclude(0); |
1340 |
> |
the_excludes[0]->setPair( 0,0 ); |
1341 |
> |
info[l].globalExcludes = new int; |
1342 |
> |
info[l].globalExcludes[0] = 0; |
1343 |
> |
info[l].n_exclude = 0; |
1344 |
> |
} |
1345 |
|
|
1346 |
< |
// set the arrays into the SimInfo object |
1346 |
> |
// set the arrays into the SimInfo object |
1347 |
|
|
1348 |
< |
info->atoms = the_atoms; |
1349 |
< |
info->molecules = the_molecules; |
1350 |
< |
info->nGlobalExcludes = 0; |
1351 |
< |
info->excludes = the_excludes; |
1348 |
> |
info[l].atoms = the_atoms; |
1349 |
> |
info[l].molecules = the_molecules; |
1350 |
> |
info[l].nGlobalExcludes = 0; |
1351 |
> |
info[l].excludes = the_excludes; |
1352 |
|
|
1353 |
< |
the_ff->setSimInfo( info ); |
1354 |
< |
|
1353 |
> |
the_ff->setSimInfo( info ); |
1354 |
> |
|
1355 |
> |
} |
1356 |
|
} |
1357 |
|
|
1358 |
|
void SimSetup::makeIntegrator( void ){ |
1359 |
|
|
1360 |
+ |
int k; |
1361 |
+ |
|
1362 |
|
NVT<RealIntegrator>* myNVT = NULL; |
1363 |
|
NPTi<RealIntegrator>* myNPTi = NULL; |
1364 |
|
NPTf<RealIntegrator>* myNPTf = NULL; |
1365 |
|
NPTim<RealIntegrator>* myNPTim = NULL; |
1366 |
|
NPTfm<RealIntegrator>* myNPTfm = NULL; |
1367 |
+ |
|
1368 |
+ |
for(k=0; k<nInfo; k++){ |
1369 |
+ |
|
1370 |
+ |
switch( ensembleCase ){ |
1371 |
+ |
|
1372 |
+ |
case NVE_ENS: |
1373 |
+ |
if (globals->haveZconstraints()){ |
1374 |
+ |
setupZConstraint(info[k]); |
1375 |
+ |
new ZConstraint<NVE<RealIntegrator> >( &(info[k]), the_ff ); |
1376 |
+ |
} |
1377 |
|
|
1378 |
< |
switch( ensembleCase ){ |
1378 |
> |
else |
1379 |
> |
new NVE<RealIntegrator>( &(info[k]), the_ff ); |
1380 |
> |
break; |
1381 |
> |
|
1382 |
> |
case NVT_ENS: |
1383 |
> |
if (globals->haveZconstraints()){ |
1384 |
> |
setupZConstraint(info[k]); |
1385 |
> |
myNVT = new ZConstraint<NVT<RealIntegrator> >( &(info[k]), the_ff ); |
1386 |
> |
} |
1387 |
> |
else |
1388 |
> |
myNVT = new NVT<RealIntegrator>( &(info[k]), the_ff ); |
1389 |
|
|
1390 |
< |
case NVE_ENS: |
1391 |
< |
new NVE<RealIntegrator>( info, the_ff ); |
1392 |
< |
break; |
1390 |
> |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1391 |
> |
|
1392 |
> |
if (globals->haveTauThermostat()) |
1393 |
> |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1394 |
> |
|
1395 |
> |
else { |
1396 |
> |
sprintf( painCave.errMsg, |
1397 |
> |
"SimSetup error: If you use the NVT\n" |
1398 |
> |
" ensemble, you must set tauThermostat.\n"); |
1399 |
> |
painCave.isFatal = 1; |
1400 |
> |
simError(); |
1401 |
> |
} |
1402 |
> |
break; |
1403 |
> |
|
1404 |
> |
case NPTi_ENS: |
1405 |
> |
if (globals->haveZconstraints()){ |
1406 |
> |
setupZConstraint(info[k]); |
1407 |
> |
myNPTi = new ZConstraint<NPTi<RealIntegrator> >( &(info[k]), the_ff ); |
1408 |
> |
} |
1409 |
> |
else |
1410 |
> |
myNPTi = new NPTi<RealIntegrator>( &(info[k]), the_ff ); |
1411 |
|
|
1412 |
< |
case NVT_ENS: |
1413 |
< |
myNVT = new NVT<RealIntegrator>( info, the_ff ); |
1414 |
< |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1415 |
< |
|
1416 |
< |
if (globals->haveTauThermostat()) |
1417 |
< |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1418 |
< |
|
1419 |
< |
else { |
1420 |
< |
sprintf( painCave.errMsg, |
1421 |
< |
"SimSetup error: If you use the NVT\n" |
1422 |
< |
" ensemble, you must set tauThermostat.\n"); |
1423 |
< |
painCave.isFatal = 1; |
1424 |
< |
simError(); |
1425 |
< |
} |
1426 |
< |
break; |
1412 |
> |
myNPTi->setTargetTemp( globals->getTargetTemp() ); |
1413 |
> |
|
1414 |
> |
if (globals->haveTargetPressure()) |
1415 |
> |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1416 |
> |
else { |
1417 |
> |
sprintf( painCave.errMsg, |
1418 |
> |
"SimSetup error: If you use a constant pressure\n" |
1419 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1420 |
> |
painCave.isFatal = 1; |
1421 |
> |
simError(); |
1422 |
> |
} |
1423 |
> |
|
1424 |
> |
if( globals->haveTauThermostat() ) |
1425 |
> |
myNPTi->setTauThermostat( globals->getTauThermostat() ); |
1426 |
> |
else{ |
1427 |
> |
sprintf( painCave.errMsg, |
1428 |
> |
"SimSetup error: If you use an NPT\n" |
1429 |
> |
" ensemble, you must set tauThermostat.\n"); |
1430 |
> |
painCave.isFatal = 1; |
1431 |
> |
simError(); |
1432 |
> |
} |
1433 |
> |
|
1434 |
> |
if( globals->haveTauBarostat() ) |
1435 |
> |
myNPTi->setTauBarostat( globals->getTauBarostat() ); |
1436 |
> |
else{ |
1437 |
> |
sprintf( painCave.errMsg, |
1438 |
> |
"SimSetup error: If you use an NPT\n" |
1439 |
> |
" ensemble, you must set tauBarostat.\n"); |
1440 |
> |
painCave.isFatal = 1; |
1441 |
> |
simError(); |
1442 |
> |
} |
1443 |
> |
break; |
1444 |
> |
|
1445 |
> |
case NPTf_ENS: |
1446 |
> |
if (globals->haveZconstraints()){ |
1447 |
> |
setupZConstraint(info[k]); |
1448 |
> |
myNPTf = new ZConstraint<NPTf<RealIntegrator> >( &(info[k]), the_ff ); |
1449 |
> |
} |
1450 |
> |
else |
1451 |
> |
myNPTf = new NPTf<RealIntegrator>( &(info[k]), the_ff ); |
1452 |
|
|
1453 |
< |
case NPTi_ENS: |
1454 |
< |
myNPTi = new NPTi<RealIntegrator>( info, the_ff ); |
1455 |
< |
myNPTi->setTargetTemp( globals->getTargetTemp() ); |
1456 |
< |
|
1457 |
< |
if (globals->haveTargetPressure()) |
1458 |
< |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1459 |
< |
else { |
1460 |
< |
sprintf( painCave.errMsg, |
1461 |
< |
"SimSetup error: If you use a constant pressure\n" |
1462 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1463 |
< |
painCave.isFatal = 1; |
1464 |
< |
simError(); |
1465 |
< |
} |
1466 |
< |
|
1467 |
< |
if( globals->haveTauThermostat() ) |
1468 |
< |
myNPTi->setTauThermostat( globals->getTauThermostat() ); |
1469 |
< |
else{ |
1346 |
< |
sprintf( painCave.errMsg, |
1347 |
< |
"SimSetup error: If you use an NPT\n" |
1453 |
> |
myNPTf->setTargetTemp( globals->getTargetTemp()); |
1454 |
> |
|
1455 |
> |
if (globals->haveTargetPressure()) |
1456 |
> |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1457 |
> |
else { |
1458 |
> |
sprintf( painCave.errMsg, |
1459 |
> |
"SimSetup error: If you use a constant pressure\n" |
1460 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1461 |
> |
painCave.isFatal = 1; |
1462 |
> |
simError(); |
1463 |
> |
} |
1464 |
> |
|
1465 |
> |
if( globals->haveTauThermostat() ) |
1466 |
> |
myNPTf->setTauThermostat( globals->getTauThermostat() ); |
1467 |
> |
else{ |
1468 |
> |
sprintf( painCave.errMsg, |
1469 |
> |
"SimSetup error: If you use an NPT\n" |
1470 |
|
" ensemble, you must set tauThermostat.\n"); |
1471 |
< |
painCave.isFatal = 1; |
1472 |
< |
simError(); |
1473 |
< |
} |
1471 |
> |
painCave.isFatal = 1; |
1472 |
> |
simError(); |
1473 |
> |
} |
1474 |
> |
|
1475 |
> |
if( globals->haveTauBarostat() ) |
1476 |
> |
myNPTf->setTauBarostat( globals->getTauBarostat() ); |
1477 |
> |
else{ |
1478 |
> |
sprintf( painCave.errMsg, |
1479 |
> |
"SimSetup error: If you use an NPT\n" |
1480 |
> |
" ensemble, you must set tauBarostat.\n"); |
1481 |
> |
painCave.isFatal = 1; |
1482 |
> |
simError(); |
1483 |
> |
} |
1484 |
> |
break; |
1485 |
> |
|
1486 |
> |
case NPTim_ENS: |
1487 |
> |
if (globals->haveZconstraints()){ |
1488 |
> |
setupZConstraint(info[k]); |
1489 |
> |
myNPTim = new ZConstraint<NPTim<RealIntegrator> >( &(info[k]), the_ff ); |
1490 |
> |
} |
1491 |
> |
else |
1492 |
> |
myNPTim = new NPTim<RealIntegrator>( &(info[k]), the_ff ); |
1493 |
|
|
1494 |
< |
if( globals->haveTauBarostat() ) |
1495 |
< |
myNPTi->setTauBarostat( globals->getTauBarostat() ); |
1496 |
< |
else{ |
1494 |
> |
myNPTim->setTargetTemp( globals->getTargetTemp()); |
1495 |
> |
|
1496 |
> |
if (globals->haveTargetPressure()) |
1497 |
> |
myNPTim->setTargetPressure(globals->getTargetPressure()); |
1498 |
> |
else { |
1499 |
> |
sprintf( painCave.errMsg, |
1500 |
> |
"SimSetup error: If you use a constant pressure\n" |
1501 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1502 |
> |
painCave.isFatal = 1; |
1503 |
> |
simError(); |
1504 |
> |
} |
1505 |
> |
|
1506 |
> |
if( globals->haveTauThermostat() ) |
1507 |
> |
myNPTim->setTauThermostat( globals->getTauThermostat() ); |
1508 |
> |
else{ |
1509 |
> |
sprintf( painCave.errMsg, |
1510 |
> |
"SimSetup error: If you use an NPT\n" |
1511 |
> |
" ensemble, you must set tauThermostat.\n"); |
1512 |
> |
painCave.isFatal = 1; |
1513 |
> |
simError(); |
1514 |
> |
} |
1515 |
> |
|
1516 |
> |
if( globals->haveTauBarostat() ) |
1517 |
> |
myNPTim->setTauBarostat( globals->getTauBarostat() ); |
1518 |
> |
else{ |
1519 |
|
sprintf( painCave.errMsg, |
1520 |
|
"SimSetup error: If you use an NPT\n" |
1521 |
|
" ensemble, you must set tauBarostat.\n"); |
1522 |
|
painCave.isFatal = 1; |
1523 |
|
simError(); |
1524 |
< |
} |
1525 |
< |
break; |
1524 |
> |
} |
1525 |
> |
break; |
1526 |
> |
|
1527 |
> |
case NPTfm_ENS: |
1528 |
> |
if (globals->haveZconstraints()){ |
1529 |
> |
setupZConstraint(info[k]); |
1530 |
> |
myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >( &(info[k]), the_ff ); |
1531 |
> |
} |
1532 |
> |
else |
1533 |
> |
myNPTfm = new NPTfm<RealIntegrator>( &(info[k]), the_ff ); |
1534 |
|
|
1535 |
< |
case NPTf_ENS: |
1536 |
< |
myNPTf = new NPTf<RealIntegrator>( info, the_ff ); |
1537 |
< |
myNPTf->setTargetTemp( globals->getTargetTemp()); |
1538 |
< |
|
1539 |
< |
if (globals->haveTargetPressure()) |
1540 |
< |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1541 |
< |
else { |
1535 |
> |
myNPTfm->setTargetTemp( globals->getTargetTemp()); |
1536 |
> |
|
1537 |
> |
if (globals->haveTargetPressure()) |
1538 |
> |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1539 |
> |
else { |
1540 |
> |
sprintf( painCave.errMsg, |
1541 |
> |
"SimSetup error: If you use a constant pressure\n" |
1542 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1543 |
> |
painCave.isFatal = 1; |
1544 |
> |
simError(); |
1545 |
> |
} |
1546 |
> |
|
1547 |
> |
if( globals->haveTauThermostat() ) |
1548 |
> |
myNPTfm->setTauThermostat( globals->getTauThermostat() ); |
1549 |
> |
else{ |
1550 |
> |
sprintf( painCave.errMsg, |
1551 |
> |
"SimSetup error: If you use an NPT\n" |
1552 |
> |
" ensemble, you must set tauThermostat.\n"); |
1553 |
> |
painCave.isFatal = 1; |
1554 |
> |
simError(); |
1555 |
> |
} |
1556 |
> |
|
1557 |
> |
if( globals->haveTauBarostat() ) |
1558 |
> |
myNPTfm->setTauBarostat( globals->getTauBarostat() ); |
1559 |
> |
else{ |
1560 |
> |
sprintf( painCave.errMsg, |
1561 |
> |
"SimSetup error: If you use an NPT\n" |
1562 |
> |
" ensemble, you must set tauBarostat.\n"); |
1563 |
> |
painCave.isFatal = 1; |
1564 |
> |
simError(); |
1565 |
> |
} |
1566 |
> |
break; |
1567 |
> |
|
1568 |
> |
default: |
1569 |
|
sprintf( painCave.errMsg, |
1570 |
< |
"SimSetup error: If you use a constant pressure\n" |
1373 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1570 |
> |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1571 |
|
painCave.isFatal = 1; |
1572 |
|
simError(); |
1376 |
– |
} |
1377 |
– |
|
1378 |
– |
if( globals->haveTauThermostat() ) |
1379 |
– |
myNPTf->setTauThermostat( globals->getTauThermostat() ); |
1380 |
– |
else{ |
1381 |
– |
sprintf( painCave.errMsg, |
1382 |
– |
"SimSetup error: If you use an NPT\n" |
1383 |
– |
" ensemble, you must set tauThermostat.\n"); |
1384 |
– |
painCave.isFatal = 1; |
1385 |
– |
simError(); |
1573 |
|
} |
1387 |
– |
|
1388 |
– |
if( globals->haveTauBarostat() ) |
1389 |
– |
myNPTf->setTauBarostat( globals->getTauBarostat() ); |
1390 |
– |
else{ |
1391 |
– |
sprintf( painCave.errMsg, |
1392 |
– |
"SimSetup error: If you use an NPT\n" |
1393 |
– |
" ensemble, you must set tauBarostat.\n"); |
1394 |
– |
painCave.isFatal = 1; |
1395 |
– |
simError(); |
1396 |
– |
} |
1397 |
– |
break; |
1398 |
– |
|
1399 |
– |
case NPTim_ENS: |
1400 |
– |
myNPTim = new NPTim<RealIntegrator>( info, the_ff ); |
1401 |
– |
myNPTim->setTargetTemp( globals->getTargetTemp()); |
1402 |
– |
|
1403 |
– |
if (globals->haveTargetPressure()) |
1404 |
– |
myNPTim->setTargetPressure(globals->getTargetPressure()); |
1405 |
– |
else { |
1406 |
– |
sprintf( painCave.errMsg, |
1407 |
– |
"SimSetup error: If you use a constant pressure\n" |
1408 |
– |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1409 |
– |
painCave.isFatal = 1; |
1410 |
– |
simError(); |
1411 |
– |
} |
1412 |
– |
|
1413 |
– |
if( globals->haveTauThermostat() ) |
1414 |
– |
myNPTim->setTauThermostat( globals->getTauThermostat() ); |
1415 |
– |
else{ |
1416 |
– |
sprintf( painCave.errMsg, |
1417 |
– |
"SimSetup error: If you use an NPT\n" |
1418 |
– |
" ensemble, you must set tauThermostat.\n"); |
1419 |
– |
painCave.isFatal = 1; |
1420 |
– |
simError(); |
1421 |
– |
} |
1422 |
– |
|
1423 |
– |
if( globals->haveTauBarostat() ) |
1424 |
– |
myNPTim->setTauBarostat( globals->getTauBarostat() ); |
1425 |
– |
else{ |
1426 |
– |
sprintf( painCave.errMsg, |
1427 |
– |
"SimSetup error: If you use an NPT\n" |
1428 |
– |
" ensemble, you must set tauBarostat.\n"); |
1429 |
– |
painCave.isFatal = 1; |
1430 |
– |
simError(); |
1431 |
– |
} |
1432 |
– |
break; |
1433 |
– |
|
1434 |
– |
case NPTfm_ENS: |
1435 |
– |
myNPTfm = new NPTfm<RealIntegrator>( info, the_ff ); |
1436 |
– |
myNPTfm->setTargetTemp( globals->getTargetTemp()); |
1437 |
– |
|
1438 |
– |
if (globals->haveTargetPressure()) |
1439 |
– |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1440 |
– |
else { |
1441 |
– |
sprintf( painCave.errMsg, |
1442 |
– |
"SimSetup error: If you use a constant pressure\n" |
1443 |
– |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1444 |
– |
painCave.isFatal = 1; |
1445 |
– |
simError(); |
1446 |
– |
} |
1447 |
– |
|
1448 |
– |
if( globals->haveTauThermostat() ) |
1449 |
– |
myNPTfm->setTauThermostat( globals->getTauThermostat() ); |
1450 |
– |
else{ |
1451 |
– |
sprintf( painCave.errMsg, |
1452 |
– |
"SimSetup error: If you use an NPT\n" |
1453 |
– |
" ensemble, you must set tauThermostat.\n"); |
1454 |
– |
painCave.isFatal = 1; |
1455 |
– |
simError(); |
1456 |
– |
} |
1457 |
– |
|
1458 |
– |
if( globals->haveTauBarostat() ) |
1459 |
– |
myNPTfm->setTauBarostat( globals->getTauBarostat() ); |
1460 |
– |
else{ |
1461 |
– |
sprintf( painCave.errMsg, |
1462 |
– |
"SimSetup error: If you use an NPT\n" |
1463 |
– |
" ensemble, you must set tauBarostat.\n"); |
1464 |
– |
painCave.isFatal = 1; |
1465 |
– |
simError(); |
1466 |
– |
} |
1467 |
– |
break; |
1468 |
– |
|
1469 |
– |
default: |
1470 |
– |
sprintf( painCave.errMsg, |
1471 |
– |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1472 |
– |
painCave.isFatal = 1; |
1473 |
– |
simError(); |
1574 |
|
} |
1475 |
– |
|
1575 |
|
} |
1576 |
|
|
1577 |
|
void SimSetup::initFortran( void ){ |
1578 |
|
|
1579 |
< |
info->refreshSim(); |
1579 |
> |
info[0].refreshSim(); |
1580 |
|
|
1581 |
< |
if( !strcmp( info->mixingRule, "standard") ){ |
1581 |
> |
if( !strcmp( info[0].mixingRule, "standard") ){ |
1582 |
|
the_ff->initForceField( LB_MIXING_RULE ); |
1583 |
|
} |
1584 |
< |
else if( !strcmp( info->mixingRule, "explicit") ){ |
1584 |
> |
else if( !strcmp( info[0].mixingRule, "explicit") ){ |
1585 |
|
the_ff->initForceField( EXPLICIT_MIXING_RULE ); |
1586 |
|
} |
1587 |
|
else{ |
1588 |
|
sprintf( painCave.errMsg, |
1589 |
|
"SimSetup Error: unknown mixing rule -> \"%s\"\n", |
1590 |
< |
info->mixingRule ); |
1590 |
> |
info[0].mixingRule ); |
1591 |
|
painCave.isFatal = 1; |
1592 |
|
simError(); |
1593 |
|
} |
1600 |
|
#endif // is_mpi |
1601 |
|
|
1602 |
|
} |
1603 |
+ |
|
1604 |
+ |
void SimSetup::setupZConstraint(SimInfo& theInfo) |
1605 |
+ |
{ |
1606 |
+ |
int nZConstraints; |
1607 |
+ |
ZconStamp** zconStamp; |
1608 |
+ |
|
1609 |
+ |
if(globals->haveZconstraintTime()){ |
1610 |
+ |
|
1611 |
+ |
//add sample time of z-constraint into SimInfo's property list |
1612 |
+ |
DoubleData* zconsTimeProp = new DoubleData(); |
1613 |
+ |
zconsTimeProp->setID(ZCONSTIME_ID); |
1614 |
+ |
zconsTimeProp->setData(globals->getZconsTime()); |
1615 |
+ |
theInfo.addProperty(zconsTimeProp); |
1616 |
+ |
} |
1617 |
+ |
else{ |
1618 |
+ |
sprintf( painCave.errMsg, |
1619 |
+ |
"ZConstraint error: If you use an ZConstraint\n" |
1620 |
+ |
" , you must set sample time.\n"); |
1621 |
+ |
painCave.isFatal = 1; |
1622 |
+ |
simError(); |
1623 |
+ |
} |
1624 |
+ |
|
1625 |
+ |
// |
1626 |
+ |
nZConstraints = globals->getNzConstraints(); |
1627 |
+ |
zconStamp = globals->getZconStamp(); |
1628 |
+ |
ZConsParaItem tempParaItem; |
1629 |
+ |
|
1630 |
+ |
ZConsParaData* zconsParaData = new ZConsParaData(); |
1631 |
+ |
zconsParaData->setID(ZCONSPARADATA_ID); |
1632 |
+ |
|
1633 |
+ |
for(int i = 0; i < nZConstraints; i++){ |
1634 |
+ |
tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
1635 |
+ |
tempParaItem.zPos = zconStamp[i]->getZpos(); |
1636 |
+ |
tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1637 |
+ |
tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1638 |
+ |
|
1639 |
+ |
zconsParaData->addItem(tempParaItem); |
1640 |
+ |
} |
1641 |
+ |
|
1642 |
+ |
//sort the parameters by index of molecules |
1643 |
+ |
zconsParaData->sortByIndex(); |
1644 |
+ |
|
1645 |
+ |
//push data into siminfo, therefore, we can retrieve later |
1646 |
+ |
theInfo.addProperty(zconsParaData); |
1647 |
+ |
|
1648 |
+ |
//push zconsTol into siminfo, if user does not specify |
1649 |
+ |
//value for zconsTol, a default value will be used |
1650 |
+ |
DoubleData* zconsTol = new DoubleData(); |
1651 |
+ |
zconsTol->setID(ZCONSTOL_ID); |
1652 |
+ |
if(globals->haveZconsTol()){ |
1653 |
+ |
zconsTol->setData(globals->getZconsTol()); |
1654 |
+ |
} |
1655 |
+ |
else{ |
1656 |
+ |
double defaultZConsTol = 1E-6; |
1657 |
+ |
sprintf( painCave.errMsg, |
1658 |
+ |
"ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1659 |
+ |
" , default value %f is used.\n", defaultZConsTol); |
1660 |
+ |
painCave.isFatal = 0; |
1661 |
+ |
simError(); |
1662 |
+ |
|
1663 |
+ |
zconsTol->setData(defaultZConsTol); |
1664 |
+ |
} |
1665 |
+ |
theInfo.addProperty(zconsTol); |
1666 |
+ |
|
1667 |
+ |
//Determine the name of ouput file and add it into SimInfo's property list |
1668 |
+ |
//Be careful, do not use inFileName, since it is a pointer which |
1669 |
+ |
//point to a string at master node, and slave nodes do not contain that string |
1670 |
+ |
|
1671 |
+ |
string zconsOutput(theInfo.finalName); |
1672 |
+ |
|
1673 |
+ |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1674 |
+ |
|
1675 |
+ |
StringData* zconsFilename = new StringData(); |
1676 |
+ |
zconsFilename->setID(ZCONSFILENAME_ID); |
1677 |
+ |
zconsFilename->setData(zconsOutput); |
1678 |
+ |
|
1679 |
+ |
theInfo.addProperty(zconsFilename); |
1680 |
+ |
} |