diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index fd69b1e05c..e611c888b8 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -43,8 +43,6 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : nrepeat = force->inumeric(FLERR,arg[4]); peratom_freq = force->inumeric(FLERR,arg[5]); - time_depend = 1; - // parse remaining values which = new int[narg-6]; @@ -198,6 +196,7 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : // once in end_of_step() can set timestep for ones actually invoked irepeat = 0; + nvalid_last = -1; nvalid = nextvalid(); modify->addstep_compute_all(nvalid); } @@ -281,9 +280,13 @@ void FixAveAtom::end_of_step() int i,j,m,n; // skip if not step which requires doing something + // error check if timestep was reset in an invalid manner bigint ntimestep = update->ntimestep; + if (ntimestep < nvalid_last || ntimestep > nvalid) + error->all(FLERR,"Invalid timestep resets for fix ave/time"); if (ntimestep != nvalid) return; + nvalid_last = nvalid; // zero if first step diff --git a/src/fix_ave_atom.h b/src/fix_ave_atom.h index 7186f0df8d..187d5ab922 100644 --- a/src/fix_ave_atom.h +++ b/src/fix_ave_atom.h @@ -44,7 +44,7 @@ class FixAveAtom : public Fix { private: int nvalues; int nrepeat,irepeat; - bigint nvalid; + bigint nvalid,nvalid_last; int *which,*argindex,*value2index; char **ids; double **array;