change to checking timestep for time dumps at start of each step

This commit is contained in:
Steve Plimpton
2021-12-20 16:39:17 -07:00
parent 06c45fbe68
commit 4d31e300c6
5 changed files with 440 additions and 413 deletions

View File

@ -20,6 +20,7 @@
#include "kspace.h"
#include "modify.h"
#include "pair.h"
#include "output.h"
#include "update.h"
using namespace LAMMPS_NS;
@ -115,7 +116,13 @@ void Integrate::ev_setup()
/* ----------------------------------------------------------------------
set eflag,vflag for current iteration
based on computes that need energy/virial info on this timestep
based on
(1) computes that need energy/virial info on this timestep
(2) time dumps that need unknown per-atom info on this timestep
NOTE: could not check time dumps if timestep size is not varying
see NOTE in output.cpp
also inefficient to add all per-atom eng/virial computes
but don't know which ones the dump needs
invoke matchstep() on all timestep-dependent computes to clear their arrays
eflag: set any or no bits
ENERGY_GLOBAL bit for global energy
@ -133,6 +140,10 @@ void Integrate::ev_set(bigint ntimestep)
{
int i,flag;
int tdflag = 0;
if (output->any_time_dumps)
tdflag = output->check_time_dumps(ntimestep);
flag = 0;
int eflag_global = 0;
for (i = 0; i < nelist_global; i++)
@ -143,7 +154,7 @@ void Integrate::ev_set(bigint ntimestep)
int eflag_atom = 0;
for (i = 0; i < nelist_atom; i++)
if (elist_atom[i]->matchstep(ntimestep)) flag = 1;
if (flag) eflag_atom = ENERGY_ATOM;
if (flag || (tdflag && nelist_atom)) eflag_atom = ENERGY_ATOM;
if (eflag_global) update->eflag_global = ntimestep;
if (eflag_atom) update->eflag_atom = ntimestep;
@ -159,13 +170,13 @@ void Integrate::ev_set(bigint ntimestep)
int vflag_atom = 0;
for (i = 0; i < nvlist_atom; i++)
if (vlist_atom[i]->matchstep(ntimestep)) flag = 1;
if (flag) vflag_atom = VIRIAL_ATOM;
if (flag || (tdflag && nvlist_atom)) vflag_atom = VIRIAL_ATOM;
flag = 0;
int cvflag_atom = 0;
for (i = 0; i < ncvlist_atom; i++)
if (cvlist_atom[i]->matchstep(ntimestep)) flag = 1;
if (flag) cvflag_atom = VIRIAL_CENTROID;
if (flag || (tdflag && ncvlist_atom)) cvflag_atom = VIRIAL_CENTROID;
if (vflag_global) update->vflag_global = ntimestep;
if (vflag_atom || cvflag_atom) update->vflag_atom = ntimestep;