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 |
|
|
242 |
|
void LJ::calcForce(InteractionData &idat) { |
243 |
|
|
244 |
|
if (!initialized_) initialize(); |
245 |
< |
|
245 |
> |
|
246 |
|
map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it; |
247 |
< |
it = MixingMap.find( *(idat.atypes) ); |
247 |
> |
it = MixingMap.find( idat.atypes ); |
248 |
|
|
249 |
|
if (it != MixingMap.end()) { |
250 |
|
|
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_) { |
267 |
> |
if (idat.shiftedPot) { |
268 |
|
rcos = *(idat.rcut) * sigmai; |
269 |
|
getLJfunc(rcos, myPotC, myDerivC); |
270 |
|
myDerivC = 0.0; |
271 |
< |
} else if (LJ::shiftedFrc_) { |
271 |
> |
} else if (idat.shiftedForce) { |
272 |
|
rcos = *(idat.rcut) * sigmai; |
273 |
|
getLJfunc(rcos, myPotC, myDerivC); |
274 |
|
myPotC = myPotC + myDerivC * (*(idat.rij) - *(idat.rcut)) * sigmai; |
281 |
|
*(idat.vpair) += pot_temp; |
282 |
|
|
283 |
|
RealType dudr = *(idat.sw) * *(idat.vdwMult) * epsilon * (myDeriv - |
284 |
< |
myDerivC)*sigmai; |
285 |
< |
|
286 |
< |
(idat.pot)[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp; |
284 |
> |
myDerivC)*sigmai; |
285 |
> |
|
286 |
> |
(*(idat.pot))[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp; |
287 |
|
*(idat.f1) = *(idat.d) * dudr / *(idat.rij); |
288 |
|
} |
289 |
|
return; |