diff --git a/src/fix_print.cpp b/src/fix_print.cpp index dc76fc39f9..54132a3ce6 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -134,7 +134,10 @@ void FixPrint::init() if (next_print <= update->ntimestep) error->all(FLERR,"Fix print timestep variable returned a bad timestep"); } else { - next_print = (update->ntimestep/nevery)*nevery + nevery; + if (update->ntimestep % nevery) + next_print = (update->ntimestep/nevery)*nevery + nevery; + else + next_print = update->ntimestep; } // add next_print to all computes that store invocation times @@ -146,6 +149,13 @@ void FixPrint::init() /* ---------------------------------------------------------------------- */ +void FixPrint::setup(int /* vflag */) +{ + end_of_step(); +} + +/* ---------------------------------------------------------------------- */ + void FixPrint::end_of_step() { if (update->ntimestep != next_print) return; @@ -168,6 +178,7 @@ void FixPrint::end_of_step() } else { next_print = (update->ntimestep/nevery)*nevery + nevery; } + modify->addstep_compute(next_print); if (me == 0) { diff --git a/src/fix_print.h b/src/fix_print.h index 5644160220..6ee39318e8 100644 --- a/src/fix_print.h +++ b/src/fix_print.h @@ -29,6 +29,7 @@ class FixPrint : public Fix { FixPrint(class LAMMPS *, int, char **); ~FixPrint(); void init(); + void setup(int); int setmask(); void end_of_step();