--- trunk/OOPSE/libmdtools/DumpWriter.cpp 2004/01/09 20:29:32 916 +++ trunk/OOPSE/libmdtools/DumpWriter.cpp 2004/01/12 20:37:59 926 @@ -161,6 +161,7 @@ void DumpWriter::writeDump( double currentTime ){ #else // is_mpi /* code to find maximum tag value */ + int *tagub, flag, MAXTAG; MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, &tagub, &flag); if (flag) { @@ -227,12 +228,13 @@ void DumpWriter::writeDump( double currentTime ){ MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node, myPotato, MPI_COMM_WORLD, &istatus); - strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE); + //strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE); // Null terminate the atomTypeString just in case: - atomTypeString[strlen(atomTypeString) - 1] = '\0'; - + //atomTypeString[strlen(atomTypeString) - 1] = '\0'; + atomTypeString = MPIatomTypeString; + myPotato++; MPI_Recv(&isDirectional, 1, MPI_INT, which_node, @@ -308,56 +310,57 @@ void DumpWriter::writeDump( double currentTime ){ if(haveError) DieDieDie(); - // If we've survived to here, format the line: - - if (!isDirectional) { - - sprintf( tempBuffer, - "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", - atomTypeString, - atomData6[0], - atomData6[1], - atomData6[2], - atomData6[3], - atomData6[4], - atomData6[5]); - - strcpy( writeLine, tempBuffer ); - strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); - - } else { - - sprintf( tempBuffer, - "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", - atomTypeString, - atomData13[0], - atomData13[1], - atomData13[2], - atomData13[3], - atomData13[4], - atomData13[5], - atomData13[6], - atomData13[7], - atomData13[8], - atomData13[9], - atomData13[10], - atomData13[11], - atomData13[12]); - - strcat( writeLine, tempBuffer ); - - } + } + // If we've survived to here, format the line: + + if (!isDirectional) { + + sprintf( tempBuffer, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", + atomTypeString, + atomData6[0], + atomData6[1], + atomData6[2], + atomData6[3], + atomData6[4], + atomData6[5]); + + strcpy( writeLine, tempBuffer ); + strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); + + } else { + + sprintf( tempBuffer, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", + atomTypeString, + atomData13[0], + atomData13[1], + atomData13[2], + atomData13[3], + atomData13[4], + atomData13[5], + atomData13[6], + atomData13[7], + atomData13[8], + atomData13[9], + atomData13[10], + atomData13[11], + atomData13[12]); + + strcat( writeLine, tempBuffer ); - outFile << writeLine; - outFile.flush(); } + + outFile << writeLine; + outFile.flush(); } + outFile.flush(); sprintf( checkPointMsg, "Sucessfully took a dump.\n"); MPIcheckPoint(); - + delete[] potatoes; } else { // worldRank != 0, so I'm a remote node. @@ -381,8 +384,8 @@ void DumpWriter::writeDump( double currentTime ){ MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus); } - - local_index=-1; + which_atom = i; + local_index=-1; for (j=0; (jgetMyNlocal()) && (local_index < 0); j++) { if (atoms[j]->getGlobalIndex() == which_atom) local_index = j; } @@ -659,12 +662,8 @@ void DumpWriter::writeFinal(double finalTime){ MPI_Recv(MPIatomTypeString, MINIBUFFERSIZE, MPI_CHAR, which_node, myPotato, MPI_COMM_WORLD, &istatus); - strncpy(atomTypeString, MPIatomTypeString, MINIBUFFERSIZE); - - // Null terminate the atomTypeString just in case: - - atomTypeString[strlen(atomTypeString) - 1] = '\0'; - + atomTypeString = MPIatomTypeString; + myPotato++; MPI_Recv(&isDirectional, 1, MPI_INT, which_node, @@ -676,6 +675,7 @@ void DumpWriter::writeFinal(double finalTime){ MPI_Recv(atomData13, 13, MPI_DOUBLE, which_node, myPotato, MPI_COMM_WORLD, &istatus); } else { + printf("inside \n"); MPI_Recv(atomData6, 6, MPI_DOUBLE, which_node, myPotato, MPI_COMM_WORLD, &istatus); } @@ -740,54 +740,58 @@ void DumpWriter::writeFinal(double finalTime){ if(haveError) DieDieDie(); - // If we've survived to here, format the line: - - if (!isDirectional) { + } - sprintf( tempBuffer, - "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", - atomTypeString, - atomData6[0], - atomData6[1], - atomData6[2], - atomData6[3], - atomData6[4], - atomData6[5]); - - strcpy( writeLine, tempBuffer ); - strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); - } else { - - sprintf( tempBuffer, - "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", - atomTypeString, - atomData13[0], - atomData13[1], - atomData13[2], - atomData13[3], - atomData13[4], - atomData13[5], - atomData13[6], - atomData13[7], - atomData13[8], - atomData13[9], - atomData13[10], - atomData13[11], - atomData13[12]); - - strcat( writeLine, tempBuffer ); - - } + // If we've survived to here, format the line: + + if (!isDirectional) { + + sprintf( tempBuffer, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", + atomTypeString, + atomData6[0], + atomData6[1], + atomData6[2], + atomData6[3], + atomData6[4], + atomData6[5]); + + strcpy( writeLine, tempBuffer ); + strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); + + } else { + + sprintf( tempBuffer, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n", + atomTypeString, + atomData13[0], + atomData13[1], + atomData13[2], + atomData13[3], + atomData13[4], + atomData13[5], + atomData13[6], + atomData13[7], + atomData13[8], + atomData13[9], + atomData13[10], + atomData13[11], + atomData13[12]); + + strcat( writeLine, tempBuffer ); - finalOut << writeLine; - finalOut.flush(); } + + finalOut << writeLine; + finalOut.flush(); } - + finalOut.flush(); sprintf( checkPointMsg, "Sucessfully took a dump.\n"); + delete[] potatoes; + MPIcheckPoint(); } else { @@ -813,7 +817,7 @@ void DumpWriter::writeFinal(double finalTime){ MPI_Recv(&myPotato, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &istatus); } - + which_atom = i; local_index=-1; for (j=0; (jgetMyNlocal()) && (local_index < 0); j++) { if (atoms[j]->getGlobalIndex() == which_atom) local_index = j;