ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/MoleculeCreator.cpp
(Generate patch)

Comparing trunk/src/brains/MoleculeCreator.cpp (file contents):
Revision 2046 by gezelter, Tue Dec 2 22:11:04 2014 UTC vs.
Revision 2071 by gezelter, Sat Mar 7 21:41:51 2015 UTC

# Line 184 | Line 184 | namespace OpenMD {
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;
# Line 193 | Line 193 | namespace OpenMD {
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"
# Line 203 | Line 206 | namespace OpenMD {
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:
# Line 228 | Line 227 | namespace OpenMD {
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines