| 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 |
|
Globals* simParams = info_->getSimParams(); |
| 58 |
|
dt_ = simParams->getDt(); |
| 59 |
|
} else { |
| 60 |
|
sprintf(painCave.errMsg, |
| 61 |
< |
"Integrator Error: dt is not set\n"); |
| 61 |
> |
"Rattle Error: dt is not set\n"); |
| 62 |
|
painCave.isFatal = 1; |
| 63 |
|
simError(); |
| 64 |
|
} |
| 65 |
+ |
|
| 66 |
|
currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); |
| 67 |
|
if (simParams->haveConstraintTime()){ |
| 68 |
|
constraintTime_ = simParams->getConstraintTime(); |
| 70 |
|
constraintTime_ = simParams->getStatusTime(); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
< |
constraintOutputFile_ = getPrefix(info_->getFinalConfigFileName()) + ".constraintForces"; |
| 73 |
> |
constraintOutputFile_ = getPrefix(info_->getFinalConfigFileName()) + |
| 74 |
> |
".constraintForces"; |
| 75 |
|
|
| 76 |
|
// create ConstraintWriter |
| 77 |
< |
constraintWriter_ = new ConstraintWriter(info_, constraintOutputFile_.c_str()); |
| 77 |
> |
constraintWriter_ = new ConstraintWriter(info_, |
| 78 |
> |
constraintOutputFile_.c_str()); |
| 79 |
|
|
| 80 |
|
if (!constraintWriter_){ |
| 81 |
|
sprintf(painCave.errMsg, "Failed to create ConstraintWriter\n"); |
| 106 |
|
constraints.push_back(consPair); |
| 107 |
|
} |
| 108 |
|
} |
| 104 |
– |
|
| 109 |
|
constraintWriter_->writeConstraintForces(constraints); |
| 110 |
|
currConstraintTime_ += constraintTime_; |
| 111 |
|
} |