diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 942f46aa22694f284bb31be49c7e7c72a0f741be..6c599276ca1b27c1fa2c168c53ed4aef45ae7cc2 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -819,7 +819,8 @@ void ImproperClass2::angleangle(int eflag, int vflag) if (evflag) ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper, fabcd[0],fabcd[2],fabcd[3], - delxAB,delyAB,delzAB,delxBC,delyBC,delzBC,delxBD,delyBD,delzBD); + delxAB,delyAB,delzAB,delxBC,delyBC,delzBC, + delxBD-delxBC,delyBD-delyBC,delzBD-delzBC); } } diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 30a62ffb1828343f484ae42c440b92196ca82f5c..a2f176e732d1e05482ba7e0d1754eb1174e0c139 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -231,9 +231,25 @@ void ImproperUmbrella::compute(int eflag, int vflag) f[i4][2] += f4[2]*a; } - if (evflag) + if (evflag) { + + // get correct 4-body geometry for virial tally + + vb1x = x[i1][0] - x[i2][0]; + vb1y = x[i1][1] - x[i2][1]; + vb1z = x[i1][2] - x[i2][2]; + + vb2x = x[i3][0] - x[i2][0]; + vb2y = x[i3][1] - x[i2][1]; + vb2z = x[i3][2] - x[i2][2]; + + vb3x = x[i4][0] - x[i3][0]; + vb3y = x[i4][1] - x[i3][1]; + vb3z = x[i4][2] - x[i3][2]; + ev_tally(i1,i2,i3,i4,nlocal,newton_bond,eimproper,f1,f3,f4, vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z); + } } } diff --git a/src/USER-OMP/improper_class2_omp.cpp b/src/USER-OMP/improper_class2_omp.cpp index 5e32795371429647bd7bd53327a11041f672fad0..3beeb41a2626d5f9b52d52a348d69cda07111c90 100644 --- a/src/USER-OMP/improper_class2_omp.cpp +++ b/src/USER-OMP/improper_class2_omp.cpp @@ -696,7 +696,8 @@ void ImproperClass2OMP::angleangle_thr(int nfrom, int nto, ThrData * const thr) if (EVFLAG) ev_tally_thr(this,i1,i2,i3,i4,nlocal,NEWTON_BOND,eimproper, - fabcd[0],fabcd[2],fabcd[3],delxAB,delyAB,delzAB, - delxBC,delyBC,delzBC,delxBD,delyBD,delzBD,thr); + fabcd[0],fabcd[2],fabcd[3], + delxAB,delyAB,delzAB,delxBC,delyBC,delzBC, + delxBD-delxBC,delyBD-delyBC,delzBD-delzBC,thr); } } diff --git a/src/USER-OMP/improper_umbrella_omp.cpp b/src/USER-OMP/improper_umbrella_omp.cpp index 9d28e25053120c4a37235c9ac7914647eb8ac8d4..9ea94c57050e3ba15555df231aaf94095228f8e9 100644 --- a/src/USER-OMP/improper_umbrella_omp.cpp +++ b/src/USER-OMP/improper_umbrella_omp.cpp @@ -254,8 +254,24 @@ void ImproperUmbrellaOMP::eval(int nfrom, int nto, ThrData * const thr) f[i4].z += f4[2]*a; } - if (EVFLAG) + if (EVFLAG) { + + // get correct 4-body geometry for virial tally + + vb1x = x[i1].x - x[i2].x; + vb1y = x[i1].y - x[i2].y; + vb1z = x[i1].z - x[i2].z; + + vb2x = x[i3].x - x[i2].x; + vb2y = x[i3].y - x[i2].y; + vb2z = x[i3].z - x[i2].z; + + vb3x = x[i4].x - x[i3].x; + vb3y = x[i4].y - x[i3].y; + vb3z = x[i4].z - x[i3].z; + ev_tally_thr(this,i1,i2,i3,i4,nlocal,NEWTON_BOND,eimproper,f1,f3,f4, vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,thr); + } } }