| 461 |
|
RealType c1, c2, c3, c4; |
| 462 |
|
RealType erfcVal(1.0), derfcVal(0.0); |
| 463 |
|
RealType BigR; |
| 464 |
+ |
RealType two(2.0), three(3.0); |
| 465 |
|
|
| 466 |
|
Vector3d Q_i, Q_j; |
| 467 |
|
Vector3d ux_i, uy_i, uz_i; |
| 622 |
|
if (idat.excluded) { |
| 623 |
|
indirect_vpair += preVal * rfVal; |
| 624 |
|
indirect_Pot += *(idat.sw) * preVal * rfVal; |
| 625 |
< |
indirect_dVdr += *(idat.sw) * preVal * 2.0 * rfVal * riji * rhat; |
| 625 |
> |
indirect_dVdr += *(idat.sw) * preVal * two * rfVal * riji * rhat; |
| 626 |
|
} |
| 627 |
|
|
| 628 |
|
} else { |
| 650 |
|
vpair += vterm; |
| 651 |
|
epot += *(idat.sw) * vterm; |
| 652 |
|
|
| 653 |
< |
dVdr += -preSw * (ri3 * (uz_j - 3.0 * ct_j * rhat) - preRF2_*uz_j); |
| 653 |
> |
dVdr += -preSw * (ri3 * (uz_j - three * ct_j * rhat) - preRF2_*uz_j); |
| 654 |
|
duduz_j += -preSw * rhat * (ri2 - preRF2_ * *(idat.rij) ); |
| 655 |
|
|
| 656 |
|
// Even if we excluded this pair from direct interactions, |
| 739 |
|
c2ri = c2 * riji; |
| 740 |
|
c3ri = c3 * riji; |
| 741 |
|
c4rij = c4 * *(idat.rij) ; |
| 742 |
< |
rhatdot2 = 2.0 * rhat * c3; |
| 742 |
> |
rhatdot2 = two * rhat * c3; |
| 743 |
|
rhatc4 = rhat * c4rij; |
| 744 |
|
|
| 745 |
|
// calculate the potential |
| 752 |
|
|
| 753 |
|
// calculate derivatives for the forces and torques |
| 754 |
|
|
| 755 |
< |
dVdr += -preSw * ( qxx_j* (cx2*rhatc4 - (2.0*cx_j*ux_j + rhat)*c3ri) + |
| 756 |
< |
qyy_j* (cy2*rhatc4 - (2.0*cy_j*uy_j + rhat)*c3ri) + |
| 757 |
< |
qzz_j* (cz2*rhatc4 - (2.0*cz_j*uz_j + rhat)*c3ri)); |
| 755 |
> |
dVdr += -preSw * ( qxx_j* (cx2*rhatc4 - (two*cx_j*ux_j + rhat)*c3ri) + |
| 756 |
> |
qyy_j* (cy2*rhatc4 - (two*cy_j*uy_j + rhat)*c3ri) + |
| 757 |
> |
qzz_j* (cz2*rhatc4 - (two*cz_j*uz_j + rhat)*c3ri)); |
| 758 |
|
|
| 759 |
|
dudux_j += preSw * qxx_j * cx_j * rhatdot2; |
| 760 |
|
duduy_j += preSw * qyy_j * cy_j * rhatdot2; |
| 778 |
|
vpair += vterm; |
| 779 |
|
epot += *(idat.sw) * vterm; |
| 780 |
|
|
| 781 |
< |
dVdr += preSw * (ri3 * (uz_i - 3.0 * ct_i * rhat) - preRF2_ * uz_i); |
| 781 |
> |
dVdr += preSw * (ri3 * (uz_i - three * ct_i * rhat) - preRF2_ * uz_i); |
| 782 |
|
|
| 783 |
|
duduz_i += preSw * rhat * (ri2 - preRF2_ * *(idat.rij) ); |
| 784 |
|
|
| 856 |
|
|
| 857 |
|
a1 = 5.0 * ct_i * ct_j - ct_ij; |
| 858 |
|
|
| 859 |
< |
dVdr += preSw * 3.0 * ri4 * (a1 * rhat - ct_i * uz_j - ct_j * uz_i); |
| 859 |
> |
dVdr += preSw * three * ri4 * (a1 * rhat - ct_i * uz_j - ct_j * uz_i); |
| 860 |
|
|
| 861 |
< |
duduz_i += preSw * (ri3 * (uz_j - 3.0 * ct_j * rhat) - preRF2_*uz_j); |
| 862 |
< |
duduz_j += preSw * (ri3 * (uz_i - 3.0 * ct_i * rhat) - preRF2_*uz_i); |
| 861 |
> |
duduz_i += preSw * (ri3 * (uz_j - three * ct_j * rhat) - preRF2_*uz_j); |
| 862 |
> |
duduz_j += preSw * (ri3 * (uz_i - three * ct_i * rhat) - preRF2_*uz_i); |
| 863 |
|
|
| 864 |
|
if (idat.excluded) { |
| 865 |
|
indirect_vpair += - pref * preRF2_ * ct_ij; |
| 964 |
|
c2ri = c2 * riji; |
| 965 |
|
c3ri = c3 * riji; |
| 966 |
|
c4rij = c4 * *(idat.rij) ; |
| 967 |
< |
rhatdot2 = 2.0 * rhat * c3; |
| 967 |
> |
rhatdot2 = two * rhat * c3; |
| 968 |
|
rhatc4 = rhat * c4rij; |
| 969 |
|
|
| 970 |
|
// calculate the potential |
| 978 |
|
|
| 979 |
|
// calculate the derivatives for the forces and torques |
| 980 |
|
|
| 981 |
< |
dVdr += -preSw * (qxx_i* (cx2*rhatc4 - (2.0*cx_i*ux_i + rhat)*c3ri) + |
| 982 |
< |
qyy_i* (cy2*rhatc4 - (2.0*cy_i*uy_i + rhat)*c3ri) + |
| 983 |
< |
qzz_i* (cz2*rhatc4 - (2.0*cz_i*uz_i + rhat)*c3ri)); |
| 981 |
> |
dVdr += -preSw * (qxx_i* (cx2*rhatc4 - (two*cx_i*ux_i + rhat)*c3ri) + |
| 982 |
> |
qyy_i* (cy2*rhatc4 - (two*cy_i*uy_i + rhat)*c3ri) + |
| 983 |
> |
qzz_i* (cz2*rhatc4 - (two*cz_i*uz_i + rhat)*c3ri)); |
| 984 |
|
|
| 985 |
|
dudux_i += preSw * qxx_i * cx_i * rhatdot2; |
| 986 |
|
duduy_i += preSw * qyy_i * cy_i * rhatdot2; |