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

Comparing branches/development/src/io/DumpWriter.cpp (file contents):
Revision 1629 by gezelter, Wed Sep 14 21:15:17 2011 UTC vs.
Revision 1714 by gezelter, Sat May 19 18:12:46 2012 UTC

# Line 36 | Line 36
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"
# Line 58 | Line 59 | namespace OpenMD {
59      : info_(info), filename_(info->getDumpFileName()), eorFilename_(info->getFinalConfigFileName()){
60  
61      Globals* simParams = info->getSimParams();
62 <    needCompression_ = simParams->getCompressDumpFile();
63 <    needForceVector_ = simParams->getOutputForceVector();
64 <    needParticlePot_ = simParams->getOutputParticlePotential();
62 >    needCompression_   = simParams->getCompressDumpFile();
63 >    needForceVector_   = simParams->getOutputForceVector();
64 >    needParticlePot_   = simParams->getOutputParticlePotential();
65 >    needFlucQ_         = simParams->getOutputFluctuatingCharges();
66 >    needElectricField_ = simParams->getOutputElectricField();
67 >
68      createDumpFile_ = true;
69   #ifdef HAVE_LIBZ
70      if (needCompression_) {
# Line 98 | Line 102 | namespace OpenMD {
102      Globals* simParams = info->getSimParams();
103      eorFilename_ = filename_.substr(0, filename_.rfind(".")) + ".eor";    
104  
105 <    needCompression_ = simParams->getCompressDumpFile();
106 <    needForceVector_ = simParams->getOutputForceVector();
105 >    needCompression_   = simParams->getCompressDumpFile();
106 >    needForceVector_   = simParams->getOutputForceVector();
107 >    needParticlePot_   = simParams->getOutputParticlePotential();
108 >    needFlucQ_         = simParams->getOutputFluctuatingCharges();
109 >    needElectricField_ = simParams->getOutputElectricField();
110 >
111      createDumpFile_ = true;
112   #ifdef HAVE_LIBZ
113      if (needCompression_) {
# Line 137 | Line 145 | namespace OpenMD {
145      Globals* simParams = info->getSimParams();
146      eorFilename_ = filename_.substr(0, filename_.rfind(".")) + ".eor";    
147      
148 <    needCompression_ = simParams->getCompressDumpFile();
149 <    needForceVector_ = simParams->getOutputForceVector();
150 <    needParticlePot_ = simParams->getOutputParticlePotential();
151 <    
148 >    needCompression_   = simParams->getCompressDumpFile();
149 >    needForceVector_   = simParams->getOutputForceVector();
150 >    needParticlePot_   = simParams->getOutputParticlePotential();
151 >    needFlucQ_         = simParams->getOutputFluctuatingCharges();
152 >    needElectricField_ = simParams->getOutputElectricField();
153 >
154   #ifdef HAVE_LIBZ
155      if (needCompression_) {
156        filename_ += ".gz";
# Line 428 | Line 438 | namespace OpenMD {
438  
439      if (needForceVector_) {
440        type += "f";
441 <      Vector3d frc;
432 <
433 <      frc = integrableObject->getFrc();
434 <
441 >      Vector3d frc = integrableObject->getFrc();
442        if (isinf(frc[0]) || isnan(frc[0]) ||
443            isinf(frc[1]) || isnan(frc[1]) ||
444            isinf(frc[2]) || isnan(frc[2]) ) {      
# Line 447 | Line 454 | namespace OpenMD {
454        
455        if (integrableObject->isDirectional()) {
456          type += "t";
457 <        Vector3d trq;
451 <        
452 <        trq = integrableObject->getTrq();
453 <        
457 >        Vector3d trq = integrableObject->getTrq();        
458          if (isinf(trq[0]) || isnan(trq[0]) ||
459              isinf(trq[1]) || isnan(trq[1]) ||
460              isinf(trq[2]) || isnan(trq[2]) ) {      
# Line 459 | Line 463 | namespace OpenMD {
463                     " for object %d", index);      
464            painCave.isFatal = 1;
465            simError();
466 <        }
463 <        
466 >        }        
467          sprintf(tempBuffer, " %13e %13e %13e",
468                  trq[0], trq[1], trq[2]);
469          line += tempBuffer;
470        }      
471      }
472 +
473      if (needParticlePot_) {
474        type += "u";
475 <      RealType particlePot;
472 <
473 <      particlePot = integrableObject->getParticlePot();
474 <
475 >      RealType particlePot = integrableObject->getParticlePot();
476        if (isinf(particlePot) || isnan(particlePot)) {      
477          sprintf( painCave.errMsg,
478                   "DumpWriter detected a numerical error writing the particle "
# Line 483 | Line 484 | namespace OpenMD {
484        line += tempBuffer;
485      }
486      
487 +    if (needFlucQ_) {
488 +      type += "cw";
489 +      RealType fqPos = integrableObject->getFlucQPos();
490 +      if (isinf(fqPos) || isnan(fqPos) ) {      
491 +        sprintf( painCave.errMsg,
492 +                 "DumpWriter detected a numerical error writing the"
493 +                 " fluctuating charge for object %d", index);      
494 +        painCave.isFatal = 1;
495 +        simError();
496 +      }
497 +      sprintf(tempBuffer, " %13e ", fqPos);
498 +      line += tempBuffer;
499 +    
500 +      RealType fqVel = integrableObject->getFlucQVel();
501 +      if (isinf(fqVel) || isnan(fqVel) ) {      
502 +        sprintf( painCave.errMsg,
503 +                 "DumpWriter detected a numerical error writing the"
504 +                 " fluctuating charge velocity for object %d", index);      
505 +        painCave.isFatal = 1;
506 +        simError();
507 +      }
508 +      sprintf(tempBuffer, " %13e ", fqVel);
509 +      line += tempBuffer;
510 +
511 +      if (needForceVector_) {
512 +        type += "g";
513 +        RealType fqFrc = integrableObject->getFlucQFrc();        
514 +        if (isinf(fqFrc) || isnan(fqFrc) ) {      
515 +          sprintf( painCave.errMsg,
516 +                   "DumpWriter detected a numerical error writing the"
517 +                   " fluctuating charge force for object %d", index);      
518 +          painCave.isFatal = 1;
519 +          simError();
520 +        }
521 +        sprintf(tempBuffer, " %13e ", fqFrc);        
522 +        line += tempBuffer;
523 +      }
524 +    }
525 +
526 +    if (needElectricField_) {
527 +      type += "e";
528 +      Vector3d eField= integrableObject->getElectricField();
529 +      if (isinf(eField[0]) || isnan(eField[0]) ||
530 +          isinf(eField[1]) || isnan(eField[1]) ||
531 +          isinf(eField[2]) || isnan(eField[2]) ) {      
532 +        sprintf( painCave.errMsg,
533 +                 "DumpWriter detected a numerical error writing the electric"
534 +                 " field for object %d", index);      
535 +        painCave.isFatal = 1;
536 +        simError();
537 +      }
538 +      sprintf(tempBuffer, " %13e %13e %13e",
539 +              eField[0], eField[1], eField[2]);
540 +      line += tempBuffer;
541 +    }
542 +
543      sprintf(tempBuffer, "%10d %7s %s\n", index, type.c_str(), line.c_str());
544      return std::string(tempBuffer);
545    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines