From 388eab5eebe5a9bc8db5bdb00b1fe173fdb475b8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 17 Sep 2017 20:49:41 -0400 Subject: [PATCH] correctly initialize `thermo_virial` in fix poems and protect access to vflag_XXX by checking for evflag !=0 --- src/POEMS/fix_poems.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index fe2168fcaa..effd06f477 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -76,6 +76,7 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : time_integrate = 1; rigid_flag = 1; virial_flag = 1; + thermo_virial = 1; dof_flag = 1; MPI_Comm_rank(world,&me); @@ -683,12 +684,14 @@ void FixPOEMS::setup(int vflag) // guestimate virial as 2x the set_v contribution - if (vflag_global) - for (n = 0; n < 6; n++) virial[n] *= 2.0; - if (vflag_atom) { - for (i = 0; i < nlocal; i++) - for (n = 0; n < 6; n++) - vatom[i][n] *= 2.0; + if (evflag) { + if (vflag_global) + for (n = 0; n < 6; n++) virial[n] *= 2.0; + if (vflag_atom) { + for (i = 0; i < nlocal; i++) + for (n = 0; n < 6; n++) + vatom[i][n] *= 2.0; + } } // use post_force() to compute initial fcm & torque