# | Line 60 | Line 60 | namespace OpenMD { | |
---|---|---|
60 | Globals* simParams = info->getSimParams(); | |
61 | needCompression_ = simParams->getCompressDumpFile(); | |
62 | needForceVector_ = simParams->getOutputForceVector(); | |
63 | + | needParticlePot_ = simParams->getOutputParticlePotential(); |
64 | createDumpFile_ = true; | |
65 | #ifdef HAVE_LIBZ | |
66 | if (needCompression_) { | |
# | Line 138 | Line 139 | namespace OpenMD { | |
139 | ||
140 | needCompression_ = simParams->getCompressDumpFile(); | |
141 | needForceVector_ = simParams->getOutputForceVector(); | |
142 | + | needParticlePot_ = simParams->getOutputParticlePotential(); |
143 | ||
144 | #ifdef HAVE_LIBZ | |
145 | if (needCompression_) { | |
# | Line 306 | Line 308 | namespace OpenMD { | |
308 | } | |
309 | ||
310 | const int masterNode = 0; | |
311 | < | |
311 | > | int nProc; |
312 | > | MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
313 | if (worldRank == masterNode) { | |
314 | os << " <Snapshot>\n"; | |
315 | writeFrameProperties(os, info_->getSnapshotManager()->getCurrentSnapshot()); | |
# | Line 314 | Line 317 | namespace OpenMD { | |
317 | ||
318 | os << buffer; | |
319 | ||
317 | – | int nProc; |
318 | – | MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
320 | for (int i = 1; i < nProc; ++i) { | |
321 | ||
322 | // receive the length of the string buffer that was | |
323 | // prepared by processor i | |
324 | ||
325 | + | MPI_Bcast(&i, 1, MPI_INT,masterNode,MPI_COMM_WORLD); |
326 | int recvLength; | |
327 | MPI_Recv(&recvLength, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &istatus); | |
328 | char* recvBuffer = new char[recvLength]; | |
# | Line 337 | Line 339 | namespace OpenMD { | |
339 | os.flush(); | |
340 | } else { | |
341 | int sendBufferLength = buffer.size() + 1; | |
342 | < | MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); |
343 | < | MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD); |
342 | > | int myturn = 0; |
343 | > | for (int i = 1; i < nProc; ++i){ |
344 | > | MPI_Bcast(&myturn,1, MPI_INT,masterNode,MPI_COMM_WORLD); |
345 | > | if (myturn == worldRank){ |
346 | > | MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); |
347 | > | MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD); |
348 | > | } |
349 | > | } |
350 | } | |
351 | ||
352 | #endif // is_mpi | |
# | Line 458 | Line 466 | namespace OpenMD { | |
466 | line += tempBuffer; | |
467 | } | |
468 | } | |
469 | + | if (needParticlePot_) { |
470 | + | type += "u"; |
471 | + | RealType particlePot; |
472 | + | |
473 | + | particlePot = integrableObject->getParticlePot(); |
474 | + | |
475 | + | if (isinf(particlePot) || isnan(particlePot)) { |
476 | + | sprintf( painCave.errMsg, |
477 | + | "DumpWriter detected a numerical error writing the particle " |
478 | + | " potential for object %d", index); |
479 | + | painCave.isFatal = 1; |
480 | + | simError(); |
481 | + | } |
482 | + | sprintf(tempBuffer, " %13e", particlePot); |
483 | + | line += tempBuffer; |
484 | + | } |
485 | ||
486 | sprintf(tempBuffer, "%10d %7s %s\n", index, type.c_str(), line.c_str()); | |
487 | return std::string(tempBuffer); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |