Removed forgotten neighbor->ago condition in compute_born_matrix. Rewritten compute_pair loop so that newton condition does not affect results.

This commit is contained in:
Germain Clavier
2022-04-22 16:59:52 +02:00
parent 0b6a689f3c
commit a6f2f04664

View File

@ -349,12 +349,11 @@ void ComputeBornMatrix::compute_vector()
// compute Born contribution // compute Born contribution
if (neighbor->ago > 0) { if (pairflag) compute_pairs();
if (pairflag) compute_pairs(); if (bondflag) compute_bonds();
if (bondflag) compute_bonds(); if (angleflag) compute_angles();
if (angleflag) compute_angles(); if (dihedflag) compute_dihedrals();
if (dihedflag) compute_dihedrals();
}
// sum Born contributions over all procs // sum Born contributions over all procs
@ -451,23 +450,21 @@ void ComputeBornMatrix::compute_pairs()
if (rsq >= cutsq[itype][jtype]) continue; if (rsq >= cutsq[itype][jtype]) continue;
if (newton_pair || j < nlocal) { // Add contribution to Born tensor
// Add contribution to Born tensor pair_pref = dupair = du2pair = 0.0;
pair->born_matrix(i, j, itype, jtype, rsq, factor_coul, factor_lj, dupair, du2pair);
pair_pref = 0.5*du2pair - dupair * rinv;
pair->born_matrix(i, j, itype, jtype, rsq, factor_coul, factor_lj, dupair, du2pair); // See albemunu in compute_born_matrix.h for indices order.
pair_pref = du2pair - dupair * rinv;
// See albemunu in compute_born_matrix.h for indices order. a = b = c = d = 0;
for (int m = 0; m < nvalues; m++) {
a = b = c = d = 0; a = albemunu[m][0];
for (int m = 0; m < nvalues; m++) { b = albemunu[m][1];
a = albemunu[m][0]; c = albemunu[m][2];
b = albemunu[m][1]; d = albemunu[m][3];
c = albemunu[m][2]; values_local[m] += pair_pref * rij[a] * rij[b] * rij[c] * rij[d] * r2inv;
d = albemunu[m][3];
values_local[m] += pair_pref * rij[a] * rij[b] * rij[c] * rij[d] * r2inv;
}
} }
} }
} }