--- trunk/mdtools/interface_implementation/SimSetup.cpp 2002/12/11 20:39:41 205 +++ trunk/mdtools/interface_implementation/SimSetup.cpp 2002/12/19 21:59:51 215 @@ -10,6 +10,7 @@ #ifdef IS_MPI #include "mpiBASS.h" +#include "mpiSimulation.hpp" #include "bassDiag.hpp" #endif @@ -92,6 +93,7 @@ void SimSetup::createSim( void ){ if( !strcmp( force_field, "TraPPE" ) ) the_ff = new TraPPEFF(); else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); + else if( !strcmp( force_field, "LJ" ) ) the_ff = new LJ_FF(); else{ sprintf( painCave.errMsg, "SimSetup Error. Unrecognized force field -> %s\n", @@ -234,7 +236,7 @@ void SimSetup::createSim( void ){ // divide the molecules among processors here. - mpiSimulation* mpiSim = new mpiSimulation( simnfo ); + mpiSim = new mpiSimulation( simnfo ); mpiSim->divideLabor(); @@ -405,15 +407,21 @@ void SimSetup::createSim( void ){ -// if( the_globals->haveInitialConfig() ){ -// InitializeFromFile* fileInit; -// fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); - -// fileInit->read_xyz( simnfo ); // default velocities on + if( the_globals->haveInitialConfig() ){ + + InitializeFromFile* fileInit; +#ifdef IS_MPI // is_mpi + if( worldRank == 0 ){ +#endif //is_mpi + fileInit = new InitializeFromFile( the_globals->getInitialConfig() ); +#ifdef IS_MPI + }else fileInit = new InitializeFromFile( NULL ); +#endif + fileInit->read_xyz( simnfo ); // default velocities on -// delete fileInit; -// } -// else{ + delete fileInit; + } + else{ #ifdef IS_MPI @@ -428,8 +436,10 @@ void SimSetup::createSim( void ){ initFromBass(); -#endif // is_mpi - + +#endif + } + #ifdef IS_MPI strcpy( checkPointMsg, "Successfully read in the initial configuration" ); MPIcheckPoint(); @@ -439,7 +449,7 @@ void SimSetup::createSim( void ){ - // } + #ifdef IS_MPI if( worldRank == 0 ){ @@ -575,8 +585,8 @@ void SimSetup::makeAtoms( void ){ for( j=0; jmpiSim->getMyMolStart() <= molIndex && - molIndex <= simnfo->mpiSim->getMyMolEnd() ){ + if( mpiSim->getMyMolStart() <= molIndex && + molIndex <= mpiSim->getMyMolEnd() ){ #endif // is_mpi molStart = index; @@ -642,14 +652,15 @@ void SimSetup::makeBonds( void ){ the_bonds = new bond_pair[tot_bonds]; index = 0; offset = 0; - molIndex = 0; + molIndex = 0;g1 + for( i=0; impiSim->getMyMolStart() <= molIndex && - molIndex <= simnfo->mpiSim->getMyMolEnd() ){ + if( mpiSim->getMyMolStart() <= molIndex && + molIndex <= mpiSim->getMyMolEnd() ){ #endif // is_mpi for( k=0; kgetNBonds(); k++ ){ @@ -692,8 +703,8 @@ void SimSetup::makeBends( void ){ for( j=0; jmpiSim->getMyMolStart() <= molIndex && - molIndex <= simnfo->mpiSim->getMyMolEnd() ){ + if( mpiSim->getMyMolStart() <= molIndex && + molIndex <= mpiSim->getMyMolEnd() ){ #endif // is_mpi for( k=0; kgetNBends(); k++ ){ @@ -737,8 +748,8 @@ void SimSetup::makeTorsions( void ){ for( j=0; jmpiSim->getMyMolStart() <= molIndex && - molIndex <= simnfo->mpiSim->getMyMolEnd() ){ + if( mpiSim->getMyMolStart() <= molIndex && + molIndex <= mpiSim->getMyMolEnd() ){ #endif // is_mpi for( k=0; kgetNTorsions(); k++ ){