ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/io/DumpWriter.cpp
(Generate patch)

Comparing trunk/src/io/DumpWriter.cpp (file contents):
Revision 1437 by gezelter, Wed Apr 21 14:59:18 2010 UTC vs.
Revision 1610 by gezelter, Fri Aug 12 14:37:25 2011 UTC

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

Comparing trunk/src/io/DumpWriter.cpp (property svn:keywords):
Revision 1437 by gezelter, Wed Apr 21 14:59:18 2010 UTC vs.
Revision 1610 by gezelter, Fri Aug 12 14:37:25 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines