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 |
+ |
cerr << "DW npp = " << needParticlePot_ << "\n"; |
66 |
|
createDumpFile_ = true; |
67 |
|
#ifdef HAVE_LIBZ |
68 |
|
if (needCompression_) { |
102 |
|
|
103 |
|
needCompression_ = simParams->getCompressDumpFile(); |
104 |
|
needForceVector_ = simParams->getOutputForceVector(); |
105 |
+ |
needParticlePot_ = simParams->getOutputParticlePotential(); |
106 |
|
createDumpFile_ = true; |
107 |
|
#ifdef HAVE_LIBZ |
108 |
|
if (needCompression_) { |
142 |
|
|
143 |
|
needCompression_ = simParams->getCompressDumpFile(); |
144 |
|
needForceVector_ = simParams->getOutputForceVector(); |
145 |
+ |
needParticlePot_ = simParams->getOutputParticlePotential(); |
146 |
|
|
147 |
|
#ifdef HAVE_LIBZ |
148 |
|
if (needCompression_) { |
311 |
|
} |
312 |
|
|
313 |
|
const int masterNode = 0; |
314 |
< |
|
314 |
> |
int nProc; |
315 |
> |
MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
316 |
|
if (worldRank == masterNode) { |
317 |
|
os << " <Snapshot>\n"; |
318 |
|
writeFrameProperties(os, info_->getSnapshotManager()->getCurrentSnapshot()); |
320 |
|
|
321 |
|
os << buffer; |
322 |
|
|
317 |
– |
int nProc; |
318 |
– |
MPI_Comm_size(MPI_COMM_WORLD, &nProc); |
323 |
|
for (int i = 1; i < nProc; ++i) { |
324 |
|
|
325 |
|
// receive the length of the string buffer that was |
326 |
|
// prepared by processor i |
327 |
|
|
328 |
+ |
MPI_Bcast(&i, 1, MPI_INT,masterNode,MPI_COMM_WORLD); |
329 |
|
int recvLength; |
330 |
|
MPI_Recv(&recvLength, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &istatus); |
331 |
|
char* recvBuffer = new char[recvLength]; |
342 |
|
os.flush(); |
343 |
|
} else { |
344 |
|
int sendBufferLength = buffer.size() + 1; |
345 |
< |
MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); |
346 |
< |
MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD); |
345 |
> |
int myturn = 0; |
346 |
> |
for (int i = 1; i < nProc; ++i){ |
347 |
> |
MPI_Bcast(&myturn,1, MPI_INT,masterNode,MPI_COMM_WORLD); |
348 |
> |
if (myturn == worldRank){ |
349 |
> |
MPI_Send(&sendBufferLength, 1, MPI_INT, masterNode, 0, MPI_COMM_WORLD); |
350 |
> |
MPI_Send((void *)buffer.c_str(), sendBufferLength, MPI_CHAR, masterNode, 0, MPI_COMM_WORLD); |
351 |
> |
} |
352 |
> |
} |
353 |
|
} |
354 |
|
|
355 |
|
#endif // is_mpi |
469 |
|
line += tempBuffer; |
470 |
|
} |
471 |
|
} |
472 |
+ |
if (needParticlePot_) { |
473 |
+ |
type += "u"; |
474 |
+ |
RealType particlePot; |
475 |
+ |
|
476 |
+ |
particlePot = integrableObject->getParticlePot(); |
477 |
+ |
|
478 |
+ |
if (isinf(particlePot) || isnan(particlePot)) { |
479 |
+ |
sprintf( painCave.errMsg, |
480 |
+ |
"DumpWriter detected a numerical error writing the particle " |
481 |
+ |
" potential for object %d", index); |
482 |
+ |
painCave.isFatal = 1; |
483 |
+ |
simError(); |
484 |
+ |
} |
485 |
+ |
sprintf(tempBuffer, " %13e", particlePot); |
486 |
+ |
line += tempBuffer; |
487 |
+ |
} |
488 |
|
|
489 |
|
sprintf(tempBuffer, "%10d %7s %s\n", index, type.c_str(), line.c_str()); |
490 |
|
return std::string(tempBuffer); |