From 5691ec3dfdfeab73930f5efc0a81ac0124c44d75 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Wed, 18 Nov 2020 15:05:11 -0700 Subject: [PATCH] insure cvflag is zero, other tweaks --- src/MOLECULE/fix_cmap.cpp | 3 +-- src/POEMS/fix_poems.cpp | 1 + src/USER-MISC/pair_agni.cpp | 1 + src/angle.cpp | 3 ++- src/bond.cpp | 2 +- src/compute_centroid_stress_atom.cpp | 13 +++++++------ src/dihedral.cpp | 3 ++- src/force.h | 6 +++--- src/improper.cpp | 3 ++- src/kspace.cpp | 5 +++-- src/pair.cpp | 3 ++- src/pair_hybrid.cpp | 2 +- 12 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index ab5c0a7323..f48d5254cf 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -42,8 +42,6 @@ #include "memory.h" #include "error.h" - - using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; @@ -74,6 +72,7 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; peatom_flag = 1; virial_flag = 1; + centroidstressflag = CENTROID_NOTAVAIL; thermo_virial = 1; peratom_freq = 1; scalar_flag = 1; diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index fb39c21f2a..a220216fdd 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -74,6 +74,7 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : time_integrate = 1; rigid_flag = 1; virial_flag = 1; + centroidstressflag = CENTROID_NOTAVAIL; thermo_virial = 1; dof_flag = 1; diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index c9f6aff689..afb457d9e4 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "citeme.h" #include "comm.h" +#include "force.h" #include "error.h" #include "math_const.h" #include "math_special.h" diff --git a/src/angle.cpp b/src/angle.cpp index 25eab2b752..110719d432 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -77,7 +77,7 @@ void Angle::init() /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag - set the following flags, values are otherwise 0: + set the following flags, values are otherwise set to 0: evflag != 0 if any bits of eflag or vflag are set eflag_global != 0 if ENERGY_GLOBAL bit of eflag set eflag_atom != 0 if ENERGY_ATOM bit of eflag set @@ -105,6 +105,7 @@ void Angle::ev_setup(int eflag, int vflag, int alloc) vflag_atom = vflag & VIRIAL_ATOM; if (vflag & VIRIAL_CENTROID && centroidstressflag != CENTROID_AVAIL) vflag_atom = 1; + cvflag_atom = 0; if (vflag & VIRIAL_CENTROID && centroidstressflag == CENTROID_AVAIL) cvflag_atom = 1; vflag_either = vflag_global || vflag_atom || cvflag_atom; diff --git a/src/bond.cpp b/src/bond.cpp index 89265915fb..16d3c43dea 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -81,7 +81,7 @@ void Bond::init() /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag - set the following flags, values are otherwise 0: + set the following flags, values are otherwise set to 0: evflag != 0 if any bits of eflag or vflag are set eflag_global != 0 if ENERGY_GLOBAL bit of eflag set eflag_atom != 0 if ENERGY_ATOM bit of eflag set diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 15be95bee1..3de2c3dada 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -222,6 +222,7 @@ void ComputeCentroidStressAtom::compute_peratom() // per-atom virial and per-atom centroid virial are the same for bonds // bond styles are all CENTROID_SAME // all other styles are CENTROID_AVAIL or CENTROID_NOTAVAIL + // add KSpace when it becomes supported if (bondflag && force->bond) { double **vatom = force->bond->vatom; @@ -254,12 +255,12 @@ void ComputeCentroidStressAtom::compute_peratom() stress[i][j] += cvatom[i][j]; } - if (kspaceflag && force->kspace && force->kspace->compute_flag) { - double **vatom = force->kspace->vatom; - for (i = 0; i < nkspace; i++) - for (j = 0; j < 9; j++) - stress[i][j] += cvatom[i][j]; - } + //if (kspaceflag && force->kspace && force->kspace->compute_flag) { + // double **vatom = force->kspace->vatom; + // for (i = 0; i < nkspace; i++) + // for (j = 0; j < 9; j++) + // stress[i][j] += cvatom[i][j]; + // } // add in per-atom contributions from relevant fixes // skip if vatom = nullptr diff --git a/src/dihedral.cpp b/src/dihedral.cpp index 68c69fa787..4680b6f67d 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -76,7 +76,7 @@ void Dihedral::init() /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag - set the following flags, values are otherwise 0: + set the following flags, values are otherwise set to 0: evflag != 0 if any bits of eflag or vflag are set eflag_global != 0 if ENERGY_GLOBAL bit of eflag set eflag_atom != 0 if ENERGY_ATOM bit of eflag set @@ -104,6 +104,7 @@ void Dihedral::ev_setup(int eflag, int vflag, int alloc) vflag_atom = vflag & VIRIAL_ATOM; if (vflag & VIRIAL_CENTROID && centroidstressflag != CENTROID_AVAIL) vflag_atom = 1; + cvflag_atom = 0; if (vflag & VIRIAL_CENTROID && centroidstressflag == CENTROID_AVAIL) cvflag_atom = 1; vflag_either = vflag_global || vflag_atom || cvflag_atom; diff --git a/src/force.h b/src/force.h index 9be26bd2a7..b087b8e187 100644 --- a/src/force.h +++ b/src/force.h @@ -41,9 +41,9 @@ enum { }; enum { - CENTROID_SAME = 0x01, - CENTROID_AVAIL = 0x02, - CENTROID_NOTAVAIL = 0x04 + CENTROID_SAME = 0, + CENTROID_AVAIL = 1, + CENTROID_NOTAVAIL = 2 }; class Force : protected Pointers { diff --git a/src/improper.cpp b/src/improper.cpp index c4b691f6d5..6e0f829733 100644 --- a/src/improper.cpp +++ b/src/improper.cpp @@ -74,7 +74,7 @@ void Improper::init() /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag - set the following flags, values are otherwise 0: + set the following flags, values are otherwise set to 0: evflag != 0 if any bits of eflag or vflag are set eflag_global != 0 if ENERGY_GLOBAL bit of eflag set eflag_atom != 0 if ENERGY_ATOM bit of eflag set @@ -102,6 +102,7 @@ void Improper::ev_setup(int eflag, int vflag, int alloc) vflag_atom = vflag & VIRIAL_ATOM; if (vflag & VIRIAL_CENTROID && centroidstressflag != CENTROID_AVAIL) vflag_atom = 1; + cvflag_atom = 0; if (vflag & VIRIAL_CENTROID && centroidstressflag == CENTROID_AVAIL) cvflag_atom = 1; vflag_either = vflag_global || vflag_atom || cvflag_atom; diff --git a/src/kspace.cpp b/src/kspace.cpp index a6dd5fdffb..594fd1ba8d 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -88,7 +88,7 @@ KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp) maxeatom = maxvatom = 0; eatom = nullptr; vatom = nullptr; - centroidstressatom = NOTAVAIL; + centroidstressflag = CENTROID_NOTAVAIL; execution_space = Host; datamask_read = ALL_MASK; @@ -216,7 +216,7 @@ void KSpace::pair_check() /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag - set the following flags, values are otherwise 0: + set the following flags, values are otherwise set to 0: evflag != 0 if any bits of eflag or vflag are set eflag_global != 0 if ENERGY_GLOBAL bit of eflag set eflag_atom != 0 if ENERGY_ATOM bit of eflag set @@ -225,6 +225,7 @@ void KSpace::pair_check() vflag_atom != 0 if VIRIAL_ATOM bit of vflag set no current support for centroid stress vflag_either != 0 if vflag_global or vflag_atom is set + evflag_atom != 0 if eflag_atom or vflag_atom is set ------------------------------------------------------------------------- */ void KSpace::ev_setup(int eflag, int vflag, int alloc) diff --git a/src/pair.cpp b/src/pair.cpp index ec7bd8d94f..74a03fbed9 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -778,7 +778,7 @@ void Pair::del_tally_callback(Compute *ptr) /* ---------------------------------------------------------------------- setup for energy, virial computation see integrate::ev_set() for bitwise settings of eflag/vflag - set the following flags, values are otherwise 0: + set the following flags, values are otherwise set to 0: eflag_global != 0 if ENERGY_GLOBAL bit of eflag set eflag_atom != 0 if ENERGY_ATOM bit of eflag set eflag_either != 0 if eflag_global or eflag_atom is set @@ -811,6 +811,7 @@ void Pair::ev_setup(int eflag, int vflag, int alloc) if (vflag & VIRIAL_FDOTR && no_virial_fdotr_compute == 0) vflag_fdotr = 1; vflag_atom = vflag & VIRIAL_ATOM; if (vflag & VIRIAL_CENTROID && centroidstressflag != CENTROID_AVAIL) vflag_atom = 1; + cvflag_atom = 0; if (vflag & VIRIAL_CENTROID && centroidstressflag == CENTROID_AVAIL) cvflag_atom = 1; vflag_either = vflag_global || vflag_atom || cvflag_atom; diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 64c7e599b5..41c90942b7 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -417,7 +417,7 @@ void PairHybrid::flags() for (m = 0; m < nstyles; m++) { if (styles[m]->centroidstressflag == CENTROID_NOTAVAIL) centroidstressflag == CENTROID_NOTAVAIL; - if (centroidstyle == CENTROID_SAME && + if (centroidstressflag == CENTROID_SAME && styles[m]->centroidstressflag == CENTROID_AVAIL) centroidstressflag == CENTROID_AVAIL; }