fix bug in single function of buck/long/coul/long

This commit is contained in:
Axel Kohlmeyer
2020-08-06 16:26:26 -04:00
parent ad71475e91
commit fefed73cb9

View File

@ -995,8 +995,7 @@ double PairBuckLongCoulLong::single(int i, int j, int itype, int jtype,
f = s*(1.0-factor_coul)/r; s *= g_ewald*exp(-x*x); f = s*(1.0-factor_coul)/r; s *= g_ewald*exp(-x*x);
force_coul = (t *= ((((t*A5+A4)*t+A3)*t+A2)*t+A1)*s/x)+EWALD_F*s-f; force_coul = (t *= ((((t*A5+A4)*t+A3)*t+A2)*t+A1)*s/x)+EWALD_F*s-f;
eng += t-f; eng += t-f;
} } else { // table real space
else { // table real space
union_int_float_t t; union_int_float_t t;
t.f = rsq; t.f = rsq;
const int k = (t.i & ncoulmask) >> ncoulshiftbits; const int k = (t.i & ncoulmask) >> ncoulshiftbits;
@ -1014,11 +1013,10 @@ double PairBuckLongCoulLong::single(int i, int j, int itype, int jtype,
double x2 = g2*rsq, a2 = 1.0/x2, t = r6inv*(1.0-factor_buck); double x2 = g2*rsq, a2 = 1.0/x2, t = r6inv*(1.0-factor_buck);
x2 = a2*exp(-x2)*buck_c[itype][jtype]; x2 = a2*exp(-x2)*buck_c[itype][jtype];
force_buck = buck1[itype][jtype]*r*expr- force_buck = buck1[itype][jtype]*r*expr-
g8*(((6.0*a2+6.0)*a2+3.0)*a2+a2)*x2*rsq+t*buck2[itype][jtype]; g8*(((6.0*a2+6.0)*a2+3.0)*a2+1.0)*x2*rsq+t*buck2[itype][jtype];
eng += buck_a[itype][jtype]*expr- eng += buck_a[itype][jtype]*expr-
g6*((a2+1.0)*a2+0.5)*x2+t*buck_c[itype][jtype]; g6*((a2+1.0)*a2+0.5)*x2+t*buck_c[itype][jtype];
} } else { // cut
else { // cut
force_buck = force_buck =
buck1[itype][jtype]*r*expr-factor_buck*buck_c[itype][jtype]*r6inv; buck1[itype][jtype]*r*expr-factor_buck*buck_c[itype][jtype]*r6inv;
eng += buck_a[itype][jtype]*expr- eng += buck_a[itype][jtype]*expr-