| 263 |
|
} |
| 264 |
|
} |
| 265 |
|
|
| 266 |
< |
void GB::calcForce(InteractionData idat) { |
| 266 |
> |
void GB::calcForce(InteractionData &idat) { |
| 267 |
|
|
| 268 |
|
if (!initialized_) initialize(); |
| 269 |
|
|
| 270 |
< |
pair<AtomType*, AtomType*> key = make_pair(idat.atype1, idat.atype2); |
| 271 |
< |
GBInteractionData mixer = MixingMap[key]; |
| 270 |
> |
GBInteractionData mixer = MixingMap[idat.atypes]; |
| 271 |
|
|
| 272 |
|
RealType sigma0 = mixer.sigma0; |
| 273 |
|
RealType dw = mixer.dw; |
| 284 |
|
|
| 285 |
|
RealType a, b, g; |
| 286 |
|
|
| 287 |
< |
bool i_is_LJ = idat.atype1->isLennardJones(); |
| 288 |
< |
bool j_is_LJ = idat.atype2->isLennardJones(); |
| 287 |
> |
bool i_is_LJ = idat.atypes.first->isLennardJones(); |
| 288 |
> |
bool j_is_LJ = idat.atypes.second->isLennardJones(); |
| 289 |
|
|
| 290 |
|
if (i_is_LJ) { |
| 291 |
|
a = 0.0; |
| 356 |
|
Vector3d rxu2 = cross(idat.d, ul2); |
| 357 |
|
Vector3d uxu = cross(ul1, ul2); |
| 358 |
|
|
| 359 |
< |
idat.pot += U*idat.sw; |
| 359 |
> |
idat.pot[0] += U*idat.sw; |
| 360 |
|
idat.f1 += dUdr * rhat + dUda * ul1 + dUdb * ul2; |
| 361 |
|
idat.t1 += dUda * rxu1 - dUdg * uxu; |
| 362 |
|
idat.t2 += dUdb * rxu2 - dUdg * uxu; |
| 366 |
|
|
| 367 |
|
} |
| 368 |
|
|
| 369 |
< |
RealType GB::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) { |
| 369 |
> |
RealType GB::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) { |
| 370 |
|
if (!initialized_) initialize(); |
| 371 |
|
|
| 372 |
|
RealType cut = 0.0; |
| 373 |
|
|
| 374 |
< |
if (at1->isGayBerne()) { |
| 375 |
< |
GayBerneParam gb1 = getGayBerneParam(at1); |
| 374 |
> |
if (atypes.first->isGayBerne()) { |
| 375 |
> |
GayBerneParam gb1 = getGayBerneParam(atypes.first); |
| 376 |
|
RealType d1 = gb1.GB_d; |
| 377 |
|
RealType l1 = gb1.GB_l; |
| 378 |
|
// sigma is actually sqrt(2)*l for prolate ellipsoids |
| 379 |
|
cut = max(cut, 2.5 * sqrt(2.0) * max(d1, l1)); |
| 380 |
< |
} else if (at1->isLennardJones()) { |
| 381 |
< |
cut = max(cut, 2.5 * getLJSigma(at1)); |
| 380 |
> |
} else if (atypes.first->isLennardJones()) { |
| 381 |
> |
cut = max(cut, 2.5 * getLJSigma(atypes.first)); |
| 382 |
|
} |
| 383 |
|
|
| 384 |
< |
if (at2->isGayBerne()) { |
| 385 |
< |
GayBerneParam gb2 = getGayBerneParam(at2); |
| 384 |
> |
if (atypes.second->isGayBerne()) { |
| 385 |
> |
GayBerneParam gb2 = getGayBerneParam(atypes.second); |
| 386 |
|
RealType d2 = gb2.GB_d; |
| 387 |
|
RealType l2 = gb2.GB_l; |
| 388 |
|
cut = max(cut, 2.5 * sqrt(2.0) * max(d2, l2)); |
| 389 |
< |
} else if (at1->isLennardJones()) { |
| 390 |
< |
cut = max(cut, 2.5 * getLJSigma(at2)); |
| 389 |
> |
} else if (atypes.second->isLennardJones()) { |
| 390 |
> |
cut = max(cut, 2.5 * getLJSigma(atypes.second)); |
| 391 |
|
} |
| 392 |
|
|
| 393 |
|
return cut; |