| 184 |
|
createConstraintPair(mol); |
| 185 |
|
|
| 186 |
|
//create non-bonded constraintPairs |
| 187 |
< |
for (int i = 0; i < molStamp->getNConstraints(); ++i) { |
| 187 |
> |
for (std::size_t i = 0; i < molStamp->getNConstraints(); ++i) { |
| 188 |
|
ConstraintStamp* cStamp = molStamp->getConstraintStamp(i); |
| 189 |
|
Atom* atomA; |
| 190 |
|
Atom* atomB; |
| 193 |
|
atomB = mol->getAtomAt(cStamp->getB()); |
| 194 |
|
assert( atomA && atomB ); |
| 195 |
|
|
| 196 |
– |
RealType distance; |
| 196 |
|
bool printConstraintForce = false; |
| 197 |
|
|
| 198 |
+ |
if (cStamp->havePrintConstraintForce()) { |
| 199 |
+ |
printConstraintForce = cStamp->getPrintConstraintForce(); |
| 200 |
+ |
} |
| 201 |
+ |
|
| 202 |
|
if (!cStamp->haveConstrainedDistance()) { |
| 203 |
|
sprintf(painCave.errMsg, |
| 204 |
|
"Constraint Error: A non-bond constraint was specified\n" |
| 206 |
|
painCave.isFatal = 1; |
| 207 |
|
simError(); |
| 208 |
|
} else { |
| 209 |
< |
distance = cStamp->getConstrainedDistance(); |
| 210 |
< |
} |
| 211 |
< |
|
| 212 |
< |
if (cStamp->havePrintConstraintForce()) { |
| 213 |
< |
printConstraintForce = cStamp->getPrintConstraintForce(); |
| 214 |
< |
} |
| 215 |
< |
|
| 216 |
< |
ConstraintElem* consElemA = new ConstraintElem(atomA); |
| 214 |
< |
ConstraintElem* consElemB = new ConstraintElem(atomB); |
| 215 |
< |
ConstraintPair* cPair = new ConstraintPair(consElemA, consElemB, distance, |
| 216 |
< |
printConstraintForce); |
| 217 |
< |
mol->addConstraintPair(cPair); |
| 209 |
> |
RealType distance = cStamp->getConstrainedDistance(); |
| 210 |
> |
ConstraintElem* consElemA = new ConstraintElem(atomA); |
| 211 |
> |
ConstraintElem* consElemB = new ConstraintElem(atomB); |
| 212 |
> |
ConstraintPair* cPair = new ConstraintPair(consElemA, consElemB, |
| 213 |
> |
distance, |
| 214 |
> |
printConstraintForce); |
| 215 |
> |
mol->addConstraintPair(cPair); |
| 216 |
> |
} |
| 217 |
|
} |
| 218 |
|
|
| 219 |
|
// now create the constraint elements: |
| 227 |
|
mol->setConstrainTotalCharge( molStamp->getConstrainTotalCharge() ); |
| 228 |
|
} |
| 229 |
|
|
| 230 |
< |
//the construction of this molecule is finished |
| 230 |
> |
// The construction of this molecule is finished: |
| 231 |
|
mol->complete(); |
| 232 |
|
|
| 233 |
|
return mol; |