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 ); |
248 |
|
|
260 |
|
RealType myDeriv = 0.0; |
261 |
|
RealType myDerivC = 0.0; |
262 |
|
|
263 |
< |
ros = *(idat.rij) * sigmai; |
265 |
< |
|
266 |
< |
cerr << "ros = " << ros << "\n"; |
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; |
277 |
|
myDerivC = 0.0; |
278 |
|
} |
279 |
|
|
283 |
– |
cerr << "myPot = " << myPot << "\n"; |
284 |
– |
cerr << "myPotC = " << myPotC << "\n"; |
285 |
– |
cerr << "epsilon = " << epsilon << "\n"; |
286 |
– |
cerr << "vdwm = " << *(idat.vdwMult) << "\n"; |
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)[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp; |
287 |
< |
*(idat.f1) = *(idat.d) * dudr / *(idat.rij); |
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 |
|
} |