ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/restraints/RestraintForceManager.cpp
(Generate patch)

Comparing:
trunk/src/restraints/RestraintForceManager.cpp (file contents), Revision 1398 by gezelter, Tue Dec 8 22:17:02 2009 UTC vs.
branches/development/src/restraints/RestraintForceManager.cpp (file contents), Revision 1760 by gezelter, Thu Jun 21 19:26:46 2012 UTC

# Line 36 | Line 36
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38   * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <cmath>
# Line 89 | Line 90 | namespace OpenMD {
90      int nRestraintStamps = simParam->getNRestraintStamps();
91      std::vector<RestraintStamp*> stamp = simParam->getRestraintStamps();
92  
93 +    std::vector<int> stuntDoubleIndex;
94 +
95      for (int i = 0; i < nRestraintStamps; i++){
96  
97        std::string myType = toUpperCopy(stamp[i]->getType());
# Line 134 | Line 137 | namespace OpenMD {
137          
138            int myrank = MPI::COMM_WORLD.Get_rank();
139            if (info_->getMolToProc(molIndex) == myrank) {
140 +        
141              // If we were supposed to have it but got a null, then freak out.
142   #endif
143  
# Line 155 | Line 159 | namespace OpenMD {
159          // molecule
160          int myrank = MPI::COMM_WORLD.Get_rank();
161          if (info_->getMolToProc(molIndex) == myrank) {
162 +
163   #endif
164  
165          MolecularRestraint* rest = new MolecularRestraint();
# Line 230 | Line 235 | namespace OpenMD {
235  
236          for (sd = seleMan.beginSelected(selei); sd != NULL;
237               sd = seleMan.nextSelected(selei)) {
238 <          
238 >          stuntDoubleIndex.push_back(sd->getGlobalIntegrableObjectIndex());
239 >
240            ObjectRestraint* rest = new ObjectRestraint();
241            
242            if (stamp[i]->haveDisplacementSpringConstant()) {
# Line 270 | Line 276 | namespace OpenMD {
276      // are times when it won't use restraints at all, so only open the
277      // restraint file if we are actually using restraints:
278  
279 <    if (simParam->getUseRestraints()) {
279 >    if (simParam->getUseRestraints()) {
280        std::string refFile = simParam->getRestraint_file();
281 <      RestReader* rr = new RestReader(info, refFile);
276 <
281 >      RestReader* rr = new RestReader(info, refFile, stuntDoubleIndex);
282        rr->readReferenceStructure();
283      }
284  
285      restOutput_ = getPrefix(info_->getFinalConfigFileName()) + ".rest";
286      restOut = new RestWriter(info_, restOutput_.c_str(), restraints_);
282    
287      if(!restOut){
288        sprintf(painCave.errMsg, "Restraint error: Failed to create RestWriter\n");
289        painCave.isFatal = 1;
# Line 302 | Line 306 | namespace OpenMD {
306      currRestTime_ = currSnapshot_->getTime();
307    }
308  
309 <  void RestraintForceManager::calcForces(bool needPotential, bool needStress){
309 >  void RestraintForceManager::calcForces(){
310  
311 <    ForceManager::calcForces(needPotential, needStress);    
311 >    ForceManager::calcForces();    
312      RealType restPot_local, restPot;
313  
314      restPot_local = doRestraints(1.0);
# Line 316 | Line 320 | namespace OpenMD {
320      restPot = restPot_local;
321   #endif
322      currSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot();
323 <    currSnapshot_->statData[Stats::LONG_RANGE_POTENTIAL] += restPot;
324 <    currSnapshot_->statData[Stats::VHARM] = restPot;
323 >    RealType pot = currSnapshot_->getLongRangePotential();
324 >    pot += restPot;
325 >    currSnapshot_->setLongRangePotential(pot);
326 >    currSnapshot_->setRestraintPotential(restPot);
327  
328      //write out forces and current positions of restrained molecules    
329      if (currSnapshot_->getTime() >= currRestTime_){
# Line 384 | Line 390 | namespace OpenMD {
390        std::vector<Vector3d> forces;
391        
392        for(sd = (*rm)->beginIntegrableObject(ioi); sd != NULL;
393 <          sd = (*rm)->nextIntegrableObject(ioi)) {        
393 >          sd = (*rm)->nextIntegrableObject(ioi)) {
394          struc.push_back(sd->getPos());
395        }
396  

Comparing:
trunk/src/restraints/RestraintForceManager.cpp (property svn:keywords), Revision 1398 by gezelter, Tue Dec 8 22:17:02 2009 UTC vs.
branches/development/src/restraints/RestraintForceManager.cpp (property svn:keywords), Revision 1760 by gezelter, Thu Jun 21 19:26:46 2012 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines