# | Line 59 | 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(); |
65 | < | cerr << "DW npp = " << needParticlePot_ << "\n"; |
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 100 | 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 139 | 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 430 | Line 438 | namespace OpenMD { | |
438 | ||
439 | if (needForceVector_) { | |
440 | type += "f"; | |
441 | < | Vector3d frc; |
434 | < | |
435 | < | frc = integrableObject->getFrc(); |
436 | < | |
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 449 | Line 454 | namespace OpenMD { | |
454 | ||
455 | if (integrableObject->isDirectional()) { | |
456 | type += "t"; | |
457 | < | Vector3d trq; |
453 | < | |
454 | < | trq = integrableObject->getTrq(); |
455 | < | |
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 461 | Line 463 | namespace OpenMD { | |
463 | " for object %d", index); | |
464 | painCave.isFatal = 1; | |
465 | simError(); | |
466 | < | } |
465 | < | |
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; |
474 | < | |
475 | < | particlePot = integrableObject->getParticlePot(); |
476 | < | |
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 485 | 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 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |