| 113 |
|
} else { |
| 114 |
|
// throw error |
| 115 |
|
sprintf( painCave.errMsg, |
| 116 |
< |
"SimInfo error: Unknown electrostaticSummationMethod.\n" |
| 116 |
> |
"Electrostatic::initialize: Unknown electrostaticSummationMethod.\n" |
| 117 |
|
"\t(Input file specified %s .)\n" |
| 118 |
|
"\telectrostaticSummationMethod must be one of: \"none\",\n" |
| 119 |
|
"\t\"shifted_potential\", \"shifted_force\", or \n" |
| 429 |
|
haveDielectric_ = true; |
| 430 |
|
} |
| 431 |
|
|
| 432 |
< |
void Electrostatic::calcForce(InteractionData idat) { |
| 432 |
> |
void Electrostatic::calcForce(InteractionData &idat) { |
| 433 |
|
|
| 434 |
|
// utility variables. Should clean these up and use the Vector3d and |
| 435 |
|
// Mat3x3d to replace as many as we can in future versions: |
| 591 |
|
|
| 592 |
|
} |
| 593 |
|
|
| 594 |
< |
idat.vpair += vterm; |
| 594 |
> |
idat.vpair[2] += vterm; |
| 595 |
|
epot += idat.sw * vterm; |
| 596 |
|
|
| 597 |
|
dVdr += dudr * rhat; |
| 607 |
|
ri3 = ri2 * riji; |
| 608 |
|
|
| 609 |
|
vterm = - pref * ct_j * ( ri2 - preRF2_ * idat.rij ); |
| 610 |
< |
idat.vpair += vterm; |
| 610 |
> |
idat.vpair[2] += vterm; |
| 611 |
|
epot += idat.sw * vterm; |
| 612 |
|
|
| 613 |
|
dVdr += -preSw * (ri3 * (uz_j - 3.0 * ct_j * rhat) - preRF2_*uz_j); |
| 645 |
|
// calculate the potential |
| 646 |
|
pot_term = scale * c2; |
| 647 |
|
vterm = -pref * ct_j * pot_term; |
| 648 |
< |
idat.vpair += vterm; |
| 648 |
> |
idat.vpair[2] += vterm; |
| 649 |
|
epot += idat.sw * vterm; |
| 650 |
|
|
| 651 |
|
// calculate derivatives for forces and torques |
| 692 |
|
qyy_j * (cy2*c3 - c2ri) + |
| 693 |
|
qzz_j * (cz2*c3 - c2ri) ); |
| 694 |
|
vterm = pref * pot_term; |
| 695 |
< |
idat.vpair += vterm; |
| 695 |
> |
idat.vpair[2] += vterm; |
| 696 |
|
epot += idat.sw * vterm; |
| 697 |
|
|
| 698 |
|
// calculate derivatives for the forces and torques |
| 720 |
|
ri3 = ri2 * riji; |
| 721 |
|
|
| 722 |
|
vterm = pref * ct_i * ( ri2 - preRF2_ * idat.rij ); |
| 723 |
< |
idat.vpair += vterm; |
| 723 |
> |
idat.vpair[2] += vterm; |
| 724 |
|
epot += idat.sw * vterm; |
| 725 |
|
|
| 726 |
|
dVdr += preSw * (ri3 * (uz_i - 3.0 * ct_i * rhat) - preRF2_ * uz_i); |
| 760 |
|
// calculate the potential |
| 761 |
|
pot_term = c2 * scale; |
| 762 |
|
vterm = pref * ct_i * pot_term; |
| 763 |
< |
idat.vpair += vterm; |
| 763 |
> |
idat.vpair[2] += vterm; |
| 764 |
|
epot += idat.sw * vterm; |
| 765 |
|
|
| 766 |
|
// calculate derivatives for the forces and torques |
| 783 |
|
|
| 784 |
|
vterm = pref * ( ri3 * (ct_ij - 3.0 * ct_i * ct_j) - |
| 785 |
|
preRF2_ * ct_ij ); |
| 786 |
< |
idat.vpair += vterm; |
| 786 |
> |
idat.vpair[2] += vterm; |
| 787 |
|
epot += idat.sw * vterm; |
| 788 |
|
|
| 789 |
|
a1 = 5.0 * ct_i * ct_j - ct_ij; |
| 842 |
|
// calculate the potential |
| 843 |
|
pot_term = (ct_ij * c2ri - ctidotj * c3); |
| 844 |
|
vterm = pref * pot_term; |
| 845 |
< |
idat.vpair += vterm; |
| 845 |
> |
idat.vpair[2] += vterm; |
| 846 |
|
epot += idat.sw * vterm; |
| 847 |
|
|
| 848 |
|
// calculate derivatives for the forces and torques |
| 894 |
|
qzz_i * (cz2 * c3 - c2ri) ); |
| 895 |
|
|
| 896 |
|
vterm = pref * pot_term; |
| 897 |
< |
idat.vpair += vterm; |
| 897 |
> |
idat.vpair[2] += vterm; |
| 898 |
|
epot += idat.sw * vterm; |
| 899 |
|
|
| 900 |
|
// calculate the derivatives for the forces and torques |
| 909 |
|
} |
| 910 |
|
} |
| 911 |
|
|
| 912 |
< |
idat.pot += epot; |
| 912 |
> |
idat.pot[2] += epot; |
| 913 |
|
idat.f1 += dVdr; |
| 914 |
|
|
| 915 |
|
if (i_is_Dipole || i_is_Quadrupole) |
| 929 |
|
return; |
| 930 |
|
} |
| 931 |
|
|
| 932 |
< |
void Electrostatic::calcSkipCorrection(SkipCorrectionData skdat) { |
| 932 |
> |
void Electrostatic::calcSkipCorrection(SkipCorrectionData &skdat) { |
| 933 |
|
|
| 934 |
|
if (!initialized_) initialize(); |
| 935 |
|
|
| 963 |
|
|
| 964 |
|
if (summationMethod_ == esm_REACTION_FIELD) { |
| 965 |
|
RealType riji, ri2, ri3; |
| 966 |
< |
RealType q_i, mu_i, ct_i; |
| 967 |
< |
RealType q_j, mu_j, ct_j; |
| 968 |
< |
RealType preVal, rfVal, vterm, dudr, pref, myPot; |
| 966 |
> |
RealType mu_i, ct_i; |
| 967 |
> |
RealType mu_j, ct_j; |
| 968 |
> |
RealType preVal, rfVal, vterm, dudr, pref, myPot(0.0); |
| 969 |
|
Vector3d dVdr, uz_i, uz_j, duduz_i, duduz_j, rhat; |
| 970 |
|
|
| 971 |
|
// some variables we'll need independent of electrostatic type: |
| 1020 |
|
} |
| 1021 |
|
|
| 1022 |
|
// accumulate the forces and torques resulting from the self term |
| 1023 |
< |
skdat.pot += myPot; |
| 1023 |
> |
skdat.pot[2] += myPot; |
| 1024 |
|
skdat.f1 += dVdr; |
| 1025 |
|
|
| 1026 |
|
if (i_is_Dipole) |
| 1030 |
|
} |
| 1031 |
|
} |
| 1032 |
|
|
| 1033 |
< |
void Electrostatic::calcSelfCorrection(SelfCorrectionData scdat) { |
| 1033 |
> |
void Electrostatic::calcSelfCorrection(SelfCorrectionData &scdat) { |
| 1034 |
|
RealType mu1, preVal, chg1, self; |
| 1035 |
|
|
| 1036 |
|
if (!initialized_) initialize(); |
| 1046 |
|
if (i_is_Dipole) { |
| 1047 |
|
mu1 = data.dipole_moment; |
| 1048 |
|
preVal = pre22_ * preRF2_ * mu1 * mu1; |
| 1049 |
< |
scdat.pot -= 0.5 * preVal; |
| 1049 |
> |
scdat.pot[2] -= 0.5 * preVal; |
| 1050 |
|
|
| 1051 |
|
// The self-correction term adds into the reaction field vector |
| 1052 |
|
Vector3d uz_i = scdat.eFrame.getColumn(2); |
| 1063 |
|
} else { |
| 1064 |
|
self = - 0.5 * rcuti_ * chg1 * (chg1 + scdat.skippedCharge) * pre11_; |
| 1065 |
|
} |
| 1066 |
< |
scdat.pot += self; |
| 1066 |
> |
scdat.pot[2] += self; |
| 1067 |
|
} |
| 1068 |
|
} |
| 1069 |
|
} |