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

Comparing branches/development/src/nonbonded/LJ.cpp (file contents):
Revision 1505 by gezelter, Sun Oct 3 22:18:59 2010 UTC vs.
Revision 1629 by gezelter, Wed Sep 14 21:15:17 2011 UTC

# Line 48 | Line 48 | namespace OpenMD {
48  
49   namespace OpenMD {
50  
51 <  LJ::LJ() : name_("LJ"), initialized_(false), shiftedPot_(false),
52 <             shiftedFrc_(false), forceField_(NULL) {}
51 >  LJ::LJ() : name_("LJ"), initialized_(false), forceField_(NULL) {}
52  
53    LJParam LJ::getLJParam(AtomType* atomType) {
54      
# Line 240 | Line 239 | namespace OpenMD {
239      }    
240    }
241  
242 <  void LJ::calcForce(InteractionData idat) {
242 >  void LJ::calcForce(InteractionData &idat) {
243      
244      if (!initialized_) initialize();
245 <    
247 <    pair<AtomType*, AtomType*> key = make_pair(idat.atype1, idat.atype2);
245 >
246      map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it;
247 <    it = MixingMap.find(key);
247 >    it = MixingMap.find( idat.atypes );
248      
249      if (it != MixingMap.end())  {
250        
# Line 262 | Line 260 | namespace OpenMD {
260        RealType myDeriv = 0.0;
261        RealType myDerivC = 0.0;
262      
263 <      ros = idat.rij * sigmai;
263 >      ros = *(idat.rij) * sigmai;    
264        
265        getLJfunc(ros, myPot, myDeriv);
266        
267 <      if (shiftedPot_) {
268 <        rcos = idat.rcut * sigmai;
267 >      if (idat.shiftedPot) {
268 >        rcos = *(idat.rcut) * sigmai;
269          getLJfunc(rcos, myPotC, myDerivC);
270          myDerivC = 0.0;
271 <      } else if (LJ::shiftedFrc_) {
272 <        rcos = idat.rcut * sigmai;
271 >      } else if (idat.shiftedForce) {
272 >        rcos = *(idat.rcut) * sigmai;
273          getLJfunc(rcos, myPotC, myDerivC);
274 <        myPotC = myPotC + myDerivC * (idat.rij - idat.rcut) * sigmai;
274 >        myPotC = myPotC + myDerivC * (*(idat.rij) - *(idat.rcut)) * sigmai;
275        } else {
276          myPotC = 0.0;
277          myDerivC = 0.0;        
278        }
279  
280 <      RealType pot_temp = idat.vdwMult * epsilon * (myPot - myPotC);
281 <      idat.vpair += pot_temp;
280 >      RealType pot_temp = *(idat.vdwMult) * epsilon * (myPot - myPotC);
281 >      *(idat.vpair) += pot_temp;
282        
283 <      RealType dudr = idat.sw * idat.vdwMult * epsilon * (myDeriv -
284 <                                                          myDerivC)*sigmai;
285 <      
286 <      idat.pot += idat.sw * pot_temp;
287 <      idat.f1 = idat.d * dudr / idat.rij;
290 <      
283 >      RealType dudr = *(idat.sw) * *(idat.vdwMult) * epsilon * (myDeriv -
284 >                                                                myDerivC)*sigmai;      
285 >
286 >      (*(idat.pot))[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp;
287 >      *(idat.f1) += *(idat.d) * dudr / *(idat.rij);
288      }
289      return;
290    }
# Line 307 | Line 304 | namespace OpenMD {
304      return;
305    }
306    
307 <  RealType LJ::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) {
307 >  RealType LJ::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) {
308      if (!initialized_) initialize();  
312    pair<AtomType*, AtomType*> key = make_pair(at1, at2);
309      map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it;
310 <    it = MixingMap.find(key);
310 >    it = MixingMap.find(atypes);
311      if (it == MixingMap.end())
312        return 0.0;
313      else  {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines