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 1929 by gezelter, Mon Aug 19 13:12:00 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;
182 >          iHash_[atid1][atid2] |= ELECTROSTATIC_INTERACTION;
183          }
184          if (atype1->isSticky() && atype2->isSticky() ) {
185            interactions_[atid1][atid2].insert(sticky_);
186 <          iHash_[atid1][atid2] |= STICKY_PAIR;
186 >          iHash_[atid1][atid2] |= STICKY_INTERACTION;
187          }
188          if (atype1->isStickyPower() && atype2->isStickyPower() ) {
189            interactions_[atid1][atid2].insert(sticky_);
190 <          iHash_[atid1][atid2] |= STICKY_PAIR;
190 >          iHash_[atid1][atid2] |= STICKY_INTERACTION;
191          }
192          if (atype1->isEAM() && atype2->isEAM() ) {
193            interactions_[atid1][atid2].insert(eam_);
194 <          iHash_[atid1][atid2] |= EAM_PAIR;
194 >          iHash_[atid1][atid2] |= EAM_INTERACTION;
195          }
196          if (atype1->isSC() && atype2->isSC() ) {
197            interactions_[atid1][atid2].insert(sc_);
198 <          iHash_[atid1][atid2] |= SC_PAIR;
198 >          iHash_[atid1][atid2] |= SC_INTERACTION;
199          }
200          if (atype1->isGayBerne() && atype2->isGayBerne() ) {
201            interactions_[atid1][atid2].insert(gb_);
202 <          iHash_[atid1][atid2] |= GB_PAIR;
202 >          iHash_[atid1][atid2] |= GB_INTERACTION;
203          }
204          if ((atype1->isGayBerne() && atype2->isLennardJones())
205              || (atype1->isLennardJones() && atype2->isGayBerne())) {
206            interactions_[atid1][atid2].insert(gb_);
207 <          iHash_[atid1][atid2] |= GB_PAIR;
207 >          iHash_[atid1][atid2] |= GB_INTERACTION;
208          }
209          
210          // look for an explicitly-set non-bonded interaction type using the
# Line 207 | Line 230 | namespace OpenMD {
230                }
231              }
232              interactions_[atid1][atid2].insert(lj_);
233 <            iHash_[atid1][atid2] |= LJ_PAIR;
233 >            iHash_[atid1][atid2] |= LJ_INTERACTION;
234              vdwExplicit = true;
235            }
236            
# Line 234 | Line 257 | namespace OpenMD {
257                }
258              }
259              interactions_[atid1][atid2].insert(morse_);
260 <            iHash_[atid1][atid2] |= MORSE_PAIR;
260 >            iHash_[atid1][atid2] |= MORSE_INTERACTION;
261              vdwExplicit = true;
262            }
263  
# Line 261 | Line 284 | namespace OpenMD {
284                }
285              }
286              interactions_[atid1][atid2].insert(repulsivePower_);
287 <            iHash_[atid1][atid2] |= REPULSIVEPOWER_PAIR;
287 >            iHash_[atid1][atid2] |= REPULSIVEPOWER_INTERACTION;
288              vdwExplicit = true;
289            }
290            
# Line 279 | Line 302 | namespace OpenMD {
302                }
303              }
304              interactions_[atid1][atid2].insert(eam_);
305 <            iHash_[atid1][atid2] |= EAM_PAIR;
305 >            iHash_[atid1][atid2] |= EAM_INTERACTION;
306              metExplicit = true;
307            }
308            
# Line 306 | Line 329 | namespace OpenMD {
329                }
330              }
331              interactions_[atid1][atid2].insert(sc_);
332 <            iHash_[atid1][atid2] |= SC_PAIR;
332 >            iHash_[atid1][atid2] |= SC_INTERACTION;
333              metExplicit = true;
334            }
335            
# Line 333 | Line 356 | namespace OpenMD {
356                }
357              }
358              interactions_[atid1][atid2].insert(maw_);
359 <            iHash_[atid1][atid2] |= MAW_PAIR;
359 >            iHash_[atid1][atid2] |= MAW_INTERACTION;
360              vdwExplicit = true;
361            }        
362          }
# Line 385 | Line 408 | namespace OpenMD {
408  
409      int& iHash = iHash_[idat.atid1][idat.atid2];
410  
411 <    if ((iHash & EAM_PAIR) != 0) eam_->calcDensity(idat);
412 <    if ((iHash & SC_PAIR) != 0)  sc_->calcDensity(idat);
411 >    if ((iHash & EAM_INTERACTION) != 0) eam_->calcDensity(idat);
412 >    if ((iHash & SC_INTERACTION) != 0)  sc_->calcDensity(idat);
413  
414      // set<NonBondedInteraction*>::iterator it;
415  
# Line 404 | Line 427 | namespace OpenMD {
427  
428      if (!initialized_) initialize();
429      
430 <    int& iHash = iHash_[sdat.atid][sdat.atid];
430 >    int& sHash = sHash_[sdat.atid];
431  
432 <    if ((iHash & EAM_PAIR) != 0) eam_->calcFunctional(sdat);
433 <    if ((iHash & SC_PAIR) != 0)  sc_->calcFunctional(sdat);
432 >    if ((sHash & EAM_INTERACTION) != 0) eam_->calcFunctional(sdat);
433 >    if ((sHash & SC_INTERACTION) != 0)  sc_->calcFunctional(sdat);
434  
435      // set<NonBondedInteraction*>::iterator it;
436      
# Line 426 | Line 449 | namespace OpenMD {
449  
450      int& iHash = iHash_[idat.atid1][idat.atid2];
451  
452 <    if ((iHash & ELECTROSTATIC_PAIR) != 0) electrostatic_->calcForce(idat);
452 >    if ((iHash & ELECTROSTATIC_INTERACTION) != 0) electrostatic_->calcForce(idat);
453        
454      // electrostatics still has to worry about indirect
455      // contributions from excluded pairs of atoms, but nothing else does:
456  
457      if (idat.excluded) return;
458  
459 <    if ((iHash & LJ_PAIR) != 0)             lj_->calcForce(idat);
460 <    if ((iHash & GB_PAIR) != 0)             gb_->calcForce(idat);
461 <    if ((iHash & STICKY_PAIR) != 0)         sticky_->calcForce(idat);
462 <    if ((iHash & MORSE_PAIR) != 0)          morse_->calcForce(idat);
463 <    if ((iHash & REPULSIVEPOWER_PAIR) != 0) repulsivePower_->calcForce(idat);
464 <    if ((iHash & EAM_PAIR) != 0)            eam_->calcForce(idat);
465 <    if ((iHash & SC_PAIR) != 0)             sc_->calcForce(idat);
466 <    if ((iHash & MAW_PAIR) != 0)            maw_->calcForce(idat);
459 >    if ((iHash & LJ_INTERACTION) != 0)             lj_->calcForce(idat);
460 >    if ((iHash & GB_INTERACTION) != 0)             gb_->calcForce(idat);
461 >    if ((iHash & STICKY_INTERACTION) != 0)         sticky_->calcForce(idat);
462 >    if ((iHash & MORSE_INTERACTION) != 0)          morse_->calcForce(idat);
463 >    if ((iHash & REPULSIVEPOWER_INTERACTION) != 0) repulsivePower_->calcForce(idat);
464 >    if ((iHash & EAM_INTERACTION) != 0)            eam_->calcForce(idat);
465 >    if ((iHash & SC_INTERACTION) != 0)             sc_->calcForce(idat);
466 >    if ((iHash & MAW_INTERACTION) != 0)            maw_->calcForce(idat);
467  
468      // set<NonBondedInteraction*>::iterator it;
469  
# Line 462 | Line 485 | namespace OpenMD {
485  
486      if (!initialized_) initialize();
487      
488 <    int& iHash = iHash_[sdat.atid][sdat.atid];
488 >    int& sHash = sHash_[sdat.atid];
489  
490 <    if ((iHash & ELECTROSTATIC_PAIR) != 0) electrostatic_->calcSelfCorrection(sdat);
490 >    if ((sHash & ELECTROSTATIC_INTERACTION) != 0) electrostatic_->calcSelfCorrection(sdat);
491  
492      // set<NonBondedInteraction*>::iterator it;
493  
# Line 477 | Line 500 | namespace OpenMD {
500      return;    
501    }
502  
503 <  void InteractionManager::doReciprocalSpaceSum(potVec &pot){
503 >  void InteractionManager::doReciprocalSpaceSum(RealType &pot){
504      if (!initialized_) initialize();
505      electrostatic_->ReciprocalSpaceSum(pot);
506    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines