From fbd600592b802cdcb3a45e0bbf3126ae5c1c702c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=BCtter?= Date: Wed, 13 Mar 2019 17:53:22 +0100 Subject: [PATCH] use ev_init for dihedrals --- src/CLASS2/dihedral_class2.cpp | 3 +-- src/KOKKOS/dihedral_charmm_kokkos.cpp | 3 +-- src/KOKKOS/dihedral_class2_kokkos.cpp | 3 +-- src/KOKKOS/dihedral_opls_kokkos.cpp | 3 +-- src/MOLECULE/dihedral_charmm.cpp | 3 +-- src/MOLECULE/dihedral_charmmfsw.cpp | 3 +-- src/MOLECULE/dihedral_harmonic.cpp | 3 +-- src/MOLECULE/dihedral_helix.cpp | 3 +-- src/MOLECULE/dihedral_multi_harmonic.cpp | 3 +-- src/MOLECULE/dihedral_opls.cpp | 3 +-- src/USER-INTEL/dihedral_charmm_intel.cpp | 4 +--- src/USER-INTEL/dihedral_fourier_intel.cpp | 4 +--- src/USER-INTEL/dihedral_harmonic_intel.cpp | 4 +--- src/USER-INTEL/dihedral_opls_intel.cpp | 4 +--- src/USER-MISC/dihedral_cosine_shift_exp.cpp | 3 +-- src/USER-MISC/dihedral_fourier.cpp | 3 +-- src/USER-MISC/dihedral_nharmonic.cpp | 3 +-- src/USER-MISC/dihedral_quadratic.cpp | 3 +-- src/USER-MISC/dihedral_spherical.cpp | 3 +-- src/USER-MISC/dihedral_table.cpp | 3 +-- src/USER-MISC/dihedral_table_cut.cpp | 3 +-- src/USER-OMP/dihedral_charmm_omp.cpp | 5 +---- src/USER-OMP/dihedral_class2_omp.cpp | 5 +---- src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp | 5 +---- src/USER-OMP/dihedral_fourier_omp.cpp | 5 +---- src/USER-OMP/dihedral_harmonic_omp.cpp | 5 +---- src/USER-OMP/dihedral_helix_omp.cpp | 5 +---- src/USER-OMP/dihedral_multi_harmonic_omp.cpp | 5 +---- src/USER-OMP/dihedral_nharmonic_omp.cpp | 5 +---- src/USER-OMP/dihedral_opls_omp.cpp | 5 +---- src/USER-OMP/dihedral_quadratic_omp.cpp | 5 +---- src/USER-OMP/dihedral_table_omp.cpp | 5 +---- src/dihedral.h | 4 ++++ src/dihedral_hybrid.cpp | 3 +-- src/dihedral_zero.cpp | 3 +-- 35 files changed, 38 insertions(+), 94 deletions(-) diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index c6360dd846..c471b1f353 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -118,8 +118,7 @@ void DihedralClass2::compute(int eflag, int vflag) double fabcd[4][3]; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/KOKKOS/dihedral_charmm_kokkos.cpp b/src/KOKKOS/dihedral_charmm_kokkos.cpp index 3931309dc1..61ddcc425a 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmm_kokkos.cpp @@ -69,8 +69,7 @@ void DihedralCharmmKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/KOKKOS/dihedral_class2_kokkos.cpp b/src/KOKKOS/dihedral_class2_kokkos.cpp index c7db07a6cb..98436bc696 100644 --- a/src/KOKKOS/dihedral_class2_kokkos.cpp +++ b/src/KOKKOS/dihedral_class2_kokkos.cpp @@ -69,8 +69,7 @@ void DihedralClass2Kokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/KOKKOS/dihedral_opls_kokkos.cpp b/src/KOKKOS/dihedral_opls_kokkos.cpp index 9d01cf1a54..f50dea2c36 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.cpp +++ b/src/KOKKOS/dihedral_opls_kokkos.cpp @@ -69,8 +69,7 @@ void DihedralOPLSKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (eflag || vflag) ev_setup(eflag,vflag,0); - else evflag = 0; + ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 2372fae38b..68c62eb4fd 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -76,8 +76,7 @@ void DihedralCharmm::compute(int eflag, int vflag) double forcecoul,forcelj,fpair,ecoul,evdwl; edihedral = evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 99a5333620..f65d01e9ed 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -79,8 +79,7 @@ void DihedralCharmmfsw::compute(int eflag, int vflag) double forcecoul,forcelj,fpair,ecoul,evdwl; edihedral = evdwl = ecoul = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index cb122f4bc2..ddb94dc571 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -67,8 +67,7 @@ void DihedralHarmonic::compute(int eflag, int vflag) double c,s,p,sx2,sy2,sz2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index ae23b77951..6b6d19ecdf 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -67,8 +67,7 @@ void DihedralHelix::compute(int eflag, int vflag) double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index f6461abb6e..f0097342a8 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -64,8 +64,7 @@ void DihedralMultiHarmonic::compute(int eflag, int vflag) double s2,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index b5103413b2..293245e411 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -67,8 +67,7 @@ void DihedralOPLS::compute(int eflag, int vflag) double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-INTEL/dihedral_charmm_intel.cpp b/src/USER-INTEL/dihedral_charmm_intel.cpp index c9237e7309..4f4b091300 100644 --- a/src/USER-INTEL/dihedral_charmm_intel.cpp +++ b/src/USER-INTEL/dihedral_charmm_intel.cpp @@ -84,9 +84,7 @@ void DihedralCharmmIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/USER-INTEL/dihedral_fourier_intel.cpp b/src/USER-INTEL/dihedral_fourier_intel.cpp index 6ccc165c61..030d371e44 100644 --- a/src/USER-INTEL/dihedral_fourier_intel.cpp +++ b/src/USER-INTEL/dihedral_fourier_intel.cpp @@ -73,9 +73,7 @@ void DihedralFourierIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/dihedral_harmonic_intel.cpp b/src/USER-INTEL/dihedral_harmonic_intel.cpp index ae5eb914e7..d84db4f4ac 100644 --- a/src/USER-INTEL/dihedral_harmonic_intel.cpp +++ b/src/USER-INTEL/dihedral_harmonic_intel.cpp @@ -73,9 +73,7 @@ void DihedralHarmonicIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-INTEL/dihedral_opls_intel.cpp b/src/USER-INTEL/dihedral_opls_intel.cpp index 7a60b62cae..eae796974b 100644 --- a/src/USER-INTEL/dihedral_opls_intel.cpp +++ b/src/USER-INTEL/dihedral_opls_intel.cpp @@ -77,9 +77,7 @@ void DihedralOPLSIntel::compute(int eflag, int vflag, IntelBuffers *buffers, const ForceConst &fc) { - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); if (evflag) { if (vflag && !eflag) { diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 82da173f8e..c1396aba11 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -68,8 +68,7 @@ void DihedralCosineShiftExp::compute(int eflag, int vflag) double cccpsss,cssmscc,exp2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index 7c405ee28c..af86259c01 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -79,8 +79,7 @@ void DihedralFourier::compute(int eflag, int vflag) double dtfx,dtfy,dtfz,dtgx,dtgy,dtgz,dthx,dthy,dthz; double c,s,p_,sx2,sy2,sz2; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index f8e8850680..189555946b 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -66,8 +66,7 @@ void DihedralNHarmonic::compute(int eflag, int vflag) double s2,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index 1b64b52faf..4c65f2fd70 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -65,8 +65,7 @@ void DihedralQuadratic::compute(int eflag, int vflag) double s2,cx,cy,cz,cmag,dx,phi,si,siinv,sin2; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 77fa885b7a..97cdf13801 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -213,8 +213,7 @@ void DihedralSpherical::compute(int eflag, int vflag) // perp34on23[d] = v34[d] - proj34on23[d] edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); for (n = 0; n < ndihedrallist; n++) { diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index e221a54a82..a97ae3649f 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -549,8 +549,7 @@ void DihedralTable::compute(int eflag, int vflag) edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); for (n = 0; n < ndihedrallist; n++) { diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index 6ebe094e50..a11ad94969 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -472,8 +472,7 @@ void DihedralTableCut::compute(int eflag, int vflag) double fabcd[4][3]; edihedral = 0.0; - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); double **x = atom->x; double **f = atom->f; diff --git a/src/USER-OMP/dihedral_charmm_omp.cpp b/src/USER-OMP/dihedral_charmm_omp.cpp index 1bed449774..b09863613e 100644 --- a/src/USER-OMP/dihedral_charmm_omp.cpp +++ b/src/USER-OMP/dihedral_charmm_omp.cpp @@ -45,10 +45,7 @@ DihedralCharmmOMP::DihedralCharmmOMP(class LAMMPS *lmp) void DihedralCharmmOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); // insure pair->ev_tally() will use 1-4 virial contribution diff --git a/src/USER-OMP/dihedral_class2_omp.cpp b/src/USER-OMP/dihedral_class2_omp.cpp index c7ae1572c7..03ac9d9bab 100644 --- a/src/USER-OMP/dihedral_class2_omp.cpp +++ b/src/USER-OMP/dihedral_class2_omp.cpp @@ -43,10 +43,7 @@ DihedralClass2OMP::DihedralClass2OMP(class LAMMPS *lmp) void DihedralClass2OMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp index c43b990028..c64cad9fc3 100644 --- a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp @@ -43,10 +43,7 @@ DihedralCosineShiftExpOMP::DihedralCosineShiftExpOMP(class LAMMPS *lmp) void DihedralCosineShiftExpOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_fourier_omp.cpp b/src/USER-OMP/dihedral_fourier_omp.cpp index 319acb0beb..94bdae3795 100644 --- a/src/USER-OMP/dihedral_fourier_omp.cpp +++ b/src/USER-OMP/dihedral_fourier_omp.cpp @@ -44,10 +44,7 @@ DihedralFourierOMP::DihedralFourierOMP(class LAMMPS *lmp) void DihedralFourierOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_harmonic_omp.cpp b/src/USER-OMP/dihedral_harmonic_omp.cpp index bb659cf262..10ccbd3d9f 100644 --- a/src/USER-OMP/dihedral_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_harmonic_omp.cpp @@ -43,10 +43,7 @@ DihedralHarmonicOMP::DihedralHarmonicOMP(class LAMMPS *lmp) void DihedralHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_helix_omp.cpp b/src/USER-OMP/dihedral_helix_omp.cpp index e40f084e54..8c8e29cac0 100644 --- a/src/USER-OMP/dihedral_helix_omp.cpp +++ b/src/USER-OMP/dihedral_helix_omp.cpp @@ -46,10 +46,7 @@ DihedralHelixOMP::DihedralHelixOMP(class LAMMPS *lmp) void DihedralHelixOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp index e10fc7b94a..38961e1746 100644 --- a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp @@ -43,10 +43,7 @@ DihedralMultiHarmonicOMP::DihedralMultiHarmonicOMP(class LAMMPS *lmp) void DihedralMultiHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index ad758fc892..e74238265d 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -43,10 +43,7 @@ DihedralNHarmonicOMP::DihedralNHarmonicOMP(class LAMMPS *lmp) void DihedralNHarmonicOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_opls_omp.cpp b/src/USER-OMP/dihedral_opls_omp.cpp index 53fddf51cb..64eaffe6fe 100644 --- a/src/USER-OMP/dihedral_opls_omp.cpp +++ b/src/USER-OMP/dihedral_opls_omp.cpp @@ -44,10 +44,7 @@ DihedralOPLSOMP::DihedralOPLSOMP(class LAMMPS *lmp) void DihedralOPLSOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_quadratic_omp.cpp b/src/USER-OMP/dihedral_quadratic_omp.cpp index f6110cd505..8df622b847 100644 --- a/src/USER-OMP/dihedral_quadratic_omp.cpp +++ b/src/USER-OMP/dihedral_quadratic_omp.cpp @@ -44,10 +44,7 @@ DihedralQuadraticOMP::DihedralQuadraticOMP(class LAMMPS *lmp) void DihedralQuadraticOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/USER-OMP/dihedral_table_omp.cpp b/src/USER-OMP/dihedral_table_omp.cpp index 1457f7b2bf..792ee90c26 100644 --- a/src/USER-OMP/dihedral_table_omp.cpp +++ b/src/USER-OMP/dihedral_table_omp.cpp @@ -111,10 +111,7 @@ DihedralTableOMP::DihedralTableOMP(class LAMMPS *lmp) void DihedralTableOMP::compute(int eflag, int vflag) { - - if (eflag || vflag) { - ev_setup(eflag,vflag); - } else evflag = 0; + ev_init(eflag,vflag); const int nall = atom->nlocal + atom->nghost; const int nthreads = comm->nthreads; diff --git a/src/dihedral.h b/src/dihedral.h index 627104871b..0769d79163 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -57,6 +57,10 @@ class Dihedral : protected Pointers { int maxeatom,maxvatom; void ev_setup(int, int, int alloc = 1); + void ev_init(int eflag, int vflag, int alloc = 1) { + if (eflag||vflag) ev_setup(eflag, vflag, alloc); + else evflag = eflag_either = eflag_global = eflag_atom = vflag_either = vflag_global = vflag_atom = 0; + } void ev_tally(int, int, int, int, int, int, double, double *, double *, double *, double, double, double, double, double, double, double, double, double); diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index b9107ac874..f3e4823d53 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -104,8 +104,7 @@ void DihedralHybrid::compute(int eflag, int vflag) // set neighbor->dihedrallist to sub-style dihedrallist before call // accumulate sub-style global/peratom energy/virial in hybrid - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + ev_init(eflag,vflag); for (m = 0; m < nstyles; m++) { neighbor->ndihedrallist = ndihedrallist[m]; diff --git a/src/dihedral_zero.cpp b/src/dihedral_zero.cpp index 46facdb6db..8145d5f32d 100644 --- a/src/dihedral_zero.cpp +++ b/src/dihedral_zero.cpp @@ -44,8 +44,7 @@ DihedralZero::~DihedralZero() void DihedralZero::compute(int eflag, int vflag) { - if (eflag || vflag) ev_setup(eflag,vflag); - else evflag = 0; + ev_init(eflag,vflag); } /* ---------------------------------------------------------------------- */