correctly initialize `thermo_virial` in fix poems and protect access to vflag_XXX by checking for evflag !=0

This commit is contained in:
Axel Kohlmeyer 2017-09-17 20:49:41 -04:00
parent a500048c9c
commit 388eab5eeb
1 changed files with 9 additions and 6 deletions

View File

@ -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