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 1971 by gezelter, Fri Feb 28 13:25:13 2014 UTC vs.
Revision 1993 by gezelter, Tue Apr 29 17:32:31 2014 UTC

# Line 64 | Line 64 | namespace OpenMD {
64   namespace OpenMD {
65  
66    DumpWriter::DumpWriter(SimInfo* info)
67 <    : info_(info), filename_(info->getDumpFileName()), eorFilename_(info->getFinalConfigFileName()){
67 >    : info_(info), filename_(info->getDumpFileName()),
68 >      eorFilename_(info->getFinalConfigFileName()){
69  
70      Globals* simParams = info->getSimParams();
71      needCompression_   = simParams->getCompressDumpFile();
# Line 72 | Line 73 | namespace OpenMD {
73      needParticlePot_   = simParams->getOutputParticlePotential();
74      needFlucQ_         = simParams->getOutputFluctuatingCharges();
75      needElectricField_ = simParams->getOutputElectricField();
76 +    needSitePotential_ = simParams->getOutputSitePotential();
77  
78 <    if (needParticlePot_ || needFlucQ_ || needElectricField_) {
78 >    if (needParticlePot_ || needFlucQ_ || needElectricField_ ||
79 >        needSitePotential_) {
80        doSiteData_ = true;
81      } else {
82        doSiteData_ = false;
# Line 121 | Line 124 | namespace OpenMD {
124      needParticlePot_   = simParams->getOutputParticlePotential();
125      needFlucQ_         = simParams->getOutputFluctuatingCharges();
126      needElectricField_ = simParams->getOutputElectricField();
127 +    needSitePotential_ = simParams->getOutputSitePotential();
128  
129 <    if (needParticlePot_ || needFlucQ_ || needElectricField_) {
129 >    if (needParticlePot_ || needFlucQ_ || needElectricField_ ||
130 >        needSitePotential_) {
131        doSiteData_ = true;
132      } else {
133        doSiteData_ = false;
# Line 170 | Line 175 | namespace OpenMD {
175      needParticlePot_   = simParams->getOutputParticlePotential();
176      needFlucQ_         = simParams->getOutputFluctuatingCharges();
177      needElectricField_ = simParams->getOutputElectricField();
178 +    needSitePotential_ = simParams->getOutputSitePotential();
179  
180 <    if (needParticlePot_ || needFlucQ_ || needElectricField_) {
180 >    if (needParticlePot_ || needFlucQ_ || needElectricField_ ||
181 >        needSitePotential_) {
182        doSiteData_ = true;
183      } else {
184        doSiteData_ = false;
# Line 711 | Line 718 | namespace OpenMD {
718        }
719      }
720  
721 <
721 >    if (needSitePotential_) {
722 >      if (storageLayout & DataStorage::dslSitePotential) {          
723 >        type += "s";
724 >        RealType sPot = sd->getSitePotential();        
725 >        if (isinf(sPot) || isnan(sPot) ) {      
726 >          sprintf( painCave.errMsg,
727 >                   "DumpWriter detected a numerical error writing the"
728 >                   " site potential for object %s", id.c_str());      
729 >          painCave.isFatal = 1;
730 >          simError();
731 >        }
732 >        sprintf(tempBuffer, " %13e ", sPot);        
733 >        line += tempBuffer;
734 >      }
735 >    }    
736 >    
737      if (needParticlePot_) {
738        if (storageLayout & DataStorage::dslParticlePot) {
739          type += "u";
# Line 737 | Line 759 | namespace OpenMD {
759    }
760  
761    void DumpWriter::writeEor() {
762 <    std::ostream* eorStream;
763 <    
762 >
763 >    std::ostream* eorStream = NULL;
764 >
765   #ifdef IS_MPI
766      if (worldRank == 0) {
767   #endif // is_mpi

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines