# | Line 45 | Line 45 | namespace OpenMD { | |
---|---|---|
45 | #include "utils/simError.h" | |
46 | namespace OpenMD { | |
47 | ||
48 | < | Rattle::Rattle(SimInfo* info) : info_(info), maxConsIteration_(10), consTolerance_(1.0e-6), doRattle_(false) { |
48 | > | Rattle::Rattle(SimInfo* info) : info_(info), maxConsIteration_(10), |
49 | > | consTolerance_(1.0e-6), doRattle_(false), |
50 | > | currConstraintTime_(0.0) { |
51 | ||
52 | < | if (info_->getNConstraints() > 0) |
52 | > | if (info_->getNGlobalConstraints() > 0) |
53 | doRattle_ = true; | |
54 | ||
55 | + | if (!doRattle_) return; |
56 | + | |
57 | Globals* simParams = info_->getSimParams(); | |
58 | ||
59 | if (simParams->haveDt()) { | |
60 | dt_ = simParams->getDt(); | |
61 | } else { | |
62 | sprintf(painCave.errMsg, | |
63 | < | "Integrator Error: dt is not set\n"); |
63 | > | "Rattle Error: dt is not set\n"); |
64 | painCave.isFatal = 1; | |
65 | simError(); | |
66 | } | |
67 | + | |
68 | currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); | |
69 | if (simParams->haveConstraintTime()){ | |
70 | constraintTime_ = simParams->getConstraintTime(); | |
# | Line 67 | Line 72 | namespace OpenMD { | |
72 | constraintTime_ = simParams->getStatusTime(); | |
73 | } | |
74 | ||
75 | < | constraintOutputFile_ = getPrefix(info_->getFinalConfigFileName()) + ".constraintForces"; |
75 | > | constraintOutputFile_ = getPrefix(info_->getFinalConfigFileName()) + |
76 | > | ".constraintForces"; |
77 | ||
78 | + | |
79 | // create ConstraintWriter | |
80 | < | constraintWriter_ = new ConstraintWriter(info_, constraintOutputFile_.c_str()); |
80 | > | constraintWriter_ = new ConstraintWriter(info_, |
81 | > | constraintOutputFile_.c_str()); |
82 | ||
83 | if (!constraintWriter_){ | |
84 | sprintf(painCave.errMsg, "Failed to create ConstraintWriter\n"); | |
# | Line 101 | Line 109 | namespace OpenMD { | |
109 | constraints.push_back(consPair); | |
110 | } | |
111 | } | |
104 | – | |
112 | constraintWriter_->writeConstraintForces(constraints); | |
113 | currConstraintTime_ += constraintTime_; | |
114 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |