240 |
|
} |
241 |
|
} |
242 |
|
|
243 |
< |
void LJ::calcForce(InteractionData idat) { |
243 |
> |
void LJ::calcForce(InteractionData &idat) { |
244 |
|
|
245 |
|
if (!initialized_) initialize(); |
246 |
|
|
247 |
– |
pair<AtomType*, AtomType*> key = make_pair(idat.atype1, idat.atype2); |
247 |
|
map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it; |
248 |
< |
it = MixingMap.find(key); |
248 |
> |
it = MixingMap.find( idat.atypes ); |
249 |
|
|
250 |
|
if (it != MixingMap.end()) { |
251 |
|
|
261 |
|
RealType myDeriv = 0.0; |
262 |
|
RealType myDerivC = 0.0; |
263 |
|
|
264 |
< |
ros = idat.rij * sigmai; |
264 |
> |
ros = *(idat.rij) * sigmai; |
265 |
|
|
266 |
+ |
cerr << "ros = " << ros << "\n"; |
267 |
+ |
|
268 |
|
getLJfunc(ros, myPot, myDeriv); |
269 |
|
|
270 |
|
if (shiftedPot_) { |
271 |
< |
rcos = idat.rcut * sigmai; |
271 |
> |
rcos = *(idat.rcut) * sigmai; |
272 |
|
getLJfunc(rcos, myPotC, myDerivC); |
273 |
|
myDerivC = 0.0; |
274 |
|
} else if (LJ::shiftedFrc_) { |
275 |
< |
rcos = idat.rcut * sigmai; |
275 |
> |
rcos = *(idat.rcut) * sigmai; |
276 |
|
getLJfunc(rcos, myPotC, myDerivC); |
277 |
< |
myPotC = myPotC + myDerivC * (idat.rij - idat.rcut) * sigmai; |
277 |
> |
myPotC = myPotC + myDerivC * (*(idat.rij) - *(idat.rcut)) * sigmai; |
278 |
|
} else { |
279 |
|
myPotC = 0.0; |
280 |
|
myDerivC = 0.0; |
281 |
|
} |
282 |
|
|
283 |
< |
RealType pot_temp = idat.vdwMult * epsilon * (myPot - myPotC); |
284 |
< |
idat.vpair += pot_temp; |
285 |
< |
|
286 |
< |
RealType dudr = idat.sw * idat.vdwMult * epsilon * (myDeriv - |
287 |
< |
myDerivC)*sigmai; |
283 |
> |
cerr << "myPot = " << myPot << "\n"; |
284 |
> |
cerr << "myPotC = " << myPotC << "\n"; |
285 |
> |
cerr << "epsilon = " << epsilon << "\n"; |
286 |
> |
cerr << "vdwm = " << *(idat.vdwMult) << "\n"; |
287 |
> |
RealType pot_temp = *(idat.vdwMult) * epsilon * (myPot - myPotC); |
288 |
> |
*(idat.vpair) += pot_temp; |
289 |
|
|
290 |
< |
idat.pot += idat.sw * pot_temp; |
291 |
< |
idat.f1 = idat.d * dudr / idat.rij; |
290 |
> |
RealType dudr = *(idat.sw) * *(idat.vdwMult) * epsilon * (myDeriv - |
291 |
> |
myDerivC)*sigmai; |
292 |
|
|
293 |
+ |
(idat.pot)[VANDERWAALS_FAMILY] += *(idat.sw) * pot_temp; |
294 |
+ |
*(idat.f1) = *(idat.d) * dudr / *(idat.rij); |
295 |
|
} |
296 |
|
return; |
297 |
|
} |
311 |
|
return; |
312 |
|
} |
313 |
|
|
314 |
< |
RealType LJ::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) { |
314 |
> |
RealType LJ::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) { |
315 |
|
if (!initialized_) initialize(); |
312 |
– |
pair<AtomType*, AtomType*> key = make_pair(at1, at2); |
316 |
|
map<pair<AtomType*, AtomType*>, LJInteractionData>::iterator it; |
317 |
< |
it = MixingMap.find(key); |
317 |
> |
it = MixingMap.find(atypes); |
318 |
|
if (it == MixingMap.end()) |
319 |
|
return 0.0; |
320 |
|
else { |