--- trunk/mdtools/interface_implementation/SimSetup.cpp 2002/09/30 20:35:42 124 +++ trunk/mdtools/interface_implementation/SimSetup.cpp 2002/11/14 22:00:44 176 @@ -6,11 +6,21 @@ #include "parse_me.h" #include "LRI.hpp" #include "Integrator.hpp" -#include "mpiInterface.h" +#include "simError.h" +#ifdef IS_MPI +#include "mpiBASS.h" +#include "bassDiag.hpp" +#endif + SimSetup::SimSetup(){ stamps = new MakeStamps(); globals = new Globals(); + +#ifdef IS_MPI + strcpy( checkPointMsg, "SimSetup creation successful" ); + MPIcheckPoint(); +#endif // IS_MPI } SimSetup::~SimSetup(){ @@ -20,26 +30,43 @@ void SimSetup::parseFile( char* fileName ){ void SimSetup::parseFile( char* fileName ){ - inFileName = fileName; - set_interface_stamps( stamps, globals ); -#ifdef MPI - mpiEventInit(); +#ifdef IS_MPI + if( worldRank == 0 ){ +#endif // is_mpi + + inFileName = fileName; + set_interface_stamps( stamps, globals ); + +#ifdef IS_MPI + mpiEventInit(); #endif - yacc_BASS( fileName ); -#ifdef MPI - throwMPIEvent(NULL); + + yacc_BASS( fileName ); + +#ifdef IS_MPI + throwMPIEvent(NULL); + } + else receiveParse(); #endif } -#ifdef MPI +#ifdef IS_MPI void SimSetup::receiveParse(void){ set_interface_stamps( stamps, globals ); mpiEventInit(); + MPIcheckPoint(); mpiEventLoop(); } + + +void SimSetup::testMe(void){ + bassDiag* dumpMe = new bassDiag(globals,stamps); + dumpMe->dumpStamps(); + delete dumpMe; +} #endif void SimSetup::createSim( void ){ @@ -66,10 +93,17 @@ void SimSetup::createSim( void ){ else if( !strcmp( force_field, "DipoleTest" ) ) the_ff = new DipoleTestFF(); else if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); else{ - std::cerr<< "SimSetup Error. Unrecognized force field -> " - << force_field << "\n"; - exit(8); + sprintf( painCave.errMsg, + "SimSetup Error. Unrecognized force field -> %s\n", + force_field ); + painCave.isFatal = 1; + simError(); } + +#ifdef IS_MPI + strcpy( checkPointMsg, "ForceField creation successful" ); + MPIcheckPoint(); +#endif // is_mpi // get the components and calculate the tot_nMol and indvidual n_mol the_components = the_globals->getComponents(); @@ -146,6 +180,7 @@ void SimSetup::createSim( void ){ // create the atom and short range interaction arrays the_atoms = new Atom*[tot_atoms]; + Atom::createArrays(tot_atoms); the_molecules = new Molecule[tot_nmol]; @@ -382,7 +417,7 @@ void SimSetup::makeAtoms( void ){ current_atom = comp_stamps[i]->getAtom( k ); if( current_atom->haveOrientation() ){ - dAtom = new DirectionalAtom; + dAtom = new DirectionalAtom(index); simnfo->n_oriented++; the_atoms[index] = dAtom; @@ -402,7 +437,7 @@ void SimSetup::makeAtoms( void ){ dAtom->setSUz( uz ); } else{ - the_atoms[index] = new GeneralAtom; + the_atoms[index] = new GeneralAtom(index); } the_atoms[index]->setType( current_atom->getType() ); the_atoms[index]->setIndex( index );