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

Comparing branches/development/src/nonbonded/Morse.cpp (file contents):
Revision 1505 by gezelter, Sun Oct 3 22:18:59 2010 UTC vs.
Revision 1571 by gezelter, Fri May 27 16:45:44 2011 UTC

# Line 142 | Line 142 | namespace OpenMD {
142      }    
143    }
144    
145 <  void Morse::calcForce(InteractionData idat) {
145 >  void Morse::calcForce(InteractionData &idat) {
146  
147      if (!initialized_) initialize();
148      
149    pair<AtomType*, AtomType*> key = make_pair(idat.atype1, idat.atype2);
149      map<pair<AtomType*, AtomType*>, MorseInteractionData>::iterator it;
150 <    it = MixingMap.find(key);
150 >    it = MixingMap.find( idat.atypes );
151      if (it != MixingMap.end()) {
152        MorseInteractionData mixer = (*it).second;
153        
# Line 164 | Line 163 | namespace OpenMD {
163        
164        // V(r) = D_e exp(-a(r-re)(exp(-a(r-re))-2)
165        
166 <      RealType expt     = -beta*(idat.rij - Re);
166 >      RealType expt     = -beta*( *(idat.rij) - Re);
167        RealType expfnc   = exp(expt);
168        RealType expfnc2  = expfnc*expfnc;
169        
# Line 173 | Line 172 | namespace OpenMD {
172        RealType expfnc2C = 0.0;
173        
174        if (Morse::shiftedPot_ || Morse::shiftedFrc_) {
175 <        exptC     = -beta*(idat.rcut - Re);
175 >        exptC     = -beta*( *(idat.rcut) - Re);
176          expfncC   = exp(exptC);
177          expfnc2C  = expfncC*expfncC;
178        }
# Line 191 | Line 190 | namespace OpenMD {
190          } else if (Morse::shiftedFrc_) {
191            myPotC = De * (expfnc2C - 2.0 * expfncC);
192            myDerivC  = 2.0 * De * beta * (expfnc2C - expfnc2C);
193 <          myPotC += myDerivC * (idat.rij - idat.rcut);
193 >          myPotC += myDerivC * ( *(idat.rij) - *(idat.rcut) );
194          } else {
195            myPotC = 0.0;
196            myDerivC = 0.0;
# Line 210 | Line 209 | namespace OpenMD {
209          } else if (Morse::shiftedFrc_) {
210            myPotC = De * expfnc2C;
211            myDerivC = -2.0 * De * beta * expfnc2C;
212 <          myPotC += myDerivC * (idat.rij - idat.rcut);
212 >          myPotC += myDerivC * ( *(idat.rij) - *(idat.rcut));
213          } else {
214            myPotC = 0.0;
215            myDerivC = 0.0;
# Line 220 | Line 219 | namespace OpenMD {
219        }
220        }
221        
222 <      RealType pot_temp = idat.vdwMult * (myPot - myPotC);
223 <      idat.vpair += pot_temp;
222 >      RealType pot_temp = *(idat.vdwMult) * (myPot - myPotC);
223 >      *(idat.vpair) += pot_temp;
224        
225 <      RealType dudr = idat.sw * idat.vdwMult * (myDeriv - myDerivC);
225 >      RealType dudr = *(idat.sw) * *(idat.vdwMult) * (myDeriv - myDerivC);
226        
227 <      idat.pot += idat.sw * pot_temp;
228 <      idat.f1 = idat.d * dudr / idat.rij;
227 >      idat.pot[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp;
228 >      *(idat.f1) = *(idat.d) * dudr / *(idat.rij);
229      }
230      return;
231      
232    }
233      
234 <  RealType Morse::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) {
234 >  RealType Morse::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) {
235      if (!initialized_) initialize();  
237    pair<AtomType*, AtomType*> key = make_pair(at1, at2);
236      map<pair<AtomType*, AtomType*>, MorseInteractionData>::iterator it;
237 <    it = MixingMap.find(key);
237 >    it = MixingMap.find(atypes);
238      if (it == MixingMap.end())
239        return 0.0;
240      else  {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines