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

Comparing trunk/src/restraints/RestraintForceManager.cpp (file contents):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1464 by gezelter, Fri Jul 9 19:29:05 2010 UTC

# Line 89 | Line 89 | namespace OpenMD {
89      int nRestraintStamps = simParam->getNRestraintStamps();
90      std::vector<RestraintStamp*> stamp = simParam->getRestraintStamps();
91  
92 +    std::vector<int> stuntDoubleIndex;
93 +
94      for (int i = 0; i < nRestraintStamps; i++){
95  
96        std::string myType = toUpperCopy(stamp[i]->getType());
# Line 134 | Line 136 | namespace OpenMD {
136          
137            int myrank = MPI::COMM_WORLD.Get_rank();
138            if (info_->getMolToProc(molIndex) == myrank) {
139 +        
140              // If we were supposed to have it but got a null, then freak out.
141   #endif
142  
# Line 149 | Line 152 | namespace OpenMD {
152   #endif
153          }
154          
155 +
156 + #ifdef IS_MPI
157 +        // only handle this molecular restraint if this processor owns the
158 +        // molecule
159 +        int myrank = MPI::COMM_WORLD.Get_rank();
160 +        if (info_->getMolToProc(molIndex) == myrank) {
161 +
162 + #endif
163 +
164          MolecularRestraint* rest = new MolecularRestraint();
165  
166          std::string restPre("mol_");
# Line 184 | Line 196 | namespace OpenMD {
196          restraints_.push_back(rest);
197          mol->addProperty(new RestraintData("Restraint", rest));
198          restrainedMols_.push_back(mol);
199 <        
199 > #ifdef IS_MPI
200 >        }
201 > #endif        
202        } else if (myType.compare("OBJECT") == 0) {
203          
204          std::string objectSelection;
# Line 220 | Line 234 | namespace OpenMD {
234  
235          for (sd = seleMan.beginSelected(selei); sd != NULL;
236               sd = seleMan.nextSelected(selei)) {
237 <          
237 >          stuntDoubleIndex.push_back(sd->getGlobalIntegrableObjectIndex());
238 >
239            ObjectRestraint* rest = new ObjectRestraint();
240            
241            if (stamp[i]->haveDisplacementSpringConstant()) {
# Line 260 | Line 275 | namespace OpenMD {
275      // are times when it won't use restraints at all, so only open the
276      // restraint file if we are actually using restraints:
277  
278 <    if (simParam->getUseRestraints()) {
278 >    if (simParam->getUseRestraints()) {
279        std::string refFile = simParam->getRestraint_file();
280 <      RestReader* rr = new RestReader(info, refFile);
266 <
280 >      RestReader* rr = new RestReader(info, refFile, stuntDoubleIndex);
281        rr->readReferenceStructure();
282      }
283  
284      restOutput_ = getPrefix(info_->getFinalConfigFileName()) + ".rest";
285      restOut = new RestWriter(info_, restOutput_.c_str(), restraints_);
272    
286      if(!restOut){
287        sprintf(painCave.errMsg, "Restraint error: Failed to create RestWriter\n");
288        painCave.isFatal = 1;
# Line 292 | Line 305 | namespace OpenMD {
305      currRestTime_ = currSnapshot_->getTime();
306    }
307  
308 <  void RestraintForceManager::calcForces(bool needPotential, bool needStress){
308 >  void RestraintForceManager::calcForces(){
309  
310 <    ForceManager::calcForces(needPotential, needStress);    
310 >    ForceManager::calcForces();    
311      RealType restPot_local, restPot;
312  
313      restPot_local = doRestraints(1.0);
# Line 374 | Line 387 | namespace OpenMD {
387        std::vector<Vector3d> forces;
388        
389        for(sd = (*rm)->beginIntegrableObject(ioi); sd != NULL;
390 <          sd = (*rm)->nextIntegrableObject(ioi)) {        
390 >          sd = (*rm)->nextIntegrableObject(ioi)) {
391          struc.push_back(sd->getPos());
392        }
393  

Comparing trunk/src/restraints/RestraintForceManager.cpp (property svn:keywords):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 1464 by gezelter, Fri Jul 9 19:29:05 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines