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

Comparing branches/development/src/nonbonded/InteractionManager.cpp (file contents):
Revision 1576 by gezelter, Wed Jun 8 16:05:07 2011 UTC vs.
Revision 1587 by gezelter, Fri Jul 8 20:25:32 2011 UTC

# Line 67 | Line 67 | namespace OpenMD {
67      eam_->setForceField(forceField_);
68      sc_->setForceField(forceField_);
69      morse_->setForceField(forceField_);
70 +    electrostatic_->setSimInfo(info_);
71      electrostatic_->setForceField(forceField_);
72      maw_->setForceField(forceField_);
73  
# Line 241 | Line 242 | namespace OpenMD {
242      }
243      
244      
245 <    // make sure every pair of atom types in this simulation has a
246 <    // non-bonded interaction:
245 >    // Make sure every pair of atom types in this simulation has a
246 >    // non-bonded interaction.  If not, just inform the user.
247  
248      set<AtomType*> simTypes = info_->getSimulatedAtomTypes();
249      set<AtomType*>::iterator it, jt;
250 +
251      for (it = simTypes.begin(); it != simTypes.end(); ++it) {
252        atype1 = (*it);
253 <      for (jt = simTypes.begin(); jt != simTypes.end(); ++jt) {
253 >      for (jt = it; jt != simTypes.end(); ++jt) {
254          atype2 = (*jt);
255          key = make_pair(atype1, atype2);
256          
257          if (interactions_[key].size() == 0) {
258            sprintf( painCave.errMsg,
259 <                   "InteractionManager unable to find an appropriate non-bonded\n"
260 <                   "\tinteraction for atom types %s - %s\n",
259 >                   "InteractionManager could not find a matching non-bonded\n"
260 >                   "\tinteraction for atom types %s - %s\n"
261 >                   "\tProceeding without this interaction.\n",
262                     atype1->getName().c_str(), atype2->getName().c_str());
263            painCave.severity = OPENMD_INFO;
264 <          painCave.isFatal = 1;
264 >          painCave.isFatal = 0;
265            simError();
266          }
267        }
# Line 266 | Line 269 | namespace OpenMD {
269  
270      initialized_ = true;
271    }
272 +
273 +  void InteractionManager::setCutoffRadius(RealType rcut) {
274 +    
275 +    electrostatic_->setCutoffRadius(rcut);
276 +    eam_->setCutoffRadius(rcut);
277 +  }
278 +
279 +  void InteractionManager::setSwitchingRadius(RealType rswitch) {
280 +    electrostatic_->setSwitchingRadius(rswitch);
281 +  }
282    
283    void InteractionManager::doPrePair(InteractionData idat){
284      
285      if (!initialized_) initialize();
286          
287 +    // excluded interaction, so just return
288 +    if (idat.excluded) return;
289 +
290      set<NonBondedInteraction*>::iterator it;
291  
292      for (it = interactions_[ idat.atypes ].begin();
# Line 302 | Line 318 | namespace OpenMD {
318    void InteractionManager::doPair(InteractionData idat){
319      
320      if (!initialized_) initialize();
321 <  
321 >
322      set<NonBondedInteraction*>::iterator it;
323  
324      for (it = interactions_[ idat.atypes ].begin();
325 <         it != interactions_[ idat.atypes ].end(); ++it)
310 <      (*it)->calcForce(idat);
311 <    
312 <    return;    
313 <  }
325 >         it != interactions_[ idat.atypes ].end(); ++it) {
326  
327 <  void InteractionManager::doSkipCorrection(InteractionData idat){
327 >      // electrostatics still has to worry about indirect
328 >      // contributions from excluded pairs of atoms:
329  
330 <    if (!initialized_) initialize();  
331 <    
319 <    set<NonBondedInteraction*>::iterator it;
320 <
321 <    for (it = interactions_[ idat.atypes ].begin();
322 <         it != interactions_[ idat.atypes ].end(); ++it){
323 <      if ((*it)->getFamily() == ELECTROSTATIC_FAMILY) {
324 <        dynamic_cast<ElectrostaticInteraction*>(*it)->calcSkipCorrection(idat);
330 >      if (!idat.excluded || (*it)->getFamily() == ELECTROSTATIC_FAMILY) {
331 >        (*it)->calcForce(idat);
332        }
333      }
334      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines