--- trunk/src/io/DumpWriter.cpp 2014/04/15 20:36:19 1983 +++ trunk/src/io/DumpWriter.cpp 2014/09/22 19:18:35 2020 @@ -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; @@ -391,6 +398,7 @@ namespace OpenMD { for (int i = 1; i < nProc; ++i) { // tell processor i to start sending us data: + MPI_Bcast(&i, 1, MPI_INT, masterNode, MPI_COMM_WORLD); // receive the length of the string buffer that was @@ -420,6 +428,7 @@ namespace OpenMD { MPI_Bcast(&myturn, 1, MPI_INT, masterNode, MPI_COMM_WORLD); if (myturn == worldRank){ // send the length of our buffer: + MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); // send our buffer: @@ -711,7 +720,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";