| 36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
| 37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
| 38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
| 39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
| 39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
| 40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
| 41 |
|
*/ |
| 42 |
|
|
| 43 |
|
#include "io/DumpWriter.hpp" |
| 61 |
|
Globals* simParams = info->getSimParams(); |
| 62 |
|
needCompression_ = simParams->getCompressDumpFile(); |
| 63 |
|
needForceVector_ = simParams->getOutputForceVector(); |
| 64 |
+ |
needParticlePot_ = simParams->getOutputParticlePotential(); |
| 65 |
|
createDumpFile_ = true; |
| 66 |
|
#ifdef HAVE_LIBZ |
| 67 |
|
if (needCompression_) { |
| 140 |
|
|
| 141 |
|
needCompression_ = simParams->getCompressDumpFile(); |
| 142 |
|
needForceVector_ = simParams->getOutputForceVector(); |
| 143 |
+ |
needParticlePot_ = simParams->getOutputParticlePotential(); |
| 144 |
|
|
| 145 |
|
#ifdef HAVE_LIBZ |
| 146 |
|
if (needCompression_) { |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
const int masterNode = 0; |
| 312 |
< |
|
| 312 |
> |
int nProc; |
| 313 |
> |
MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
| 314 |
|
if (worldRank == masterNode) { |
| 315 |
|
os << " <Snapshot>\n"; |
| 316 |
|
writeFrameProperties(os, info_->getSnapshotManager()->getCurrentSnapshot()); |
| 318 |
|
|
| 319 |
|
os << buffer; |
| 320 |
|
|
| 317 |
– |
int nProc; |
| 318 |
– |
MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
| 321 |
|
for (int i = 1; i < nProc; ++i) { |
| 322 |
|
|
| 323 |
|
// receive the length of the string buffer that was |
| 324 |
|
// prepared by processor i |
| 325 |
|
|
| 326 |
+ |
MPI_Bcast(&i, 1, MPI_INT,masterNode,MPI_COMM_WORLD); |
| 327 |
|
int recvLength; |
| 328 |
|
MPI_Recv(&recvLength, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &istatus); |
| 329 |
|
char* recvBuffer = new char[recvLength]; |
| 340 |
|
os.flush(); |
| 341 |
|
} else { |
| 342 |
|
int sendBufferLength = buffer.size() + 1; |
| 343 |
< |
MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); |
| 344 |
< |
MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD); |
| 343 |
> |
int myturn = 0; |
| 344 |
> |
for (int i = 1; i < nProc; ++i){ |
| 345 |
> |
MPI_Bcast(&myturn,1, MPI_INT,masterNode,MPI_COMM_WORLD); |
| 346 |
> |
if (myturn == worldRank){ |
| 347 |
> |
MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); |
| 348 |
> |
MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD); |
| 349 |
> |
} |
| 350 |
> |
} |
| 351 |
|
} |
| 352 |
|
|
| 353 |
|
#endif // is_mpi |
| 467 |
|
line += tempBuffer; |
| 468 |
|
} |
| 469 |
|
} |
| 470 |
+ |
if (needParticlePot_) { |
| 471 |
+ |
type += "u"; |
| 472 |
+ |
RealType particlePot; |
| 473 |
+ |
|
| 474 |
+ |
particlePot = integrableObject->getParticlePot(); |
| 475 |
+ |
|
| 476 |
+ |
if (isinf(particlePot) || isnan(particlePot)) { |
| 477 |
+ |
sprintf( painCave.errMsg, |
| 478 |
+ |
"DumpWriter detected a numerical error writing the particle " |
| 479 |
+ |
" potential for object %d", index); |
| 480 |
+ |
painCave.isFatal = 1; |
| 481 |
+ |
simError(); |
| 482 |
+ |
} |
| 483 |
+ |
sprintf(tempBuffer, " %13e", particlePot); |
| 484 |
+ |
line += tempBuffer; |
| 485 |
+ |
} |
| 486 |
|
|
| 487 |
|
sprintf(tempBuffer, "%10d %7s %s\n", index, type.c_str(), line.c_str()); |
| 488 |
|
return std::string(tempBuffer); |