--- branches/development/src/nonbonded/LJ.cpp 2011/04/08 21:25:19 1545 +++ branches/development/src/nonbonded/LJ.cpp 2011/11/22 20:38:56 1665 @@ -36,7 +36,8 @@ * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #include @@ -48,8 +49,7 @@ namespace OpenMD { namespace OpenMD { - LJ::LJ() : name_("LJ"), initialized_(false), shiftedPot_(false), - shiftedFrc_(false), forceField_(NULL) {} + LJ::LJ() : name_("LJ"), initialized_(false), forceField_(NULL) {} LJParam LJ::getLJParam(AtomType* atomType) { @@ -243,9 +243,9 @@ namespace OpenMD { void LJ::calcForce(InteractionData &idat) { if (!initialized_) initialize(); - + map, LJInteractionData>::iterator it; - it = MixingMap.find(idat.atypes); + it = MixingMap.find( idat.atypes ); if (it != MixingMap.end()) { @@ -261,31 +261,31 @@ namespace OpenMD { RealType myDeriv = 0.0; RealType myDerivC = 0.0; - ros = idat.rij * sigmai; + ros = *(idat.rij) * sigmai; getLJfunc(ros, myPot, myDeriv); - if (shiftedPot_) { - rcos = idat.rcut * sigmai; + if (idat.shiftedPot) { + rcos = *(idat.rcut) * sigmai; getLJfunc(rcos, myPotC, myDerivC); myDerivC = 0.0; - } else if (LJ::shiftedFrc_) { - rcos = idat.rcut * sigmai; + } else if (idat.shiftedForce) { + rcos = *(idat.rcut) * sigmai; getLJfunc(rcos, myPotC, myDerivC); - myPotC = myPotC + myDerivC * (idat.rij - idat.rcut) * sigmai; + myPotC = myPotC + myDerivC * (*(idat.rij) - *(idat.rcut)) * sigmai; } else { myPotC = 0.0; myDerivC = 0.0; } - RealType pot_temp = idat.vdwMult * epsilon * (myPot - myPotC); - idat.vpair[0] += pot_temp; + RealType pot_temp = *(idat.vdwMult) * epsilon * (myPot - myPotC); + *(idat.vpair) += pot_temp; - RealType dudr = idat.sw * idat.vdwMult * epsilon * (myDeriv - - myDerivC)*sigmai; - - idat.pot[0] += idat.sw * pot_temp; - idat.f1 = idat.d * dudr / idat.rij; + RealType dudr = *(idat.sw) * *(idat.vdwMult) * epsilon * (myDeriv - + myDerivC)*sigmai; + + (*(idat.pot))[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp; + *(idat.f1) += *(idat.d) * dudr / *(idat.rij); } return; }