--- trunk/src/io/DumpWriter.cpp 2014/02/26 14:14:50 1969 +++ trunk/src/io/DumpWriter.cpp 2014/04/29 17:32:31 1993 @@ -64,7 +64,8 @@ namespace OpenMD { namespace OpenMD { DumpWriter::DumpWriter(SimInfo* info) - : info_(info), filename_(info->getDumpFileName()), eorFilename_(info->getFinalConfigFileName()){ + : info_(info), filename_(info->getDumpFileName()), + eorFilename_(info->getFinalConfigFileName()){ Globals* simParams = info->getSimParams(); needCompression_ = simParams->getCompressDumpFile(); @@ -72,8 +73,10 @@ namespace OpenMD { needParticlePot_ = simParams->getOutputParticlePotential(); needFlucQ_ = simParams->getOutputFluctuatingCharges(); needElectricField_ = simParams->getOutputElectricField(); + needSitePotential_ = simParams->getOutputSitePotential(); - if (needParticlePot_ || needFlucQ_ || needElectricField_) { + if (needParticlePot_ || needFlucQ_ || needElectricField_ || + needSitePotential_) { doSiteData_ = true; } else { doSiteData_ = false; @@ -121,8 +124,10 @@ namespace OpenMD { needParticlePot_ = simParams->getOutputParticlePotential(); needFlucQ_ = simParams->getOutputFluctuatingCharges(); needElectricField_ = simParams->getOutputElectricField(); + needSitePotential_ = simParams->getOutputSitePotential(); - if (needParticlePot_ || needFlucQ_ || needElectricField_) { + if (needParticlePot_ || needFlucQ_ || needElectricField_ || + needSitePotential_) { doSiteData_ = true; } else { doSiteData_ = false; @@ -170,8 +175,10 @@ namespace OpenMD { needParticlePot_ = simParams->getOutputParticlePotential(); needFlucQ_ = simParams->getOutputFluctuatingCharges(); needElectricField_ = simParams->getOutputElectricField(); + needSitePotential_ = simParams->getOutputSitePotential(); - if (needParticlePot_ || needFlucQ_ || needElectricField_) { + if (needParticlePot_ || needFlucQ_ || needElectricField_ || + needSitePotential_) { doSiteData_ = true; } else { doSiteData_ = false; @@ -304,7 +311,7 @@ namespace OpenMD { void DumpWriter::writeFrame(std::ostream& os) { #ifdef IS_MPI - MPI_Status* istatus; + MPI_Status istatus; #endif Molecule* mol; @@ -397,7 +404,7 @@ namespace OpenMD { // prepared by processor i: int recvLength; MPI_Recv(&recvLength, 1, MPI_INT, i, MPI_ANY_TAG, MPI_COMM_WORLD, - istatus); + &istatus); // create a buffer to receive the data char* recvBuffer = new char[recvLength]; @@ -405,7 +412,7 @@ namespace OpenMD { } else { // receive the data: MPI_Recv(recvBuffer, recvLength, MPI_CHAR, i, - MPI_ANY_TAG, MPI_COMM_WORLD, istatus); + MPI_ANY_TAG, MPI_COMM_WORLD, &istatus); // send it to the file: os << recvBuffer; // get rid of the receive buffer: @@ -474,7 +481,7 @@ namespace OpenMD { // prepared by processor i: int recvLength; MPI_Recv(&recvLength, 1, MPI_INT, i, MPI_ANY_TAG, MPI_COMM_WORLD, - istatus); + &istatus); // create a buffer to receive the data char* recvBuffer = new char[recvLength]; @@ -482,7 +489,7 @@ namespace OpenMD { } else { // receive the data: MPI_Recv(recvBuffer, recvLength, MPI_CHAR, i, - MPI_ANY_TAG, MPI_COMM_WORLD, istatus); + MPI_ANY_TAG, MPI_COMM_WORLD, &istatus); // send it to the file: os << recvBuffer; // get rid of the receive buffer: @@ -711,7 +718,22 @@ namespace OpenMD { } } - + if (needSitePotential_) { + if (storageLayout & DataStorage::dslSitePotential) { + type += "s"; + RealType sPot = sd->getSitePotential(); + if (isinf(sPot) || isnan(sPot) ) { + sprintf( painCave.errMsg, + "DumpWriter detected a numerical error writing the" + " site potential for object %s", id.c_str()); + painCave.isFatal = 1; + simError(); + } + sprintf(tempBuffer, " %13e ", sPot); + line += tempBuffer; + } + } + if (needParticlePot_) { if (storageLayout & DataStorage::dslParticlePot) { type += "u"; @@ -737,8 +759,9 @@ namespace OpenMD { } void DumpWriter::writeEor() { - std::ostream* eorStream; - + + std::ostream* eorStream = NULL; + #ifdef IS_MPI if (worldRank == 0) { #endif // is_mpi