From 448f69a4d4eeb35a270439e5a5bdea548a66288a Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 18 Mar 2015 23:02:50 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13256 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/fix_ave_atom.cpp | 7 +++++-- src/fix_ave_atom.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) 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;