standardize flags for energy/virial computations in forces
This commit is contained in:
@ -75,7 +75,16 @@ void Angle::init()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup for energy, virial computation
|
setup for energy, virial computation
|
||||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
see integrate::ev_set() for bitwise settings of eflag/vflag
|
||||||
|
set the following flags, values are otherwise 0:
|
||||||
|
evflag = 1 if any bits of eflag or vflag are set
|
||||||
|
eflag_global = 1 if ENERGY_GLOBAL bit of eflag set
|
||||||
|
eflag_atom = 1 if ENERGY_ATOM bit of eflag set
|
||||||
|
eflag_either = 1 if eflag_global or eflag_atom is set
|
||||||
|
vflag_global = 1 if VIRIAL_PAIR or VIRIAL_FDOTR bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_PERATOM bit of vflag set
|
||||||
|
cvflag_atom = 1 if VIRIAL_CENTROID bit of vflag set
|
||||||
|
vflag_either = 1 if any of vflag_global, vflag_atom, cvflag_atom is set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Angle::ev_setup(int eflag, int vflag, int alloc)
|
void Angle::ev_setup(int eflag, int vflag, int alloc)
|
||||||
|
|||||||
10
src/bond.cpp
10
src/bond.cpp
@ -80,7 +80,15 @@ void Bond::init()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup for energy, virial computation
|
setup for energy, virial computation
|
||||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
see integrate::ev_set() for bitwise settings of eflag/vflag
|
||||||
|
set the following flags, values are otherwise 0:
|
||||||
|
evflag = 1 if any bits of eflag or vflag are set
|
||||||
|
eflag_global = 1 if ENERGY_GLOBAL bit of eflag set
|
||||||
|
eflag_atom = 1 if ENERGY_ATOM bit of eflag set
|
||||||
|
eflag_either = 1 if eflag_global or eflag_atom is set
|
||||||
|
vflag_global = 1 if VIRIAL_PAIR or VIRIAL_FDOTR bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_PERATOM or VIRIAL_CENTROID bit of vflag set
|
||||||
|
vflag_either = 1 if vflag_global or vflag_atom is set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Bond::ev_setup(int eflag, int vflag, int alloc)
|
void Bond::ev_setup(int eflag, int vflag, int alloc)
|
||||||
|
|||||||
@ -126,7 +126,7 @@ void ComputeCentroidStressAtom::init()
|
|||||||
|
|
||||||
// check if pair styles support centroid atom stress
|
// check if pair styles support centroid atom stress
|
||||||
if (pairflag && force->pair)
|
if (pairflag && force->pair)
|
||||||
if (force->pair->centroidstressflag & 4)
|
if (force->pair->centroidstressflag == CENTROID_NOTAVAIL)
|
||||||
error->all(FLERR, "Pair style does not support compute centroid/stress/atom");
|
error->all(FLERR, "Pair style does not support compute centroid/stress/atom");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void ComputeCentroidStressAtom::compute_peratom()
|
|||||||
// per-atom virial and per-atom centroid virial are the same for two-body
|
// per-atom virial and per-atom centroid virial are the same for two-body
|
||||||
// many-body pair styles not yet implemented
|
// many-body pair styles not yet implemented
|
||||||
if (pairflag && force->pair && force->pair->compute_flag) {
|
if (pairflag && force->pair && force->pair->compute_flag) {
|
||||||
if (force->pair->centroidstressflag & 2) {
|
if (force->pair->centroidstressflag == CENTROID_AVAIL) {
|
||||||
double **cvatom = force->pair->cvatom;
|
double **cvatom = force->pair->cvatom;
|
||||||
for (i = 0; i < npair; i++)
|
for (i = 0; i < npair; i++)
|
||||||
for (j = 0; j < 9; j++)
|
for (j = 0; j < 9; j++)
|
||||||
|
|||||||
@ -74,7 +74,16 @@ void Dihedral::init()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup for energy, virial computation
|
setup for energy, virial computation
|
||||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
see integrate::ev_set() for bitwise settings of eflag/vflag
|
||||||
|
set the following flags, values are otherwise 0:
|
||||||
|
evflag = 1 if any bits of eflag or vflag are set
|
||||||
|
eflag_global = 1 if ENERGY_GLOBAL bit of eflag set
|
||||||
|
eflag_atom = 1 if ENERGY_ATOM bit of eflag set
|
||||||
|
eflag_either = 1 if eflag_global or eflag_atom is set
|
||||||
|
vflag_global = 1 if VIRIAL_PAIR or VIRIAL_FDOTR bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_PERATOM bit of vflag set
|
||||||
|
cvflag_atom = 1 if VIRIAL_CENTROID bit of vflag set
|
||||||
|
vflag_either = 1 if any of vflag_global, vflag_atom, cvflag_atom is set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Dihedral::ev_setup(int eflag, int vflag, int alloc)
|
void Dihedral::ev_setup(int eflag, int vflag, int alloc)
|
||||||
|
|||||||
@ -72,7 +72,16 @@ void Improper::init()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup for energy, virial computation
|
setup for energy, virial computation
|
||||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
see integrate::ev_set() for bitwise settings of eflag/vflag
|
||||||
|
set the following flags, values are otherwise 0:
|
||||||
|
evflag = 1 if any bits of eflag or vflag are set
|
||||||
|
eflag_global = 1 if ENERGY_GLOBAL bit of eflag set
|
||||||
|
eflag_atom = 1 if ENERGY_ATOM bit of eflag set
|
||||||
|
eflag_either = 1 if eflag_global or eflag_atom is set
|
||||||
|
vflag_global = 1 if VIRIAL_PAIR or VIRIAL_FDOTR bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_PERATOM bit of vflag set
|
||||||
|
cvflag_atom = 1 if VIRIAL_CENTROID bit of vflag set
|
||||||
|
vflag_either = 1 if any of vflag_global, vflag_atom, cvflag_atom is set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Improper::ev_setup(int eflag, int vflag, int alloc)
|
void Improper::ev_setup(int eflag, int vflag, int alloc)
|
||||||
|
|||||||
@ -111,21 +111,18 @@ void Integrate::ev_setup()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
set eflag,vflag for current iteration
|
set eflag,vflag for current iteration
|
||||||
|
based on computes that need energy/virial info on this timestep
|
||||||
invoke matchstep() on all timestep-dependent computes to clear their arrays
|
invoke matchstep() on all timestep-dependent computes to clear their arrays
|
||||||
eflag/vflag based on computes that need info on this ntimestep
|
eflag: set any or no bits
|
||||||
eflag = 0 = no energy computation
|
ENERGY_GLOBAL bit for global energy
|
||||||
eflag = 1 = global energy only
|
ENERGY_ATOM bit for per-atom energy
|
||||||
eflag = 2 = per-atom energy only
|
vflag: set any or no bits, but GLOBAL/FDOTR bit cannot both be set
|
||||||
eflag = 3 = both global and per-atom energy
|
VIRIAL_PAIR bit for global virial as sum of pairwise terms
|
||||||
vflag = 0 = no virial computation (pressure)
|
VIRIAL_FDOTR bit for global virial via F dot r
|
||||||
vflag = 1 = global virial with pair portion via sum of pairwise interactions
|
VIRIAL_ATOM bit for per-atom virial
|
||||||
vflag = 2 = global virial with pair portion via F dot r including ghosts
|
VIRIAL_CENTROID bit for per-atom centroid virial
|
||||||
vflag = 4 = per-atom virial only
|
all force components (pair,bond,angle,...,kspace) use eflag/vflag
|
||||||
vflag = 5 or 6 = both global and per-atom virial
|
in their ev_setup() method to set local energy/virial flags
|
||||||
vflag = 8 = per-atom centroid virial only
|
|
||||||
vflag = 9 or 10 = both global and per-atom centroid virial
|
|
||||||
vflag = 12 = both per-atom virial and per-atom centroid virial
|
|
||||||
vflag = 13 or 14 = global, per-atom virial and per-atom centroid virial
|
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Integrate::ev_set(bigint ntimestep)
|
void Integrate::ev_set(bigint ntimestep)
|
||||||
@ -136,7 +133,7 @@ void Integrate::ev_set(bigint ntimestep)
|
|||||||
int eflag_global = 0;
|
int eflag_global = 0;
|
||||||
for (i = 0; i < nelist_global; i++)
|
for (i = 0; i < nelist_global; i++)
|
||||||
if (elist_global[i]->matchstep(ntimestep)) flag = 1;
|
if (elist_global[i]->matchstep(ntimestep)) flag = 1;
|
||||||
if (flag) eflag_global = 1;
|
if (flag) eflag_global = ENERGY_GLOBAL;
|
||||||
|
|
||||||
flag = 0;
|
flag = 0;
|
||||||
int eflag_atom = 0;
|
int eflag_atom = 0;
|
||||||
|
|||||||
@ -214,7 +214,15 @@ void KSpace::pair_check()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup for energy, virial computation
|
setup for energy, virial computation
|
||||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
see integrate::ev_set() for bitwise settings of eflag/vflag
|
||||||
|
set the following flags, values are otherwise 0:
|
||||||
|
evflag = 1 if any bits of eflag or vflag are set
|
||||||
|
eflag_global = 1 if ENERGY_GLOBAL bit of eflag set
|
||||||
|
eflag_atom = 1 if ENERGY_ATOM bit of eflag set
|
||||||
|
eflag_either = 1 if eflag_global or eflag_atom is set
|
||||||
|
vflag_global = 1 if VIRIAL_PAIR or VIRIAL_FDOTR bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_PERATOM bit of vflag set
|
||||||
|
vflag_either = 1 if vflag_global or vflag_atom is set
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void KSpace::ev_setup(int eflag, int vflag, int alloc)
|
void KSpace::ev_setup(int eflag, int vflag, int alloc)
|
||||||
|
|||||||
@ -144,11 +144,12 @@ void Min::init()
|
|||||||
requestor = nullptr;
|
requestor = nullptr;
|
||||||
|
|
||||||
// virial_style:
|
// virial_style:
|
||||||
// 1 if computed explicitly by pair->compute via sum over pair interactions
|
// VIRIAL_PAIR if computed explicitly in pair via sum over pair interactions
|
||||||
// 2 if computed implicitly by pair->virial_compute via sum over ghost atoms
|
// VIRIAL_FDOTR if computed implicitly in pair by
|
||||||
|
// virial_fdotr_compute() via sum over ghosts
|
||||||
|
|
||||||
if (force->newton_pair) virial_style = 2;
|
if (force->newton_pair) virial_style = VIRIAL_FDOTR;
|
||||||
else virial_style = 1;
|
else virial_style = VIRIAL_PAIR;
|
||||||
|
|
||||||
// setup lists of computes for global and per-atom PE and pressure
|
// setup lists of computes for global and per-atom PE and pressure
|
||||||
|
|
||||||
|
|||||||
24
src/pair.cpp
24
src/pair.cpp
@ -74,9 +74,10 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
setflag = nullptr;
|
setflag = nullptr;
|
||||||
cutsq = nullptr;
|
cutsq = nullptr;
|
||||||
|
|
||||||
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0;
|
ewaldflag = pppmflag = msmflag = dispersionflag =
|
||||||
|
tip4pflag = dipoleflag = spinflag = 0;
|
||||||
reinitflag = 1;
|
reinitflag = 1;
|
||||||
centroidstressflag = 4;
|
centroidstressflag = CENTROID_SAME;
|
||||||
|
|
||||||
// pair_modify settings
|
// pair_modify settings
|
||||||
|
|
||||||
@ -776,7 +777,24 @@ void Pair::del_tally_callback(Compute *ptr)
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
setup for energy, virial computation
|
setup for energy, virial computation
|
||||||
see integrate::ev_set() for values of eflag (0-3) and vflag (0-6)
|
see integrate::ev_set() for bitwise settings of eflag/vflag
|
||||||
|
set the following flags, values are otherwise 0:
|
||||||
|
evflag = 1 if any bits of eflag or vflag are set
|
||||||
|
eflag_global = 1 if ENERGY_GLOBAL bit of eflag set
|
||||||
|
eflag_atom = 1 if ENERGY_ATOM bit of eflag set
|
||||||
|
eflag_either = 1 if eflag_global or eflag_atom is set
|
||||||
|
vflag_global = 1 if VIRIAL_PAIR bit of vflag set
|
||||||
|
vflag_global = 2 if VIRIAL_FDOTR bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_PERATOM bit of vflag set
|
||||||
|
vflag_atom = 1 if VIRIAL_CENTROID bit of vflag set
|
||||||
|
and centroidstressflag != CENTROID_AVAIL
|
||||||
|
cvflag_atom = 1 if VIRIAL_CENTROID bit of vflag set
|
||||||
|
and centroidstressflag = CENTROID_AVAIL
|
||||||
|
vflag_either = 1 if any of vflag_global, vflag_atom, cvflag_atom is set
|
||||||
|
centroidstressflag is set by the pair style to one of these values:
|
||||||
|
CENTROID_SAME = same as two-body stress
|
||||||
|
CENTROID_AVAIL = different and implemented
|
||||||
|
CENTROID_NOTAVAIL = different but not yet implemented
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void Pair::ev_setup(int eflag, int vflag, int alloc)
|
void Pair::ev_setup(int eflag, int vflag, int alloc)
|
||||||
|
|||||||
@ -68,10 +68,10 @@ class Pair : protected Pointers {
|
|||||||
int spinflag; // 1 if compatible with spin solver
|
int spinflag; // 1 if compatible with spin solver
|
||||||
int reinitflag; // 1 if compatible with fix adapt and alike
|
int reinitflag; // 1 if compatible with fix adapt and alike
|
||||||
|
|
||||||
int centroidstressflag; // compatibility with centroid atomic stress
|
int centroidstressflag; // centroid atomic compared to two-body stress
|
||||||
// 1 if same as two-body atomic stress
|
// CENTROID_SAME = same as two-body stress
|
||||||
// 2 if implemented and different from two-body
|
// CENTROID_AVAIL = different and implemented
|
||||||
// 4 if not compatible/implemented
|
// CENTROID_NOTAVAIL = different, not yet implemented
|
||||||
|
|
||||||
int tail_flag; // pair_modify flag for LJ tail correction
|
int tail_flag; // pair_modify flag for LJ tail correction
|
||||||
double etail,ptail; // energy/pressure tail corrections
|
double etail,ptail; // energy/pressure tail corrections
|
||||||
|
|||||||
@ -311,9 +311,10 @@ void Respa::init()
|
|||||||
if (force->pair && force->pair->respa_enable == 0)
|
if (force->pair && force->pair->respa_enable == 0)
|
||||||
error->all(FLERR,"Pair style does not support rRESPA inner/middle/outer");
|
error->all(FLERR,"Pair style does not support rRESPA inner/middle/outer");
|
||||||
|
|
||||||
// virial_style = 1 (explicit) since never computed implicitly like Verlet
|
// virial_style = VIRIAL_PAIR (explicit)
|
||||||
|
// since never computed implicitly with virial_fdotr_compute() like Verlet
|
||||||
|
|
||||||
virial_style = 1;
|
virial_style = VIRIAL_PAIR;
|
||||||
|
|
||||||
// setup lists of computes for global and per-atom PE and pressure
|
// setup lists of computes for global and per-atom PE and pressure
|
||||||
|
|
||||||
|
|||||||
@ -54,11 +54,12 @@ void Verlet::init()
|
|||||||
error->warning(FLERR,"No fixes defined, atoms won't move");
|
error->warning(FLERR,"No fixes defined, atoms won't move");
|
||||||
|
|
||||||
// virial_style:
|
// virial_style:
|
||||||
// 1 if computed explicitly by pair->compute via sum over pair interactions
|
// VIRIAL_PAIR if computed explicitly in pair via sum over pair interactions
|
||||||
// 2 if computed implicitly by pair->virial_fdotr_compute via sum over ghosts
|
// VIRIAL_FDOTR if computed implicitly in pair by
|
||||||
|
// virial_fdotr_compute() via sum over ghosts
|
||||||
|
|
||||||
if (force->newton_pair) virial_style = 2;
|
if (force->newton_pair) virial_style = VIRIAL_FDOTR;
|
||||||
else virial_style = 1;
|
else virial_style = VIRIAL_PAIR;
|
||||||
|
|
||||||
// setup lists of computes for global and per-atom PE and pressure
|
// setup lists of computes for global and per-atom PE and pressure
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user