| 463 |
|
|
| 464 |
|
if (!initialized_) initialize(); |
| 465 |
|
|
| 466 |
< |
ElectrostaticAtomData data1 = ElectrostaticMap[idat.atype1]; |
| 467 |
< |
ElectrostaticAtomData data2 = ElectrostaticMap[idat.atype2]; |
| 466 |
> |
ElectrostaticAtomData data1 = ElectrostaticMap[idat.atypes.first]; |
| 467 |
> |
ElectrostaticAtomData data2 = ElectrostaticMap[idat.atypes.second]; |
| 468 |
|
|
| 469 |
|
// some variables we'll need independent of electrostatic type: |
| 470 |
|
|
| 929 |
|
return; |
| 930 |
|
} |
| 931 |
|
|
| 932 |
< |
void Electrostatic::calcSkipCorrection(SkipCorrectionData &skdat) { |
| 932 |
> |
void Electrostatic::calcSkipCorrection(InteractionData &idat) { |
| 933 |
|
|
| 934 |
|
if (!initialized_) initialize(); |
| 935 |
|
|
| 936 |
< |
ElectrostaticAtomData data1 = ElectrostaticMap[skdat.atype1]; |
| 937 |
< |
ElectrostaticAtomData data2 = ElectrostaticMap[skdat.atype2]; |
| 936 |
> |
ElectrostaticAtomData data1 = ElectrostaticMap[idat.atypes.first]; |
| 937 |
> |
ElectrostaticAtomData data2 = ElectrostaticMap[idat.atypes.second]; |
| 938 |
|
|
| 939 |
|
// logicals |
| 940 |
|
|
| 951 |
|
|
| 952 |
|
if (i_is_Charge) { |
| 953 |
|
q_i = data1.charge; |
| 954 |
< |
skdat.skippedCharge2 += q_i; |
| 954 |
> |
idat.skippedCharge2 += q_i; |
| 955 |
|
} |
| 956 |
|
|
| 957 |
|
if (j_is_Charge) { |
| 958 |
|
q_j = data2.charge; |
| 959 |
< |
skdat.skippedCharge1 += q_j; |
| 959 |
> |
idat.skippedCharge1 += q_j; |
| 960 |
|
} |
| 961 |
|
|
| 962 |
|
// the rest of this function should only be necessary for reaction field. |
| 970 |
|
|
| 971 |
|
// some variables we'll need independent of electrostatic type: |
| 972 |
|
|
| 973 |
< |
riji = 1.0 / skdat.rij; |
| 974 |
< |
rhat = skdat.d * riji; |
| 973 |
> |
riji = 1.0 / idat.rij; |
| 974 |
> |
rhat = idat.d * riji; |
| 975 |
|
|
| 976 |
|
if (i_is_Dipole) { |
| 977 |
|
mu_i = data1.dipole_moment; |
| 978 |
< |
uz_i = skdat.eFrame1.getColumn(2); |
| 978 |
> |
uz_i = idat.eFrame1.getColumn(2); |
| 979 |
|
ct_i = dot(uz_i, rhat); |
| 980 |
|
duduz_i = V3Zero; |
| 981 |
|
} |
| 982 |
|
|
| 983 |
|
if (j_is_Dipole) { |
| 984 |
|
mu_j = data2.dipole_moment; |
| 985 |
< |
uz_j = skdat.eFrame2.getColumn(2); |
| 985 |
> |
uz_j = idat.eFrame2.getColumn(2); |
| 986 |
|
ct_j = dot(uz_j, rhat); |
| 987 |
|
duduz_j = V3Zero; |
| 988 |
|
} |
| 989 |
|
|
| 990 |
|
if (i_is_Charge) { |
| 991 |
|
if (j_is_Charge) { |
| 992 |
< |
preVal = skdat.electroMult * pre11_ * q_i * q_j; |
| 993 |
< |
rfVal = preRF_ * skdat.rij * skdat.rij; |
| 992 |
> |
preVal = idat.electroMult * pre11_ * q_i * q_j; |
| 993 |
> |
rfVal = preRF_ * idat.rij * idat.rij; |
| 994 |
|
vterm = preVal * rfVal; |
| 995 |
< |
myPot += skdat.sw * vterm; |
| 996 |
< |
dudr = skdat.sw * preVal * 2.0 * rfVal * riji; |
| 995 |
> |
myPot += idat.sw * vterm; |
| 996 |
> |
dudr = idat.sw * preVal * 2.0 * rfVal * riji; |
| 997 |
|
dVdr += dudr * rhat; |
| 998 |
|
} |
| 999 |
|
|
| 1000 |
|
if (j_is_Dipole) { |
| 1001 |
|
ri2 = riji * riji; |
| 1002 |
|
ri3 = ri2 * riji; |
| 1003 |
< |
pref = skdat.electroMult * pre12_ * q_i * mu_j; |
| 1004 |
< |
vterm = - pref * ct_j * ( ri2 - preRF2_ * skdat.rij ); |
| 1005 |
< |
myPot += skdat.sw * vterm; |
| 1006 |
< |
dVdr += -skdat.sw * pref * ( ri3 * ( uz_j - 3.0 * ct_j * rhat) - preRF2_ * uz_j); |
| 1007 |
< |
duduz_j += -skdat.sw * pref * rhat * (ri2 - preRF2_ * skdat.rij); |
| 1003 |
> |
pref = idat.electroMult * pre12_ * q_i * mu_j; |
| 1004 |
> |
vterm = - pref * ct_j * ( ri2 - preRF2_ * idat.rij ); |
| 1005 |
> |
myPot += idat.sw * vterm; |
| 1006 |
> |
dVdr += -idat.sw * pref * ( ri3 * ( uz_j - 3.0 * ct_j * rhat) - preRF2_ * uz_j); |
| 1007 |
> |
duduz_j += -idat.sw * pref * rhat * (ri2 - preRF2_ * idat.rij); |
| 1008 |
|
} |
| 1009 |
|
} |
| 1010 |
|
if (i_is_Dipole) { |
| 1011 |
|
if (j_is_Charge) { |
| 1012 |
|
ri2 = riji * riji; |
| 1013 |
|
ri3 = ri2 * riji; |
| 1014 |
< |
pref = skdat.electroMult * pre12_ * q_j * mu_i; |
| 1015 |
< |
vterm = - pref * ct_i * ( ri2 - preRF2_ * skdat.rij ); |
| 1016 |
< |
myPot += skdat.sw * vterm; |
| 1017 |
< |
dVdr += skdat.sw * pref * ( ri3 * ( uz_i - 3.0 * ct_i * rhat) - preRF2_ * uz_i); |
| 1018 |
< |
duduz_i += skdat.sw * pref * rhat * (ri2 - preRF2_ * skdat.rij); |
| 1014 |
> |
pref = idat.electroMult * pre12_ * q_j * mu_i; |
| 1015 |
> |
vterm = - pref * ct_i * ( ri2 - preRF2_ * idat.rij ); |
| 1016 |
> |
myPot += idat.sw * vterm; |
| 1017 |
> |
dVdr += idat.sw * pref * ( ri3 * ( uz_i - 3.0 * ct_i * rhat) - preRF2_ * uz_i); |
| 1018 |
> |
duduz_i += idat.sw * pref * rhat * (ri2 - preRF2_ * idat.rij); |
| 1019 |
|
} |
| 1020 |
|
} |
| 1021 |
|
|
| 1022 |
|
// accumulate the forces and torques resulting from the self term |
| 1023 |
< |
skdat.pot[2] += myPot; |
| 1024 |
< |
skdat.f1 += dVdr; |
| 1023 |
> |
idat.pot[2] += myPot; |
| 1024 |
> |
idat.f1 += dVdr; |
| 1025 |
|
|
| 1026 |
|
if (i_is_Dipole) |
| 1027 |
< |
skdat.t1 -= cross(uz_i, duduz_i); |
| 1027 |
> |
idat.t1 -= cross(uz_i, duduz_i); |
| 1028 |
|
if (j_is_Dipole) |
| 1029 |
< |
skdat.t2 -= cross(uz_j, duduz_j); |
| 1029 |
> |
idat.t2 -= cross(uz_j, duduz_j); |
| 1030 |
|
} |
| 1031 |
|
} |
| 1032 |
|
|
| 1033 |
< |
void Electrostatic::calcSelfCorrection(SelfCorrectionData &scdat) { |
| 1033 |
> |
void Electrostatic::calcSelfCorrection(SelfData &sdat) { |
| 1034 |
|
RealType mu1, preVal, chg1, self; |
| 1035 |
|
|
| 1036 |
|
if (!initialized_) initialize(); |
| 1037 |
|
|
| 1038 |
< |
ElectrostaticAtomData data = ElectrostaticMap[scdat.atype]; |
| 1038 |
> |
ElectrostaticAtomData data = ElectrostaticMap[sdat.atype]; |
| 1039 |
|
|
| 1040 |
|
// logicals |
| 1041 |
|
|
| 1046 |
|
if (i_is_Dipole) { |
| 1047 |
|
mu1 = data.dipole_moment; |
| 1048 |
|
preVal = pre22_ * preRF2_ * mu1 * mu1; |
| 1049 |
< |
scdat.pot[2] -= 0.5 * preVal; |
| 1049 |
> |
sdat.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); |
| 1052 |
> |
Vector3d uz_i = sdat.eFrame.getColumn(2); |
| 1053 |
|
Vector3d ei = preVal * uz_i; |
| 1054 |
|
|
| 1055 |
|
// This looks very wrong. A vector crossed with itself is zero. |
| 1056 |
< |
scdat.t -= cross(uz_i, ei); |
| 1056 |
> |
sdat.t -= cross(uz_i, ei); |
| 1057 |
|
} |
| 1058 |
|
} else if (summationMethod_ == esm_SHIFTED_FORCE || summationMethod_ == esm_SHIFTED_POTENTIAL) { |
| 1059 |
|
if (i_is_Charge) { |
| 1060 |
|
chg1 = data.charge; |
| 1061 |
|
if (screeningMethod_ == DAMPED) { |
| 1062 |
< |
self = - 0.5 * (c1c_ + alphaPi_) * chg1 * (chg1 + scdat.skippedCharge) * pre11_; |
| 1062 |
> |
self = - 0.5 * (c1c_ + alphaPi_) * chg1 * (chg1 + sdat.skippedCharge) * pre11_; |
| 1063 |
|
} else { |
| 1064 |
< |
self = - 0.5 * rcuti_ * chg1 * (chg1 + scdat.skippedCharge) * pre11_; |
| 1064 |
> |
self = - 0.5 * rcuti_ * chg1 * (chg1 + sdat.skippedCharge) * pre11_; |
| 1065 |
|
} |
| 1066 |
< |
scdat.pot[2] += self; |
| 1066 |
> |
sdat.pot[2] += self; |
| 1067 |
|
} |
| 1068 |
|
} |
| 1069 |
|
} |
| 1070 |
|
|
| 1071 |
< |
RealType Electrostatic::getSuggestedCutoffRadius(AtomType* at1, AtomType* at2) { |
| 1071 |
> |
RealType Electrostatic::getSuggestedCutoffRadius(pair<AtomType*, AtomType*> atypes) { |
| 1072 |
|
// This seems to work moderately well as a default. There's no |
| 1073 |
|
// inherent scale for 1/r interactions that we can standardize. |
| 1074 |
|
// 12 angstroms seems to be a reasonably good guess for most |