| 50 |  | if (info_->getNConstraints() > 0) | 
| 51 |  | doRattle_ = true; | 
| 52 |  |  | 
| 53 | + | Globals* simParams = info_->getSimParams(); | 
| 54 |  |  | 
| 55 | < | if (info_->getSimParams()->haveDt()) { | 
| 56 | < | dt_ = info_->getSimParams()->getDt(); | 
| 55 | > | if (simParams->haveDt()) { | 
| 56 | > | dt_ = simParams->getDt(); | 
| 57 |  | } else { | 
| 58 |  | sprintf(painCave.errMsg, | 
| 59 |  | "Integrator Error: dt is not set\n"); | 
| 61 |  | simError(); | 
| 62 |  | } | 
| 63 |  | currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); | 
| 64 | + | if (simParams->haveConstraintTime()){ | 
| 65 | + | constraintTime_ = simParams->getConstraintTime(); | 
| 66 | + | } else { | 
| 67 | + | constraintTime_ = simParams->getStatusTime(); | 
| 68 | + | } | 
| 69 | + |  | 
| 70 | + | constraintOutputFile_ = getPrefix(info_->getFinalConfigFileName()) + ".constraintForces"; | 
| 71 | + |  | 
| 72 | + | // create ConstraintWriter | 
| 73 | + | constraintWriter_ = new ConstraintWriter(info_, constraintOutputFile_.c_str()); | 
| 74 | + |  | 
| 75 | + | if (!constraintWriter_){ | 
| 76 | + | sprintf(painCave.errMsg, "Failed to create ConstraintWriter\n"); | 
| 77 | + | painCave.isFatal = 1; | 
| 78 | + | simError(); | 
| 79 | + | } | 
| 80 |  | } | 
| 81 |  |  | 
| 82 |  | void Rattle::constraintA() { | 
| 86 |  | void Rattle::constraintB() { | 
| 87 |  | if (!doRattle_) return; | 
| 88 |  | doConstraint(&Rattle::constraintPairB); | 
| 89 | + |  | 
| 90 | + | if (currentSnapshot_->getTime() >= currConstraintTime_){ | 
| 91 | + | Molecule* mol; | 
| 92 | + | SimInfo::MoleculeIterator mi; | 
| 93 | + | ConstraintPair* consPair; | 
| 94 | + | Molecule::ConstraintPairIterator cpi; | 
| 95 | + | std::list<ConstraintPair*> constraints; | 
| 96 | + | for (mol = info_->beginMolecule(mi); mol != NULL; | 
| 97 | + | mol = info_->nextMolecule(mi)) { | 
| 98 | + | for (consPair = mol->beginConstraintPair(cpi); consPair != NULL; | 
| 99 | + | consPair = mol->nextConstraintPair(cpi)) { | 
| 100 | + |  | 
| 101 | + | constraints.push_back(consPair); | 
| 102 | + | } | 
| 103 | + | } | 
| 104 | + |  | 
| 105 | + | constraintWriter_->writeConstraintForces(constraints); | 
| 106 | + | currConstraintTime_ += constraintTime_; | 
| 107 | + | } | 
| 108 |  | } | 
| 109 |  |  | 
| 110 |  | void Rattle::doConstraint(ConstraintPairFuncPtr func) { |