# | Line 119 | Line 119 | void SimSetup::createSim( void ){ | |
---|---|---|
119 | ||
120 | if( !the_components[i]->haveNMol() ){ | |
121 | // we have a problem | |
122 | < | std::cerr << "SimSetup Error. No global NMol or component NMol" |
123 | < | << " given. Cannot calculate the number of atoms.\n"; |
124 | < | exit( 8 ); |
122 | > | sprintf( painCave.errMsg, |
123 | > | "SimSetup Error. No global NMol or component NMol" |
124 | > | " given. Cannot calculate the number of atoms.\n" ); |
125 | > | painCave.isFatal = 1; |
126 | > | simError(); |
127 | } | |
128 | ||
129 | tot_nmol += the_components[i]->getNMol(); | |
# | Line 129 | Line 131 | void SimSetup::createSim( void ){ | |
131 | } | |
132 | } | |
133 | else{ | |
134 | < | std::cerr << "NOT A SUPPORTED FEATURE\n"; |
135 | < | |
136 | < | // tot_nmol = the_globals->getNMol(); |
137 | < | |
138 | < | // //we have the total number of molecules, now we check for molfractions |
139 | < | // for( i=0; i<n_components; i++ ){ |
140 | < | |
141 | < | // if( !the_components[i]->haveMolFraction() ){ |
142 | < | |
143 | < | // if( !the_components[i]->haveNMol() ){ |
144 | < | // //we have a problem |
145 | < | // std::cerr << "SimSetup error. Neither molFraction nor " |
146 | < | // << " nMol was given in component |
147 | < | |
134 | > | sprintf( painCave.errMsg, |
135 | > | "SimSetup error.\n" |
136 | > | "\tSorry, the ability to specify total" |
137 | > | " nMols and then give molfractions in the components\n" |
138 | > | "\tis not currently supported." |
139 | > | " Please give nMol in the components.\n" ); |
140 | > | painCave.isFatal = 1; |
141 | > | simError(); |
142 | > | |
143 | > | |
144 | > | // tot_nmol = the_globals->getNMol(); |
145 | > | |
146 | > | // //we have the total number of molecules, now we check for molfractions |
147 | > | // for( i=0; i<n_components; i++ ){ |
148 | > | |
149 | > | // if( !the_components[i]->haveMolFraction() ){ |
150 | > | |
151 | > | // if( !the_components[i]->haveNMol() ){ |
152 | > | // //we have a problem |
153 | > | // std::cerr << "SimSetup error. Neither molFraction nor " |
154 | > | // << " nMol was given in component |
155 | > | |
156 | } | |
157 | ||
158 | + | #ifdef IS_MPI |
159 | + | strcpy( checkPointMsg, "Have the number of components" ); |
160 | + | MPIcheckPoint(); |
161 | + | #endif // is_mpi |
162 | + | |
163 | // make an array of molecule stamps that match the components used. | |
164 | ||
165 | for( i=0; i<n_components; i++ ){ | |
# | Line 179 | Line 194 | void SimSetup::createSim( void ){ | |
194 | ||
195 | // create the atom and short range interaction arrays | |
196 | ||
182 | – | the_atoms = new Atom*[tot_atoms]; |
197 | Atom::createArrays(tot_atoms); | |
198 | + | the_atoms = new Atom*[tot_atoms]; |
199 | the_molecules = new Molecule[tot_nmol]; | |
200 | ||
201 | ||
# | Line 222 | Line 237 | void SimSetup::createSim( void ){ | |
237 | if( simnfo->n_dipoles ){ | |
238 | ||
239 | if( !the_globals->haveRRF() ){ | |
240 | < | std::cerr << "SimSetup Error, system has dipoles, but no rRF was set.\n"; |
241 | < | exit(8); |
240 | > | sprintf( painCave.errMsg, |
241 | > | "SimSetup Error, system has dipoles, but no rRF was set.\n"); |
242 | > | painCave.isFatal = 1; |
243 | > | simError(); |
244 | } | |
245 | if( !the_globals->haveDielectric() ){ | |
246 | < | std::cerr << "SimSetup Error, system has dipoles, but no" |
247 | < | << " dielectric was set.\n"; |
248 | < | exit(8); |
246 | > | sprintf( painCave.errMsg, |
247 | > | "SimSetup Error, system has dipoles, but no" |
248 | > | " dielectric was set.\n" ); |
249 | > | painCave.isFatal = 1; |
250 | > | simError(); |
251 | } | |
252 | ||
253 | simnfo->rRF = the_globals->getRRF(); | |
254 | simnfo->dielectric = the_globals->getDielectric(); | |
255 | } | |
256 | ||
257 | + | #ifdef IS_MPI |
258 | + | strcpy( checkPointMsg, "rRf and dielectric check out" ); |
259 | + | MPIcheckPoint(); |
260 | + | #endif // is_mpi |
261 | + | |
262 | if( the_globals->haveBox() ){ | |
263 | simnfo->box_x = the_globals->getBox(); | |
264 | simnfo->box_y = the_globals->getBox(); | |
# | Line 250 | Line 274 | void SimSetup::createSim( void ){ | |
274 | } | |
275 | else{ | |
276 | if( !the_globals->haveBoxX() ){ | |
277 | < | std::cerr << "SimSetup error, no periodic BoxX size given.\n"; |
278 | < | exit(8); |
277 | > | sprintf( painCave.errMsg, |
278 | > | "SimSetup error, no periodic BoxX size given.\n" ); |
279 | > | painCave.isFatal = 1; |
280 | > | simError(); |
281 | } | |
282 | simnfo->box_x = the_globals->getBoxX(); | |
283 | ||
284 | if( !the_globals->haveBoxY() ){ | |
285 | < | std::cerr << "SimSetup error, no periodic BoxY size given.\n"; |
286 | < | exit(8); |
285 | > | sprintf( painCave.errMsg, |
286 | > | "SimSetup error, no periodic BoxY size given.\n" ); |
287 | > | painCave.isFatal = 1; |
288 | > | simError(); |
289 | } | |
290 | simnfo->box_y = the_globals->getBoxY(); | |
291 | ||
292 | if( !the_globals->haveBoxZ() ){ | |
293 | < | std::cerr << "SimSetup error, no periodic BoxZ size given.\n"; |
294 | < | exit(8); |
293 | > | sprintf( painCave.errMsg, |
294 | > | "SimSetup error, no periodic BoxZ size given.\n" ); |
295 | > | painCave.isFatal = 1; |
296 | > | simError(); |
297 | } | |
298 | simnfo->box_z = the_globals->getBoxZ(); | |
299 | } | |
300 | ||
301 | + | #ifdef IS_MPI |
302 | + | strcpy( checkPointMsg, "Box size set up" ); |
303 | + | MPIcheckPoint(); |
304 | + | #endif // is_mpi |
305 | ||
306 | + | |
307 | + | |
308 | // if( the_globals->haveInitialConfig() ){ | |
309 | // InitializeFromFile* fileInit; | |
310 | // fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); | |
# | Line 279 | Line 315 | void SimSetup::createSim( void ){ | |
315 | // } | |
316 | // else{ | |
317 | ||
318 | < | initFromBass(); |
319 | < | |
320 | < | |
321 | < | // } |
322 | < | |
323 | < | // if( the_globals->haveFinalConfig() ){ |
288 | < | // strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
289 | < | // } |
290 | < | // else{ |
291 | < | // strcpy( simnfo->finalName, inFileName ); |
292 | < | // char* endTest; |
293 | < | // int nameLength = strlen( simnfo->finalName ); |
294 | < | // endTest = &(simnfo->finalName[nameLength - 5]); |
295 | < | // if( !strcmp( endTest, ".bass" ) ){ |
296 | < | // strcpy( endTest, ".eor" ); |
297 | < | // } |
298 | < | // else if( !strcmp( endTest, ".BASS" ) ){ |
299 | < | // strcpy( endTest, ".eor" ); |
300 | < | // } |
301 | < | // else{ |
302 | < | // endTest = &(simnfo->finalName[nameLength - 4]); |
303 | < | // if( !strcmp( endTest, ".bss" ) ){ |
304 | < | // strcpy( endTest, ".eor" ); |
305 | < | // } |
306 | < | // else if( !strcmp( endTest, ".mdl" ) ){ |
307 | < | // strcpy( endTest, ".eor" ); |
308 | < | // } |
309 | < | // else{ |
310 | < | // strcat( simnfo->finalName, ".eor" ); |
311 | < | // } |
312 | < | // } |
313 | < | // } |
314 | < | |
315 | < | // // make the sample and status out names |
316 | < | |
317 | < | // strcpy( simnfo->sampleName, inFileName ); |
318 | < | // char* endTest; |
319 | < | // int nameLength = strlen( simnfo->sampleName ); |
320 | < | // endTest = &(simnfo->sampleName[nameLength - 5]); |
321 | < | // if( !strcmp( endTest, ".bass" ) ){ |
322 | < | // strcpy( endTest, ".dump" ); |
323 | < | // } |
324 | < | // else if( !strcmp( endTest, ".BASS" ) ){ |
325 | < | // strcpy( endTest, ".dump" ); |
326 | < | // } |
327 | < | // else{ |
328 | < | // endTest = &(simnfo->sampleName[nameLength - 4]); |
329 | < | // if( !strcmp( endTest, ".bss" ) ){ |
330 | < | // strcpy( endTest, ".dump" ); |
331 | < | // } |
332 | < | // else if( !strcmp( endTest, ".mdl" ) ){ |
333 | < | // strcpy( endTest, ".dump" ); |
334 | < | // } |
335 | < | // else{ |
336 | < | // strcat( simnfo->sampleName, ".dump" ); |
337 | < | // } |
338 | < | // } |
318 | > | initFromBass(); |
319 | > | |
320 | > | #ifdef IS_MPI |
321 | > | strcpy( checkPointMsg, "initFromBass successfully created the lattice" ); |
322 | > | MPIcheckPoint(); |
323 | > | #endif // is_mpi |
324 | ||
340 | – | // strcpy( simnfo->statusName, inFileName ); |
341 | – | // nameLength = strlen( simnfo->statusName ); |
342 | – | // endTest = &(simnfo->statusName[nameLength - 5]); |
343 | – | // if( !strcmp( endTest, ".bass" ) ){ |
344 | – | // strcpy( endTest, ".stat" ); |
345 | – | // } |
346 | – | // else if( !strcmp( endTest, ".BASS" ) ){ |
347 | – | // strcpy( endTest, ".stat" ); |
348 | – | // } |
349 | – | // else{ |
350 | – | // endTest = &(simnfo->statusName[nameLength - 4]); |
351 | – | // if( !strcmp( endTest, ".bss" ) ){ |
352 | – | // strcpy( endTest, ".stat" ); |
353 | – | // } |
354 | – | // else if( !strcmp( endTest, ".mdl" ) ){ |
355 | – | // strcpy( endTest, ".stat" ); |
356 | – | // } |
357 | – | // else{ |
358 | – | // strcat( simnfo->statusName, ".stat" ); |
359 | – | // } |
360 | – | // } |
325 | ||
326 | < | |
326 | > | |
327 | > | |
328 | > | |
329 | > | // } |
330 | > | |
331 | > | #ifdef IS_MPI |
332 | > | if( worldRank == 0 ){ |
333 | > | #endif // is_mpi |
334 | > | |
335 | > | if( the_globals->haveFinalConfig() ){ |
336 | > | strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
337 | > | } |
338 | > | else{ |
339 | > | strcpy( simnfo->finalName, inFileName ); |
340 | > | char* endTest; |
341 | > | int nameLength = strlen( simnfo->finalName ); |
342 | > | endTest = &(simnfo->finalName[nameLength - 5]); |
343 | > | if( !strcmp( endTest, ".bass" ) ){ |
344 | > | strcpy( endTest, ".eor" ); |
345 | > | } |
346 | > | else if( !strcmp( endTest, ".BASS" ) ){ |
347 | > | strcpy( endTest, ".eor" ); |
348 | > | } |
349 | > | else{ |
350 | > | endTest = &(simnfo->finalName[nameLength - 4]); |
351 | > | if( !strcmp( endTest, ".bss" ) ){ |
352 | > | strcpy( endTest, ".eor" ); |
353 | > | } |
354 | > | else if( !strcmp( endTest, ".mdl" ) ){ |
355 | > | strcpy( endTest, ".eor" ); |
356 | > | } |
357 | > | else{ |
358 | > | strcat( simnfo->finalName, ".eor" ); |
359 | > | } |
360 | > | } |
361 | > | } |
362 | > | |
363 | > | // make the sample and status out names |
364 | > | |
365 | > | strcpy( simnfo->sampleName, inFileName ); |
366 | > | char* endTest; |
367 | > | int nameLength = strlen( simnfo->sampleName ); |
368 | > | endTest = &(simnfo->sampleName[nameLength - 5]); |
369 | > | if( !strcmp( endTest, ".bass" ) ){ |
370 | > | strcpy( endTest, ".dump" ); |
371 | > | } |
372 | > | else if( !strcmp( endTest, ".BASS" ) ){ |
373 | > | strcpy( endTest, ".dump" ); |
374 | > | } |
375 | > | else{ |
376 | > | endTest = &(simnfo->sampleName[nameLength - 4]); |
377 | > | if( !strcmp( endTest, ".bss" ) ){ |
378 | > | strcpy( endTest, ".dump" ); |
379 | > | } |
380 | > | else if( !strcmp( endTest, ".mdl" ) ){ |
381 | > | strcpy( endTest, ".dump" ); |
382 | > | } |
383 | > | else{ |
384 | > | strcat( simnfo->sampleName, ".dump" ); |
385 | > | } |
386 | > | } |
387 | > | |
388 | > | strcpy( simnfo->statusName, inFileName ); |
389 | > | nameLength = strlen( simnfo->statusName ); |
390 | > | endTest = &(simnfo->statusName[nameLength - 5]); |
391 | > | if( !strcmp( endTest, ".bass" ) ){ |
392 | > | strcpy( endTest, ".stat" ); |
393 | > | } |
394 | > | else if( !strcmp( endTest, ".BASS" ) ){ |
395 | > | strcpy( endTest, ".stat" ); |
396 | > | } |
397 | > | else{ |
398 | > | endTest = &(simnfo->statusName[nameLength - 4]); |
399 | > | if( !strcmp( endTest, ".bss" ) ){ |
400 | > | strcpy( endTest, ".stat" ); |
401 | > | } |
402 | > | else if( !strcmp( endTest, ".mdl" ) ){ |
403 | > | strcpy( endTest, ".stat" ); |
404 | > | } |
405 | > | else{ |
406 | > | strcat( simnfo->statusName, ".stat" ); |
407 | > | } |
408 | > | } |
409 | > | |
410 | > | #ifdef IS_MPI |
411 | > | } |
412 | > | #endif // is_mpi |
413 | > | |
414 | // set the status, sample, and themal kick times | |
415 | < | |
415 | > | |
416 | if( the_globals->haveSampleTime() ){ | |
417 | simnfo->sampleTime = the_globals->getSampleTime(); | |
418 | simnfo->statusTime = simnfo->sampleTime; | |
# | Line 584 | Line 635 | void SimSetup::initFromBass( void ){ | |
635 | n_per_extra = (int)ceil( temp1 ); | |
636 | ||
637 | if( n_per_extra > 4){ | |
638 | < | std::cerr << "THere has been an error in constructing the non-complete lattice.\n"; |
639 | < | exit(8); |
638 | > | sprintf( painCave.errMsg, |
639 | > | "SimSetup error. There has been an error in constructing" |
640 | > | " the non-complete lattice.\n" ); |
641 | > | painCave.isFatal = 1; |
642 | > | simError(); |
643 | } | |
644 | } | |
645 | else{ | |
# | Line 690 | Line 744 | void SimSetup::makeElement( double x, double y, double | |
744 | ||
745 | current_atom = comp_stamps[current_comp]->getAtom( k ); | |
746 | if( !current_atom->havePosition() ){ | |
747 | < | std::cerr << "Component " << comp_stamps[current_comp]->getID() |
748 | < | << ", atom " << current_atom->getType() |
749 | < | << " does not have a position specified.\n" |
750 | < | << "The initialization routine is unable to give a start" |
751 | < | << " position.\n"; |
752 | < | exit(8); |
747 | > | sprintf( painCave.errMsg, |
748 | > | "SimSetup:initFromBass error.\n" |
749 | > | "\tComponent %s, atom %s does not have a position specified.\n" |
750 | > | "\tThe initialization routine is unable to give a start" |
751 | > | " position.\n", |
752 | > | comp_stamps[current_comp]->getID(), |
753 | > | current_atom->getType() ); |
754 | > | painCave.isFatal = 1; |
755 | > | simError(); |
756 | } | |
757 | ||
758 | the_atoms[current_atom_ndx]->setX( x + current_atom->getPosX() ); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |