--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/09 04:06:43 483 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/06/17 21:56:15 555 @@ -67,7 +67,7 @@ void SimSetup::createSim( void ){ MakeStamps *the_stamps; Globals* the_globals; ExtendedSystem* the_extendedsystem; - int i, j; + int i, j, k, globalAtomIndex; // get the stamps and globals; the_stamps = stamps; @@ -298,16 +298,15 @@ void SimSetup::createSim( void ){ simnfo->n_torsions = tot_torsions; simnfo->n_SRI = tot_SRI; simnfo->n_mol = tot_nmol; - + simnfo->molMembershipArray = new int[tot_atoms]; + #ifdef IS_MPI // divide the molecules among processors here. mpiSim = new mpiSimulation( simnfo ); - - globalIndex = mpiSim->divideLabor(); // set up the local variables @@ -324,11 +323,14 @@ void SimSetup::createSim( void ){ local_bonds = 0; local_bends = 0; local_torsions = 0; + globalAtomIndex = 0; + + for( i=0; igetNAtoms(); local_bonds += comp_stamps[i]->getNBonds(); @@ -336,12 +338,16 @@ void SimSetup::createSim( void ){ local_torsions += comp_stamps[i]->getNTorsions(); localMol++; } - allMol++; + for (k = 0; k < comp_stamps[i]->getNAtoms(); k++) { + simnfo->molMembershipArray[globalAtomIndex] = allMol; + globalAtomIndex++; + } + + allMol++; } } local_SRI = local_bonds + local_bends + local_torsions; - simnfo->n_atoms = mpiSim->getMyNlocal(); if( local_atoms != simnfo->n_atoms ){ @@ -385,6 +391,7 @@ void SimSetup::createSim( void ){ if(mol2proc[i] == worldRank ){ the_molecules[molIndex].setStampID( molCompType[i] ); the_molecules[molIndex].setMyIndex( molIndex ); + the_molecules[molIndex].setGlobalIndex( i ); molIndex++; } } @@ -392,10 +399,16 @@ void SimSetup::createSim( void ){ #else // is_mpi molIndex = 0; + globalAtomIndex = 0; for(i=0; igetNAtoms(); k++) { + simnfo->molMembershipArray[globalAtomIndex] = molIndex; + globalAtomIndex++; + } molIndex++; } } @@ -485,12 +498,8 @@ void SimSetup::createSim( void ){ makeMolecules(); simnfo->identArray = new int[simnfo->n_atoms]; - simnfo->molMembershipArray = new int[simnfo->n_atoms]; for(i=0; in_atoms; i++){ simnfo->identArray[i] = the_atoms[i]->getIdent(); - } - for(i=0; i< simnfo->n_mol; i++) { - the_molecules[i].atomicRollCall(simnfo->molMembershipArray); } if (the_globals->getUseRF() ) { @@ -725,21 +734,16 @@ void SimSetup::createSim( void ){ if( the_globals->haveTempSet() ) simnfo->setTemp = the_globals->getTempSet(); -// // make the longe range forces and the integrator + // make the integrator -// new AllLong( simnfo ); - - if( !strcmp( force_field, "TraPPE_Ex" ) ){ + if( !strcmp( ensemble, "TraPPE_Ex" ) ){ new Symplectic(simnfo, the_ff, the_extendedsystem); } else if( !strcmp( force_field, "LJ" ) ){ new Verlet( *simnfo, the_ff, the_extendedsystem ); } - else { - std::cerr << "I'm a bug.\n"; - fprintf( stderr, "Ima bug. stderr %s\n", force_field); - } + #ifdef IS_MPI mpiSim->mpiRefresh(); #endif