--- trunk/src/io/DumpWriter.cpp 2011/08/10 15:52:05 1609 +++ trunk/src/io/DumpWriter.cpp 2011/08/12 14:37:25 1610 @@ -60,6 +60,7 @@ namespace OpenMD { Globals* simParams = info->getSimParams(); needCompression_ = simParams->getCompressDumpFile(); needForceVector_ = simParams->getOutputForceVector(); + needParticlePot_ = simParams->getOutputParticlePotential(); createDumpFile_ = true; #ifdef HAVE_LIBZ if (needCompression_) { @@ -99,6 +100,7 @@ namespace OpenMD { needCompression_ = simParams->getCompressDumpFile(); needForceVector_ = simParams->getOutputForceVector(); + needParticlePot_ = simParams->getOutputParticlePotential(); createDumpFile_ = true; #ifdef HAVE_LIBZ if (needCompression_) { @@ -138,6 +140,7 @@ namespace OpenMD { needCompression_ = simParams->getCompressDumpFile(); needForceVector_ = simParams->getOutputForceVector(); + needParticlePot_ = simParams->getOutputParticlePotential(); #ifdef HAVE_LIBZ if (needCompression_) { @@ -465,6 +468,22 @@ namespace OpenMD { line += tempBuffer; } } + if (needParticlePot_) { + type += "u"; + RealType particlePot; + + particlePot = integrableObject->getParticlePot(); + + if (isinf(particlePot) || isnan(particlePot)) { + sprintf( painCave.errMsg, + "DumpWriter detected a numerical error writing the particle " + " potential for object %d", index); + painCave.isFatal = 1; + simError(); + } + sprintf(tempBuffer, " %13e", particlePot); + line += tempBuffer; + } sprintf(tempBuffer, "%10d %7s %s\n", index, type.c_str(), line.c_str()); return std::string(tempBuffer);