avoid using unitialized values in corner cases for Pair::compute_outer()
This commit is contained in:
@ -556,6 +556,7 @@ void PairLJCutCoulLongCS::compute_outer(int eflag, int vflag)
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else if (rsq <= cut_in_on_sq)
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
@ -126,9 +126,9 @@ void PairBornCoulMSM::compute(int eflag, int vflag)
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
|
||||
@ -123,9 +123,9 @@ void PairBuckCoulMSM::compute(int eflag, int vflag)
|
||||
|
||||
if (rsq < cutsq[itype][jtype]) {
|
||||
r2inv = 1.0/rsq;
|
||||
r = sqrt(rsq);
|
||||
|
||||
if (rsq < cut_coulsq) {
|
||||
r = sqrt(rsq);
|
||||
prefactor = qqrd2e * qtmp*q[j]/r;
|
||||
egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul);
|
||||
fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul);
|
||||
|
||||
@ -597,6 +597,7 @@ void PairLJCharmmCoulLong::compute_outer(int eflag, int vflag)
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else if (rsq <= cut_in_on_sq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
|
||||
@ -437,6 +437,7 @@ void PairLJCharmmCoulMSM::compute_outer(int eflag, int vflag)
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else if (rsq <= cut_in_on_sq) {
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
if (rsq > cut_lj_innersq) {
|
||||
switch1 = (cut_ljsq-rsq) * (cut_ljsq-rsq) *
|
||||
|
||||
@ -551,6 +551,7 @@ void PairLJCutCoulLong::compute_outer(int eflag, int vflag)
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else if (rsq <= cut_in_on_sq)
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
@ -404,6 +404,7 @@ void PairLJCutCoulMSM::compute_outer(int eflag, int vflag)
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
} else if (rsq <= cut_in_on_sq)
|
||||
r6inv = r2inv*r2inv*r2inv;
|
||||
forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]);
|
||||
|
||||
fpair = (forcecoul + factor_lj*forcelj) * r2inv;
|
||||
|
||||
@ -565,6 +565,8 @@ void PairLJCharmmCoulLongSoft::compute_outer(int eflag, int vflag)
|
||||
forcelj = forcelj*switch1 + philj*switch2;
|
||||
}
|
||||
} else if (rsq <= cut_in_on_sq) {
|
||||
r4sig6 = rsq*rsq / lj2[itype][jtype];
|
||||
denlj = lj3[itype][jtype] + rsq*r4sig6;
|
||||
forcelj = lj1[itype][jtype] * epsilon[itype][jtype] *
|
||||
(48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj));
|
||||
if (rsq > cut_lj_innersq) {
|
||||
|
||||
@ -516,6 +516,8 @@ void PairLJCutCoulLongSoft::compute_outer(int eflag, int vflag)
|
||||
forcelj = lj1[itype][jtype] * epsilon[itype][jtype] *
|
||||
(48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj));
|
||||
} else if (rsq < cut_in_on_sq) {
|
||||
r4sig6 = rsq*rsq / lj2[itype][jtype];
|
||||
denlj = lj3[itype][jtype] + rsq*r4sig6;
|
||||
forcelj = lj1[itype][jtype] * epsilon[itype][jtype] *
|
||||
(48.0*r4sig6/(denlj*denlj*denlj) - 24.0*r4sig6/(denlj*denlj));
|
||||
}
|
||||
|
||||
@ -393,6 +393,7 @@ void PairLJCutSoft::compute_outer(int eflag, int vflag)
|
||||
}
|
||||
|
||||
if (eflag) {
|
||||
denlj = lj3[itype][jtype] + rsq*r4sig6;
|
||||
evdwl = lj1[itype][jtype] * 4.0 * epsilon[itype][jtype] *
|
||||
(1.0/(denlj*denlj) - 1.0/denlj) - offset[itype][jtype];
|
||||
evdwl *= factor_lj;
|
||||
|
||||
Reference in New Issue
Block a user