| 6 |
|
#include "parse_me.h" |
| 7 |
|
#include "LRI.hpp" |
| 8 |
|
#include "Integrator.hpp" |
| 9 |
+ |
#include "simError.h" |
| 10 |
+ |
|
| 11 |
|
#ifdef IS_MPI |
| 12 |
|
#include "mpiBASS.h" |
| 13 |
|
#include "bassDiag.hpp" |
| 16 |
|
SimSetup::SimSetup(){ |
| 17 |
|
stamps = new MakeStamps(); |
| 18 |
|
globals = new Globals(); |
| 19 |
+ |
|
| 20 |
+ |
#ifdef IS_MPI |
| 21 |
+ |
strcpy( checkPointMsg, "SimSetup creation successful" ); |
| 22 |
+ |
MPIcheckPoint(); |
| 23 |
+ |
#endif // IS_MPI |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
SimSetup::~SimSetup(){ |
| 30 |
|
|
| 31 |
|
void SimSetup::parseFile( char* fileName ){ |
| 32 |
|
|
| 26 |
– |
inFileName = fileName; |
| 27 |
– |
set_interface_stamps( stamps, globals ); |
| 33 |
|
#ifdef IS_MPI |
| 34 |
< |
mpiEventInit(); |
| 34 |
> |
if( worldRank == 0 ){ |
| 35 |
> |
#endif // is_mpi |
| 36 |
> |
|
| 37 |
> |
inFileName = fileName; |
| 38 |
> |
set_interface_stamps( stamps, globals ); |
| 39 |
> |
|
| 40 |
> |
#ifdef IS_MPI |
| 41 |
> |
mpiEventInit(); |
| 42 |
|
#endif |
| 43 |
< |
yacc_BASS( fileName ); |
| 43 |
> |
|
| 44 |
> |
yacc_BASS( fileName ); |
| 45 |
> |
|
| 46 |
|
#ifdef IS_MPI |
| 47 |
< |
throwMPIEvent(NULL); |
| 47 |
> |
throwMPIEvent(NULL); |
| 48 |
> |
} |
| 49 |
> |
else receiveParse(); |
| 50 |
|
#endif |
| 51 |
|
|
| 52 |
|
} |
| 56 |
|
|
| 57 |
|
set_interface_stamps( stamps, globals ); |
| 58 |
|
mpiEventInit(); |
| 59 |
+ |
MPIcheckPoint(); |
| 60 |
|
mpiEventLoop(); |
| 61 |
|
|
| 62 |
|
} |
| 68 |
|
delete dumpMe; |
| 69 |
|
} |
| 70 |
|
#endif |
| 71 |
+ |
|
| 72 |
|
void SimSetup::createSim( void ){ |
| 73 |
|
|
| 74 |
|
MakeStamps *the_stamps; |
| 93 |
|
else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); |
| 94 |
|
else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); |
| 95 |
|
else{ |
| 96 |
< |
std::cerr<< "SimSetup Error. Unrecognized force field -> " |
| 97 |
< |
<< force_field << "\n"; |
| 98 |
< |
exit(8); |
| 96 |
> |
sprintf( painCave.errMsg, |
| 97 |
> |
"SimSetup Error. Unrecognized force field -> %s\n", |
| 98 |
> |
force_field ); |
| 99 |
> |
painCave.isFatal = 1; |
| 100 |
> |
simError(); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
+ |
#ifdef IS_MPI |
| 104 |
+ |
strcpy( checkPointMsg, "ForceField creation successful" ); |
| 105 |
+ |
MPIcheckPoint(); |
| 106 |
+ |
#endif // is_mpi |
| 107 |
+ |
|
| 108 |
|
// get the components and calculate the tot_nMol and indvidual n_mol |
| 109 |
|
the_components = the_globals->getComponents(); |
| 110 |
|
components_nmol = new int[n_components]; |
| 179 |
|
|
| 180 |
|
// create the atom and short range interaction arrays |
| 181 |
|
|
| 182 |
+ |
Atom::createArrays(tot_atoms); |
| 183 |
|
the_atoms = new Atom*[tot_atoms]; |
| 184 |
|
the_molecules = new Molecule[tot_nmol]; |
| 185 |
|
|
| 280 |
|
// else{ |
| 281 |
|
|
| 282 |
|
initFromBass(); |
| 257 |
– |
|
| 258 |
– |
|
| 259 |
– |
// } |
| 260 |
– |
|
| 261 |
– |
// if( the_globals->haveFinalConfig() ){ |
| 262 |
– |
// strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
| 263 |
– |
// } |
| 264 |
– |
// else{ |
| 265 |
– |
// strcpy( simnfo->finalName, inFileName ); |
| 266 |
– |
// char* endTest; |
| 267 |
– |
// int nameLength = strlen( simnfo->finalName ); |
| 268 |
– |
// endTest = &(simnfo->finalName[nameLength - 5]); |
| 269 |
– |
// if( !strcmp( endTest, ".bass" ) ){ |
| 270 |
– |
// strcpy( endTest, ".eor" ); |
| 271 |
– |
// } |
| 272 |
– |
// else if( !strcmp( endTest, ".BASS" ) ){ |
| 273 |
– |
// strcpy( endTest, ".eor" ); |
| 274 |
– |
// } |
| 275 |
– |
// else{ |
| 276 |
– |
// endTest = &(simnfo->finalName[nameLength - 4]); |
| 277 |
– |
// if( !strcmp( endTest, ".bss" ) ){ |
| 278 |
– |
// strcpy( endTest, ".eor" ); |
| 279 |
– |
// } |
| 280 |
– |
// else if( !strcmp( endTest, ".mdl" ) ){ |
| 281 |
– |
// strcpy( endTest, ".eor" ); |
| 282 |
– |
// } |
| 283 |
– |
// else{ |
| 284 |
– |
// strcat( simnfo->finalName, ".eor" ); |
| 285 |
– |
// } |
| 286 |
– |
// } |
| 287 |
– |
// } |
| 283 |
|
|
| 289 |
– |
// // make the sample and status out names |
| 284 |
|
|
| 291 |
– |
// strcpy( simnfo->sampleName, inFileName ); |
| 292 |
– |
// char* endTest; |
| 293 |
– |
// int nameLength = strlen( simnfo->sampleName ); |
| 294 |
– |
// endTest = &(simnfo->sampleName[nameLength - 5]); |
| 295 |
– |
// if( !strcmp( endTest, ".bass" ) ){ |
| 296 |
– |
// strcpy( endTest, ".dump" ); |
| 285 |
|
// } |
| 298 |
– |
// else if( !strcmp( endTest, ".BASS" ) ){ |
| 299 |
– |
// strcpy( endTest, ".dump" ); |
| 300 |
– |
// } |
| 301 |
– |
// else{ |
| 302 |
– |
// endTest = &(simnfo->sampleName[nameLength - 4]); |
| 303 |
– |
// if( !strcmp( endTest, ".bss" ) ){ |
| 304 |
– |
// strcpy( endTest, ".dump" ); |
| 305 |
– |
// } |
| 306 |
– |
// else if( !strcmp( endTest, ".mdl" ) ){ |
| 307 |
– |
// strcpy( endTest, ".dump" ); |
| 308 |
– |
// } |
| 309 |
– |
// else{ |
| 310 |
– |
// strcat( simnfo->sampleName, ".dump" ); |
| 311 |
– |
// } |
| 312 |
– |
// } |
| 286 |
|
|
| 287 |
< |
// strcpy( simnfo->statusName, inFileName ); |
| 288 |
< |
// nameLength = strlen( simnfo->statusName ); |
| 289 |
< |
// endTest = &(simnfo->statusName[nameLength - 5]); |
| 290 |
< |
// if( !strcmp( endTest, ".bass" ) ){ |
| 291 |
< |
// strcpy( endTest, ".stat" ); |
| 292 |
< |
// } |
| 293 |
< |
// else if( !strcmp( endTest, ".BASS" ) ){ |
| 294 |
< |
// strcpy( endTest, ".stat" ); |
| 295 |
< |
// } |
| 296 |
< |
// else{ |
| 297 |
< |
// endTest = &(simnfo->statusName[nameLength - 4]); |
| 298 |
< |
// if( !strcmp( endTest, ".bss" ) ){ |
| 299 |
< |
// strcpy( endTest, ".stat" ); |
| 300 |
< |
// } |
| 301 |
< |
// else if( !strcmp( endTest, ".mdl" ) ){ |
| 302 |
< |
// strcpy( endTest, ".stat" ); |
| 303 |
< |
// } |
| 304 |
< |
// else{ |
| 305 |
< |
// strcat( simnfo->statusName, ".stat" ); |
| 306 |
< |
// } |
| 307 |
< |
// } |
| 308 |
< |
|
| 287 |
> |
#ifdef IS_MPI |
| 288 |
> |
if( worldRank == TESTWRITE ){ |
| 289 |
> |
#endif // is_mpi |
| 290 |
> |
|
| 291 |
> |
fprintf( stderr, |
| 292 |
> |
"infile name is \"%s\"\n", |
| 293 |
> |
inFileName ); |
| 294 |
> |
|
| 295 |
> |
inFileName = "./butane.bass"; |
| 296 |
> |
|
| 297 |
> |
if( the_globals->haveFinalConfig() ){ |
| 298 |
> |
strcpy( simnfo->finalName, the_globals->getFinalConfig() ); |
| 299 |
> |
} |
| 300 |
> |
else{ |
| 301 |
> |
strcpy( simnfo->finalName, inFileName ); |
| 302 |
> |
char* endTest; |
| 303 |
> |
int nameLength = strlen( simnfo->finalName ); |
| 304 |
> |
endTest = &(simnfo->finalName[nameLength - 5]); |
| 305 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
| 306 |
> |
strcpy( endTest, ".eor" ); |
| 307 |
> |
} |
| 308 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
| 309 |
> |
strcpy( endTest, ".eor" ); |
| 310 |
> |
} |
| 311 |
> |
else{ |
| 312 |
> |
endTest = &(simnfo->finalName[nameLength - 4]); |
| 313 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
| 314 |
> |
strcpy( endTest, ".eor" ); |
| 315 |
> |
} |
| 316 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
| 317 |
> |
strcpy( endTest, ".eor" ); |
| 318 |
> |
} |
| 319 |
> |
else{ |
| 320 |
> |
strcat( simnfo->finalName, ".eor" ); |
| 321 |
> |
} |
| 322 |
> |
} |
| 323 |
> |
} |
| 324 |
> |
|
| 325 |
> |
// make the sample and status out names |
| 326 |
> |
|
| 327 |
> |
strcpy( simnfo->sampleName, inFileName ); |
| 328 |
> |
char* endTest; |
| 329 |
> |
int nameLength = strlen( simnfo->sampleName ); |
| 330 |
> |
endTest = &(simnfo->sampleName[nameLength - 5]); |
| 331 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
| 332 |
> |
strcpy( endTest, ".dump" ); |
| 333 |
> |
} |
| 334 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
| 335 |
> |
strcpy( endTest, ".dump" ); |
| 336 |
> |
} |
| 337 |
> |
else{ |
| 338 |
> |
endTest = &(simnfo->sampleName[nameLength - 4]); |
| 339 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
| 340 |
> |
strcpy( endTest, ".dump" ); |
| 341 |
> |
} |
| 342 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
| 343 |
> |
strcpy( endTest, ".dump" ); |
| 344 |
> |
} |
| 345 |
> |
else{ |
| 346 |
> |
strcat( simnfo->sampleName, ".dump" ); |
| 347 |
> |
} |
| 348 |
> |
} |
| 349 |
> |
|
| 350 |
> |
strcpy( simnfo->statusName, inFileName ); |
| 351 |
> |
nameLength = strlen( simnfo->statusName ); |
| 352 |
> |
endTest = &(simnfo->statusName[nameLength - 5]); |
| 353 |
> |
if( !strcmp( endTest, ".bass" ) ){ |
| 354 |
> |
strcpy( endTest, ".stat" ); |
| 355 |
> |
} |
| 356 |
> |
else if( !strcmp( endTest, ".BASS" ) ){ |
| 357 |
> |
strcpy( endTest, ".stat" ); |
| 358 |
> |
} |
| 359 |
> |
else{ |
| 360 |
> |
endTest = &(simnfo->statusName[nameLength - 4]); |
| 361 |
> |
if( !strcmp( endTest, ".bss" ) ){ |
| 362 |
> |
strcpy( endTest, ".stat" ); |
| 363 |
> |
} |
| 364 |
> |
else if( !strcmp( endTest, ".mdl" ) ){ |
| 365 |
> |
strcpy( endTest, ".stat" ); |
| 366 |
> |
} |
| 367 |
> |
else{ |
| 368 |
> |
strcat( simnfo->statusName, ".stat" ); |
| 369 |
> |
} |
| 370 |
> |
} |
| 371 |
> |
|
| 372 |
> |
#ifdef IS_MPI |
| 373 |
> |
} |
| 374 |
> |
#endif // is_mpi |
| 375 |
|
|
| 376 |
|
// set the status, sample, and themal kick times |
| 377 |
|
|
| 430 |
|
current_atom = comp_stamps[i]->getAtom( k ); |
| 431 |
|
if( current_atom->haveOrientation() ){ |
| 432 |
|
|
| 433 |
< |
dAtom = new DirectionalAtom; |
| 433 |
> |
dAtom = new DirectionalAtom(index); |
| 434 |
|
simnfo->n_oriented++; |
| 435 |
|
the_atoms[index] = dAtom; |
| 436 |
|
|
| 450 |
|
dAtom->setSUz( uz ); |
| 451 |
|
} |
| 452 |
|
else{ |
| 453 |
< |
the_atoms[index] = new GeneralAtom; |
| 453 |
> |
the_atoms[index] = new GeneralAtom(index); |
| 454 |
|
} |
| 455 |
|
the_atoms[index]->setType( current_atom->getType() ); |
| 456 |
|
the_atoms[index]->setIndex( index ); |