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 1471 by gezelter, Mon Jul 19 18:59:59 2010 UTC vs.
Revision 1472 by gezelter, Mon Jul 19 20:42:55 2010 UTC

# Line 285 | Line 285 | namespace OpenMD {
285      }    
286    }
287  
288 <  void LJ::calcForce(AtomType* at1, AtomType* at2, Vector3d d, RealType rij,
289 <                     RealType r2, RealType rcut, RealType sw, RealType vdwMult,
290 <                     RealType vpair, RealType pot, Vector3d f1) {
288 >  void LJ::calcForce(AtomType* at1, AtomType* at2, Vector3d d,
289 >                     RealType rij, RealType r2, RealType rcut, RealType sw,
290 >                     RealType vdwMult, RealType &vpair, RealType &pot,
291 >                     Vector3d &f1) {
292  
293      if (!initialized_) initialize();
294      
# Line 347 | Line 348 | namespace OpenMD {
348      
349      calcForce(atype1, atype2, disp, *rij, *r2, *rcut, *sw, *vdwMult, *vpair,
350                *pot, frc);
351 +      
352 +    f1[0] = frc.x();
353 +    f1[1] = frc.y();
354 +    f1[2] = frc.z();
355 +    
356      return;    
357    }
358    
359 <  void LJ::getLJfunc(const RealType r, RealType pot, RealType deriv) {
359 >  void LJ::getLJfunc(RealType r, RealType &pot, RealType &deriv) {
360 >
361      RealType ri = 1.0 / r;
362      RealType ri2 = ri * ri;
363      RealType ri6 = ri2 * ri2 * ri2;
364      RealType ri7 = ri6 * ri;
365      RealType ri12 = ri6 * ri6;
366      RealType ri13 = ri12 * ri;
367 <
367 >    
368      pot = 4.0 * (ri12 - ri6);
369      deriv = 24.0 * (ri7 - 2.0 * ri13);
370 +
371      return;
372    }
373 +  
374  
366
375    void LJ::setLJDefaultCutoff(RealType *thisRcut, int *sP, int *sF) {
376      shiftedPot_ = (bool)(*sP);
377      shiftedFrc_ = (bool)(*sF);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines