# | Line 10 | Line 10 | |
---|---|---|
10 | ||
11 | #ifdef IS_MPI | |
12 | #include "mpiBASS.h" | |
13 | + | #include "mpiSimulation.hpp" |
14 | #include "bassDiag.hpp" | |
15 | #endif | |
16 | ||
# | Line 92 | Line 93 | void SimSetup::createSim( void ){ | |
93 | if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF(); | |
94 | else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); | |
95 | else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); | |
96 | + | else if( !strcmp( force_field, "LJ" ) ) the_ff = new LJ_FF(); |
97 | else{ | |
98 | sprintf( painCave.errMsg, | |
99 | "SimSetup Error. Unrecognized force field -> %s\n", | |
# | Line 187 | Line 189 | void SimSetup::createSim( void ){ | |
189 | if( currentStamp == NULL ){ | |
190 | sprintf( painCave.errMsg, | |
191 | "SimSetup error: Component \"%s\" was not found in the " | |
192 | < | "list of declared molecules\n" |
192 | > | "list of declared molecules\n", |
193 | id ); | |
194 | painCave.isFatal = 1; | |
195 | simError(); | |
# | Line 234 | Line 236 | void SimSetup::createSim( void ){ | |
236 | ||
237 | // divide the molecules among processors here. | |
238 | ||
239 | < | mpiSimulation* mpiSim = new mpiSimulation( simnfo ); |
239 | > | mpiSim = new mpiSimulation( simnfo ); |
240 | ||
241 | < | mpiSim->divideLabor(); |
241 | > | globalIndex = mpiSim->divideLabor(); |
242 | ||
243 | // set up the local variables | |
244 | ||
# | Line 311 | Line 313 | void SimSetup::createSim( void ){ | |
313 | simnfo->sr_interactions = the_sris; | |
314 | simnfo->n_exclude = tot_SRI; | |
315 | simnfo->excludes = the_excludes; | |
314 | – | |
315 | – | |
316 | – | // initialize the arrays |
317 | – | |
318 | – | the_ff->setSimInfo( simnfo ); |
319 | – | |
320 | – | makeAtoms(); |
321 | – | |
322 | – | if( tot_bonds ){ |
323 | – | makeBonds(); |
324 | – | } |
316 | ||
326 | – | if( tot_bends ){ |
327 | – | makeBends(); |
328 | – | } |
317 | ||
330 | – | if( tot_torsions ){ |
331 | – | makeTorsions(); |
332 | – | } |
333 | – | |
334 | – | |
318 | // get some of the tricky things that may still be in the globals | |
319 | ||
320 | if( simnfo->n_dipoles ){ | |
# | Line 404 | Line 387 | void SimSetup::createSim( void ){ | |
387 | #endif // is_mpi | |
388 | ||
389 | ||
390 | < | |
408 | < | // if( the_globals->haveInitialConfig() ){ |
409 | < | // InitializeFromFile* fileInit; |
410 | < | // fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); |
390 | > | // initialize the arrays |
391 | ||
392 | < | // fileInit->read_xyz( simnfo ); // default velocities on |
392 | > | the_ff->setSimInfo( simnfo ); |
393 | ||
394 | < | // delete fileInit; |
395 | < | // } |
396 | < | // else{ |
394 | > | makeAtoms(); |
395 | > | |
396 | > | if( tot_bonds ){ |
397 | > | makeBonds(); |
398 | > | } |
399 | > | |
400 | > | if( tot_bends ){ |
401 | > | makeBends(); |
402 | > | } |
403 | > | |
404 | > | if( tot_torsions ){ |
405 | > | makeTorsions(); |
406 | > | } |
407 | > | |
408 | > | |
409 | > | |
410 | > | |
411 | > | |
412 | > | |
413 | > | if( the_globals->haveInitialConfig() ){ |
414 | > | |
415 | > | InitializeFromFile* fileInit; |
416 | > | #ifdef IS_MPI // is_mpi |
417 | > | if( worldRank == 0 ){ |
418 | > | #endif //is_mpi |
419 | > | fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); |
420 | > | #ifdef IS_MPI |
421 | > | }else fileInit = new InitializeFromFile( NULL ); |
422 | > | #endif |
423 | > | fileInit->read_xyz( simnfo ); // default velocities on |
424 | ||
425 | + | delete fileInit; |
426 | + | } |
427 | + | else{ |
428 | + | |
429 | #ifdef IS_MPI | |
430 | ||
431 | // no init from bass | |
# | Line 428 | Line 439 | void SimSetup::createSim( void ){ | |
439 | ||
440 | initFromBass(); | |
441 | ||
442 | < | #endif // is_mpi |
443 | < | |
442 | > | |
443 | > | #endif |
444 | > | } |
445 | > | |
446 | #ifdef IS_MPI | |
447 | strcpy( checkPointMsg, "Successfully read in the initial configuration" ); | |
448 | MPIcheckPoint(); | |
# | Line 439 | Line 452 | void SimSetup::createSim( void ){ | |
452 | ||
453 | ||
454 | ||
455 | < | // } |
455 | > | |
456 | ||
457 | #ifdef IS_MPI | |
458 | if( worldRank == 0 ){ | |
# | Line 550 | Line 563 | void SimSetup::createSim( void ){ | |
563 | if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet(); | |
564 | ||
565 | ||
566 | < | // make the longe range forces and the integrator |
566 | > | // // make the longe range forces and the integrator |
567 | ||
568 | < | new AllLong( simnfo ); |
568 | > | // new AllLong( simnfo ); |
569 | ||
570 | < | if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo ); |
570 | > | if( !strcmp( force_field, "TraPPE" ) ) new Verlet( *simnfo, the_ff ); |
571 | if( !strcmp( force_field, "DipoleTest" ) ) new Symplectic( simnfo ); | |
572 | if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo ); | |
573 | + | if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff ); |
574 | + | |
575 | } | |
576 | ||
577 | void SimSetup::makeAtoms( void ){ | |
# | Line 575 | Line 590 | void SimSetup::makeAtoms( void ){ | |
590 | for( j=0; j<components_nmol[i]; j++ ){ | |
591 | ||
592 | #ifdef IS_MPI | |
593 | < | if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
594 | < | molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
593 | > | if( mpiSim->getMyMolStart() <= molIndex && |
594 | > | molIndex <= mpiSim->getMyMolEnd() ){ |
595 | #endif // is_mpi | |
596 | ||
597 | molStart = index; | |
# | Line 630 | Line 645 | void SimSetup::makeAtoms( void ){ | |
645 | } | |
646 | } | |
647 | ||
648 | + | #ifdef IS_MPI |
649 | + | for( i=0; i<mpiSim->getMyNlocal(); i++ ) the_atoms[i]->setGlobalIndex( globalIndex[i] ); |
650 | + | |
651 | + | delete[] globalIndex; |
652 | + | #endif IS_MPI |
653 | + | |
654 | the_ff->initializeAtoms(); | |
655 | } | |
656 | ||
# | Line 643 | Line 664 | void SimSetup::makeBonds( void ){ | |
664 | index = 0; | |
665 | offset = 0; | |
666 | molIndex = 0; | |
667 | + | |
668 | for( i=0; i<n_components; i++ ){ | |
669 | ||
670 | for( j=0; j<components_nmol[i]; j++ ){ | |
671 | ||
672 | #ifdef IS_MPI | |
673 | < | if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
674 | < | molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
673 | > | if( mpiSim->getMyMolStart() <= molIndex && |
674 | > | molIndex <= mpiSim->getMyMolEnd() ){ |
675 | #endif // is_mpi | |
676 | ||
677 | for( k=0; k<comp_stamps[i]->getNBonds(); k++ ){ | |
# | Line 692 | Line 714 | void SimSetup::makeBends( void ){ | |
714 | for( j=0; j<components_nmol[i]; j++ ){ | |
715 | ||
716 | #ifdef IS_MPI | |
717 | < | if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
718 | < | molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
717 | > | if( mpiSim->getMyMolStart() <= molIndex && |
718 | > | molIndex <= mpiSim->getMyMolEnd() ){ |
719 | #endif // is_mpi | |
720 | ||
721 | for( k=0; k<comp_stamps[i]->getNBends(); k++ ){ | |
# | Line 737 | Line 759 | void SimSetup::makeTorsions( void ){ | |
759 | for( j=0; j<components_nmol[i]; j++ ){ | |
760 | ||
761 | #ifdef IS_MPI | |
762 | < | if( simnfo->mpiSim->getMyMolStart() <= molIndex && |
763 | < | molIndex <= simnfo->mpiSim->getMyMolEnd() ){ |
762 | > | if( mpiSim->getMyMolStart() <= molIndex && |
763 | > | molIndex <= mpiSim->getMyMolEnd() ){ |
764 | #endif // is_mpi | |
765 | ||
766 | for( k=0; k<comp_stamps[i]->getNTorsions(); k++ ){ |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |