--- trunk/mdtools/mpi_implementation/mpiSimulation.cpp 2002/12/05 18:53:40 195 +++ trunk/mdtools/mpi_implementation/mpiSimulation.cpp 2002/12/05 21:37:51 196 @@ -35,7 +35,7 @@ void mpiSimulation::divideLabor(int nComponents, Molec int nTarget; int molIndex, atomIndex, compIndex, compStart; int done; - int nLocal; + int nLocal, molLocal; int i; int smallDiff, bigDiff; @@ -54,6 +54,7 @@ void mpiSimulation::divideLabor(int nComponents, Molec done = 0; nLocal = 0; + molLocal = 0; if( i == myNode ){ myMolStart = molIndex; @@ -71,6 +72,7 @@ void mpiSimulation::divideLabor(int nComponents, Molec nLocal += compStamps[compIndex]->getNAtoms(); atomIndex += compStamps[compIndex]->getNAtoms(); molIndex++; + molLocal++; if ( nLocal == nTarget ) done = 1; @@ -83,6 +85,7 @@ void mpiSimulation::divideLabor(int nComponents, Molec if( bigDiff < smallDiff ) done = 1; else{ molIndex--; + molLocal--; atomIndex -= compStamps[compIndex]->getNAtoms(); nLocal -= compStamps[compIndex]->getNAtoms(); done = 1; @@ -94,6 +97,7 @@ void mpiSimulation::divideLabor(int nComponents, Molec myMolEnd = (molIndex - 1); myAtomEnd = (atomIndex - 1); myNlocal = nLocal; + myMol = molLocal; } numerator = (double)( entryPlug->n_atoms - atomIndex ); @@ -107,6 +111,7 @@ void mpiSimulation::divideLabor(int nComponents, Molec myAtomStart = atomIndex; nLocal = 0; + molLocal = 0; while( compIndex < nComponents ){ if( (molIndex-compStart) >= componentsNmol[compIndex] ){ @@ -118,11 +123,13 @@ void mpiSimulation::divideLabor(int nComponents, Molec nLocal += compStamps[compIndex]->getNAtoms(); atomIndex += compStamps[compIndex]->getNAtoms(); molIndex++; + molLocal++; } myMolEnd = (molIndex - 1); myAtomEnd = (atomIndex - 1); - myNlocal = nLocal; + myNlocal = nLocal; + myMol = molLocal; } @@ -141,4 +148,6 @@ void mpiSimulation::divideLabor(int nComponents, Molec sprintf( checkPointMsg, "Successfully divided the molecules among the processors.\n" ); MPIcheckPoint(); + + // lets create the identity array }