--- trunk/OOPSE/libmdtools/mpiSimulation.cpp 2004/01/19 16:09:52 958 +++ trunk/OOPSE/libmdtools/mpiSimulation.cpp 2004/04/14 15:37:41 1108 @@ -40,9 +40,7 @@ mpiSimulation::~mpiSimulation(){ } -int* mpiSimulation::divideLabor( void ){ - - int* globalIndex; +void mpiSimulation::divideLabor( ){ int nComponents; MoleculeStamp** compStamps; @@ -76,7 +74,6 @@ int* mpiSimulation::divideLabor( void ){ mpiPlug->nSRIGlobal = entryPlug->n_SRI; mpiPlug->nMolGlobal = entryPlug->n_mol; - myRandom = new randomSPRNG( baseSeed ); a = 3.0 * (double)mpiPlug->nMolGlobal / (double)mpiPlug->nAtomsGlobal; @@ -127,7 +124,7 @@ int* mpiSimulation::divideLabor( void ){ // How many atoms does this processor have? old_atoms = AtomsPerProc[which_proc]; - add_atoms = compStamps[MolComponentType[i]]->getTotAtoms(); + add_atoms = compStamps[MolComponentType[i]]->getNAtoms(); new_atoms = old_atoms + add_atoms; // If we've been through this loop too many times, we need @@ -274,16 +271,32 @@ int* mpiSimulation::divideLabor( void ){ mpiPlug->myNMol = nmol_local; mpiPlug->myNlocal = natoms_local; - globalIndex = new int[mpiPlug->myNlocal]; + globalAtomIndex.resize(mpiPlug->myNlocal); local_index = 0; for (i = 0; i < mpiPlug->nAtomsGlobal; i++) { if (AtomToProcMap[i] == mpiPlug->myNode) { - globalIndex[local_index] = i; + globalAtomIndex[local_index] = i; + + globalToLocalAtom[i] = local_index; local_index++; + } + else + globalToLocalAtom[i] = -1; } + + globalMolIndex.resize(mpiPlug->myNMol); + local_index = 0; + for (i = 0; i < mpiPlug->nMolGlobal; i++) { + if (MolToProcMap[i] == mpiPlug->myNode) { + globalMolIndex[local_index] = i; + globalToLocalMol[i] = local_index; + local_index++; + } + else + globalToLocalMol[i] = -1; + } - return globalIndex; }