--- trunk/OOPSE/libmdtools/DumpWriter.cpp 2004/01/08 18:59:36 912 +++ trunk/OOPSE/libmdtools/DumpWriter.cpp 2004/01/08 22:25:52 913 @@ -158,10 +158,15 @@ void DumpWriter::writeDump( double currentTime ){ #else // is_mpi - // first thing first, suspend fatalities. - painCave.isEventLoop = 1; + /* code to find maximum tag value */ + int *tagub, flag, MAXTAG; + MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag); + if (flag) { + MAXTAG = *tagub; + } else { + MAXTAG = 32767; + } - int myStatus; // 1 = wakeup & success; 0 = error; -1 = AllDone int haveError; MPI_Status istatus; @@ -188,18 +193,24 @@ void DumpWriter::writeDump( double currentTime ){ outFile << entry_plug->the_integrator->getAdditionalParameters(); outFile << endl; outFile.flush(); + + tag = 0; + for (i = 0 ; i < mpiSim->getTotAtoms(); i++ ) { - // Get the Node number which has this atom; + if (tag + 2 >= MAXTAG) { + // The tag was going to exceed the maximum value, so wrap around to 0: + tag = 0; + // Send the newly zeroed tag on to the other nodes: + MPI_Bcast(&tag, 1, MPI_INT, 0, MPI_COMM_WORLD); + } + + // Get the Node number which has this atom; + which_node = AtomToProcMap[i]; - + if (which_node != 0) { - atomTypeTag = 4*i; - atomIsDirectionalTag = 4*i + 1; - atomTransDataTag = 4*i + 2; - atomOrientDataTag = 4*i + 3; - MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node, atomTypeTag, MPI_COMM_WORLD, &istatus);