--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/10 20:08:56 489 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/11 15:16:59 490 @@ -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,14 @@ 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,6 +322,9 @@ void SimSetup::createSim( void ){ local_bonds = 0; local_bends = 0; local_torsions = 0; + globalAtomIndex = 0; + + for( i=0; igetNTorsions(); 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; + if (worldRank != 0) { + for (i =0; i < tot_atoms; i++){ + std::cerr << "i = " << i << " molMembershipArray[i] = " << simnfo->molMembershipArray[i] << "\n"; + } + } simnfo->n_atoms = mpiSim->getMyNlocal(); @@ -393,11 +404,16 @@ void SimSetup::createSim( void ){ #else // is_mpi molIndex = 0; + globalAtomIndex = 0; for(i=0; igetNAtoms(); k++) { + simnfo->molMembershipArray[globalAtomIndex] = molIndex; + globalAtomIndex++; + } molIndex++; } } @@ -487,13 +503,9 @@ 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() ) { simnfo->useReactionField = 1;