--- trunk/OOPSE/libmdtools/DumpWriter.cpp 2004/05/27 00:48:12 1198 +++ trunk/OOPSE/libmdtools/DumpWriter.cpp 2004/06/07 14:26:33 1252 @@ -170,7 +170,8 @@ void DumpWriter::writeFrame( vector& outFil char tempBuffer[BUFFERSIZE]; char writeLine[BUFFERSIZE]; - int i, k; + int i; + unsigned int k; #ifdef IS_MPI @@ -294,11 +295,11 @@ void DumpWriter::writeFrame( vector& outFil } else strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); + + for(k = 0; k < outFile.size(); k++) + *outFile[k] << writeLine; } - - for(k = 0; k < outFile.size(); k++) - *outFile[k] << writeLine; } #else // is_mpi @@ -325,7 +326,7 @@ void DumpWriter::writeFrame( vector& outFil // Node 0 needs a list of the magic potatoes for each processor; - nProc = mpiSim->getNprocessors(); + nProc = mpiSim->getNProcessors(); potatoes = new int[nProc]; //write out the comment lines @@ -353,7 +354,7 @@ void DumpWriter::writeFrame( vector& outFil currentIndex = 0; - for (i = 0 ; i < mpiSim->getTotNmol(); i++ ) { + for (i = 0 ; i < mpiSim->getNMolGlobal(); i++ ) { // Get the Node number which has this atom; @@ -404,11 +405,53 @@ void DumpWriter::writeFrame( vector& outFil isDirectional = 1; else isDirectional = 0; + + // If we've survived to here, format the line: - } + if (!isDirectional) { + + sprintf( writeLine, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", + atomTypeString, + atomData[0], + atomData[1], + atomData[2], + atomData[3], + atomData[4], + atomData[5]); + + strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); + + } + else { + + sprintf( writeLine, + "%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, + atomData[0], + atomData[1], + atomData[2], + atomData[3], + atomData[4], + atomData[5], + atomData[6], + atomData[7], + atomData[8], + atomData[9], + atomData[10], + atomData[11], + atomData[12]); + + } + + for(k = 0; k < outFile.size(); k++) + *outFile[k] << writeLine; + + }// end for(int l =0) potatoes[which_node] = myPotato; - } else { + } + else { haveError = 0; @@ -453,50 +496,54 @@ void DumpWriter::writeFrame( vector& outFil atomData[12] = ji[2]; } - } + // If we've survived to here, format the line: + + if (!isDirectional) { + + sprintf( writeLine, + "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", + atomTypeString, + atomData[0], + atomData[1], + atomData[2], + atomData[3], + atomData[4], + atomData[5]); + + strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); + + } + else { + + sprintf( writeLine, + "%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, + atomData[0], + atomData[1], + atomData[2], + atomData[3], + atomData[4], + atomData[5], + atomData[6], + atomData[7], + atomData[8], + atomData[9], + atomData[10], + atomData[11], + atomData[12]); + + } + + for(k = 0; k < outFile.size(); k++) + *outFile[k] << writeLine; + + + }//end for(iter = integrableObject.begin()) currentIndex++; } - // If we've survived to here, format the line: - - if (!isDirectional) { - - sprintf( writeLine, - "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t", - atomTypeString, - atomData[0], - atomData[1], - atomData[2], - atomData[3], - atomData[4], - atomData[5]); - - strcat( writeLine, "0.0\t0.0\t0.0\t0.0\t0.0\t0.0\t0.0\n" ); - - } else { - - sprintf( writeLine, - "%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, - atomData[0], - atomData[1], - atomData[2], - atomData[3], - atomData[4], - atomData[5], - atomData[6], - atomData[7], - atomData[8], - atomData[9], - atomData[10], - atomData[11], - atomData[12]); - - } - - for(k = 0; k < outFile.size(); k++) - *outFile[k] << writeLine; - } + + }//end for(i = 0; i < mpiSim->getNmol()) for(k = 0; k < outFile.size(); k++) outFile[k]->flush(); @@ -517,7 +564,7 @@ void DumpWriter::writeFrame( vector& outFil myPotato = 0; currentIndex = 0; - for (i = 0 ; i < mpiSim->getTotNmol(); i++ ) { + for (i = 0 ; i < mpiSim->getNMolGlobal(); i++ ) { // Am I the node which has this integrableObject?