--- trunk/OOPSE/libmdtools/DumpReader.cpp 2004/04/19 17:44:48 1119 +++ trunk/OOPSE/libmdtools/DumpReader.cpp 2004/05/27 00:48:12 1198 @@ -273,7 +273,9 @@ void DumpReader :: readSet( int whichFrame ){ int *MolToProcMap = mpiSim->getMolToProcMap(); int localIndex; int nCurObj; + int nitems; + nTotObjs = simnfo->getTotIntegrableObjects(); haveError = 0; if (worldRank == 0) { fsetpos(inFile, framePos[whichFrame]); @@ -286,12 +288,12 @@ void DumpReader :: readSet( int whichFrame ){ simError(); } - nTotObjs = atoi( read_buffer ); + nitems = atoi( read_buffer ); // Check to see that the number of integrable objects in the intial configuration file is the // same as declared in simBass. - if( nTotObjs != simnfo->getTotIntegrableObjects()){ + if( nTotObjs != nitems){ sprintf( painCave.errMsg, "DumpReadererror. %s n_atoms, %d, " "does not match the BASS file's n_atoms, %d.\n", @@ -354,7 +356,7 @@ void DumpReader :: readSet( int whichFrame ){ if(haveError) nodeZeroError(); - parseDumpLine(read_buffer, integrableObjects[i]); + parseDumpLine(read_buffer, integrableObjects[j]); } @@ -363,10 +365,10 @@ void DumpReader :: readSet( int whichFrame ){ else{ //molecule belongs to slave nodes - MPI_Recv(&nCurObj, 1, MPI_INT, 0, + MPI_Recv(&nCurObj, 1, MPI_INT, which_node, TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); - for(j=0; j < integrableObjects.size(); j++){ + for(j=0; j < nCurObj; j++){ eof_test = fgets(read_buffer, sizeof(read_buffer), inFile); if(eof_test == NULL){ @@ -393,6 +395,16 @@ void DumpReader :: readSet( int whichFrame ){ } else{ //actions taken at slave nodes + MPI_Bcast(read_buffer, BUFFERSIZE, MPI_CHAR, 0, MPI_COMM_WORLD); + + parseErr = parseCommentLine( read_buffer, simnfo); + + if( parseErr != NULL ){ + strcpy( painCave.errMsg, parseErr ); + haveError = 1; + simError(); + } + for (i=0 ; i < mpiSim->getTotNmol(); i++) { which_node = MolToProcMap[i]; @@ -411,8 +423,8 @@ void DumpReader :: readSet( int whichFrame ){ nCurObj = integrableObjects.size(); - MPI_Recv(&nCurObj, 1, MPI_INT, 0, - TAKE_THIS_TAG_INT, MPI_COMM_WORLD, &istatus); + MPI_Send(&nCurObj, 1, MPI_INT, 0, + TAKE_THIS_TAG_INT, MPI_COMM_WORLD); for(j = 0; j < integrableObjects.size(); j++){ @@ -732,7 +744,7 @@ void DumpReader::nodeZeroError( void ){ int j, myStatus; myStatus = 0; - for (j = 0; j < mpiSim->getNumberProcessors(); j++) { + for (j = 0; j < mpiSim->getNprocessors(); j++) { MPI_Send( &myStatus, 1, MPI_INT, j, TAKE_THIS_TAG_INT, MPI_COMM_WORLD); } @@ -748,4 +760,4 @@ void DumpReader::anonymousNodeDie( void ){ MPI_Finalize(); exit (0); } -#endif \ No newline at end of file +#endif