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

Comparing trunk/src/nonbonded/InteractionManager.cpp (file contents):
Revision 1921 by gezelter, Thu Aug 1 18:23:07 2013 UTC vs.
Revision 1927 by gezelter, Wed Aug 14 20:19:19 2013 UTC

# Line 90 | Line 90 | namespace OpenMD {
90  
91      ForceField::AtomTypeContainer* atomTypes = forceField_->getAtomTypes();
92      int nTypes = atomTypes->size();
93 +    sHash_.resize(nTypes);
94      iHash_.resize(nTypes);
95      interactions_.resize(nTypes);
96      ForceField::AtomTypeContainer::MapTypeIterator i1, i2;
# Line 136 | Line 137 | namespace OpenMD {
137          simError();                
138        }
139      }
140 <    
140 >
141 >    if (atype1->isLennardJones()) {
142 >      sHash_[atid1] |= LJ_INTERACTION;
143 >    }
144 >    if (atype1->isElectrostatic()) {
145 >      sHash_[atid1] |= ELECTROSTATIC_INTERACTION;
146 >    }
147 >    if (atype1->isSticky()) {
148 >      sHash_[atid1] |= STICKY_INTERACTION;
149 >    }
150 >    if (atype1->isStickyPower()) {
151 >      sHash_[atid1] |= STICKY_INTERACTION;
152 >    }
153 >    if (atype1->isEAM()) {
154 >      sHash_[atid1] |= EAM_INTERACTION;
155 >    }
156 >    if (atype1->isSC()) {
157 >      sHash_[atid1] |= SC_INTERACTION;
158 >    }
159 >    if (atype1->isGayBerne()) {
160 >      sHash_[atid1] |= GB_INTERACTION;
161 >    }
162 >  
163      // Now, iterate over all known types and add to the interaction map:
164      
165      map<int, AtomType*>::iterator it1, it2;
# Line 152 | Line 175 | namespace OpenMD {
175          
176          if (atype1->isLennardJones() && atype2->isLennardJones()) {
177            interactions_[atid1][atid2].insert(lj_);
178 <          iHash_[atid1][atid2] |= LJ_PAIR;
178 >          iHash_[atid1][atid2] |= LJ_INTERACTION;
179          }
180          if (atype1->isElectrostatic() && atype2->isElectrostatic() ) {
181 <          interactions_[atid1][atid2].insert(electrostatic_);
182 <          iHash_[atid1][atid2] |= ELECTROSTATIC_PAIR;
181 >          // Pairs of fluctuating density EAM atoms have their
182 >          // interactions handled via the EAM routines.  All other
183 >          // interactions with these atoms are handled via normal
184 >          // electrostatic channels:
185 >          if (!(atype1->isEAM() && atype2->isEAM())) {
186 >            interactions_[atid1][atid2].insert(electrostatic_);
187 >            iHash_[atid1][atid2] |= ELECTROSTATIC_INTERACTION;
188 >          }
189          }
190          if (atype1->isSticky() && atype2->isSticky() ) {
191            interactions_[atid1][atid2].insert(sticky_);
192 <          iHash_[atid1][atid2] |= STICKY_PAIR;
192 >          iHash_[atid1][atid2] |= STICKY_INTERACTION;
193          }
194          if (atype1->isStickyPower() && atype2->isStickyPower() ) {
195            interactions_[atid1][atid2].insert(sticky_);
196 <          iHash_[atid1][atid2] |= STICKY_PAIR;
196 >          iHash_[atid1][atid2] |= STICKY_INTERACTION;
197          }
198          if (atype1->isEAM() && atype2->isEAM() ) {
199            interactions_[atid1][atid2].insert(eam_);
200 <          iHash_[atid1][atid2] |= EAM_PAIR;
200 >          iHash_[atid1][atid2] |= EAM_INTERACTION;
201          }
202          if (atype1->isSC() && atype2->isSC() ) {
203            interactions_[atid1][atid2].insert(sc_);
204 <          iHash_[atid1][atid2] |= SC_PAIR;
204 >          iHash_[atid1][atid2] |= SC_INTERACTION;
205          }
206          if (atype1->isGayBerne() && atype2->isGayBerne() ) {
207            interactions_[atid1][atid2].insert(gb_);
208 <          iHash_[atid1][atid2] |= GB_PAIR;
208 >          iHash_[atid1][atid2] |= GB_INTERACTION;
209          }
210          if ((atype1->isGayBerne() && atype2->isLennardJones())
211              || (atype1->isLennardJones() && atype2->isGayBerne())) {
212            interactions_[atid1][atid2].insert(gb_);
213 <          iHash_[atid1][atid2] |= GB_PAIR;
213 >          iHash_[atid1][atid2] |= GB_INTERACTION;
214          }
215          
216          // look for an explicitly-set non-bonded interaction type using the
# Line 207 | Line 236 | namespace OpenMD {
236                }
237              }
238              interactions_[atid1][atid2].insert(lj_);
239 <            iHash_[atid1][atid2] |= LJ_PAIR;
239 >            iHash_[atid1][atid2] |= LJ_INTERACTION;
240              vdwExplicit = true;
241            }
242            
# Line 234 | Line 263 | namespace OpenMD {
263                }
264              }
265              interactions_[atid1][atid2].insert(morse_);
266 <            iHash_[atid1][atid2] |= MORSE_PAIR;
266 >            iHash_[atid1][atid2] |= MORSE_INTERACTION;
267              vdwExplicit = true;
268            }
269  
# Line 261 | Line 290 | namespace OpenMD {
290                }
291              }
292              interactions_[atid1][atid2].insert(repulsivePower_);
293 <            iHash_[atid1][atid2] |= REPULSIVEPOWER_PAIR;
293 >            iHash_[atid1][atid2] |= REPULSIVEPOWER_INTERACTION;
294              vdwExplicit = true;
295            }
296            
# Line 279 | Line 308 | namespace OpenMD {
308                }
309              }
310              interactions_[atid1][atid2].insert(eam_);
311 <            iHash_[atid1][atid2] |= EAM_PAIR;
311 >            iHash_[atid1][atid2] |= EAM_INTERACTION;
312              metExplicit = true;
313            }
314            
# Line 306 | Line 335 | namespace OpenMD {
335                }
336              }
337              interactions_[atid1][atid2].insert(sc_);
338 <            iHash_[atid1][atid2] |= SC_PAIR;
338 >            iHash_[atid1][atid2] |= SC_INTERACTION;
339              metExplicit = true;
340            }
341            
# Line 333 | Line 362 | namespace OpenMD {
362                }
363              }
364              interactions_[atid1][atid2].insert(maw_);
365 <            iHash_[atid1][atid2] |= MAW_PAIR;
365 >            iHash_[atid1][atid2] |= MAW_INTERACTION;
366              vdwExplicit = true;
367            }        
368          }
# Line 385 | Line 414 | namespace OpenMD {
414  
415      int& iHash = iHash_[idat.atid1][idat.atid2];
416  
417 <    if ((iHash & EAM_PAIR) != 0) eam_->calcDensity(idat);
418 <    if ((iHash & SC_PAIR) != 0)  sc_->calcDensity(idat);
417 >    if ((iHash & EAM_INTERACTION) != 0) eam_->calcDensity(idat);
418 >    if ((iHash & SC_INTERACTION) != 0)  sc_->calcDensity(idat);
419  
420      // set<NonBondedInteraction*>::iterator it;
421  
# Line 404 | Line 433 | namespace OpenMD {
433  
434      if (!initialized_) initialize();
435      
436 <    int& iHash = iHash_[sdat.atid][sdat.atid];
436 >    int& sHash = sHash_[sdat.atid];
437  
438 <    if ((iHash & EAM_PAIR) != 0) eam_->calcFunctional(sdat);
439 <    if ((iHash & SC_PAIR) != 0)  sc_->calcFunctional(sdat);
438 >    if ((sHash & EAM_INTERACTION) != 0) eam_->calcFunctional(sdat);
439 >    if ((sHash & SC_INTERACTION) != 0)  sc_->calcFunctional(sdat);
440  
441      // set<NonBondedInteraction*>::iterator it;
442      
# Line 426 | Line 455 | namespace OpenMD {
455  
456      int& iHash = iHash_[idat.atid1][idat.atid2];
457  
458 <    if ((iHash & ELECTROSTATIC_PAIR) != 0) electrostatic_->calcForce(idat);
458 >    if ((iHash & ELECTROSTATIC_INTERACTION) != 0) electrostatic_->calcForce(idat);
459        
460      // electrostatics still has to worry about indirect
461      // contributions from excluded pairs of atoms, but nothing else does:
462  
463      if (idat.excluded) return;
464  
465 <    if ((iHash & LJ_PAIR) != 0)             lj_->calcForce(idat);
466 <    if ((iHash & GB_PAIR) != 0)             gb_->calcForce(idat);
467 <    if ((iHash & STICKY_PAIR) != 0)         sticky_->calcForce(idat);
468 <    if ((iHash & MORSE_PAIR) != 0)          morse_->calcForce(idat);
469 <    if ((iHash & REPULSIVEPOWER_PAIR) != 0) repulsivePower_->calcForce(idat);
470 <    if ((iHash & EAM_PAIR) != 0)            eam_->calcForce(idat);
471 <    if ((iHash & SC_PAIR) != 0)             sc_->calcForce(idat);
472 <    if ((iHash & MAW_PAIR) != 0)            maw_->calcForce(idat);
465 >    if ((iHash & LJ_INTERACTION) != 0)             lj_->calcForce(idat);
466 >    if ((iHash & GB_INTERACTION) != 0)             gb_->calcForce(idat);
467 >    if ((iHash & STICKY_INTERACTION) != 0)         sticky_->calcForce(idat);
468 >    if ((iHash & MORSE_INTERACTION) != 0)          morse_->calcForce(idat);
469 >    if ((iHash & REPULSIVEPOWER_INTERACTION) != 0) repulsivePower_->calcForce(idat);
470 >    if ((iHash & EAM_INTERACTION) != 0)            eam_->calcForce(idat);
471 >    if ((iHash & SC_INTERACTION) != 0)             sc_->calcForce(idat);
472 >    if ((iHash & MAW_INTERACTION) != 0)            maw_->calcForce(idat);
473  
474      // set<NonBondedInteraction*>::iterator it;
475  
# Line 462 | Line 491 | namespace OpenMD {
491  
492      if (!initialized_) initialize();
493      
494 <    int& iHash = iHash_[sdat.atid][sdat.atid];
494 >    int& sHash = sHash_[sdat.atid];
495  
496 <    if ((iHash & ELECTROSTATIC_PAIR) != 0) electrostatic_->calcSelfCorrection(sdat);
496 >    if ((sHash & ELECTROSTATIC_INTERACTION) != 0) electrostatic_->calcSelfCorrection(sdat);
497  
498      // set<NonBondedInteraction*>::iterator it;
499  
# Line 477 | Line 506 | namespace OpenMD {
506      return;    
507    }
508  
509 <  void InteractionManager::doReciprocalSpaceSum(potVec &pot){
509 >  void InteractionManager::doReciprocalSpaceSum(RealType &pot){
510      if (!initialized_) initialize();
511      electrostatic_->ReciprocalSpaceSum(pot);
512    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines