From 9885d384beb476fcdab6238a4cb51ed61d48c3f0 Mon Sep 17 00:00:00 2001 From: cabb99 Date: Wed, 23 Oct 2019 13:00:34 -0500 Subject: [PATCH 1/3] Fix print patch to allow print on rerun --- src/fix_print.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fix_print.cpp b/src/fix_print.cpp index dc76fc39f9..f6a45017fb 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -148,7 +148,8 @@ void FixPrint::init() void FixPrint::end_of_step() { - if (update->ntimestep != next_print) return; + //Only execute if we have advanced one step (normal run) or we are on the same step (rerun) + if ((update->ntimestep != next_print) & (update->ntimestep != next_print-nevery)) return; // make a copy of string to work on // substitute for $ variables (no printing) From 1955c57791b276f580f83eafe9eb5567ee3fab2d Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Tue, 12 Nov 2019 10:16:50 -0700 Subject: [PATCH 2/3] make fix print work the same for run, multiple runs, rerun --- src/fix_print.cpp | 16 +++++++++++++--- src/fix_print.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/fix_print.cpp b/src/fix_print.cpp index f6a45017fb..67f164e05e 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,10 +149,16 @@ void FixPrint::init() /* ---------------------------------------------------------------------- */ +void FixPrint::setup(int vflag) +{ + end_of_step(); +} + +/* ---------------------------------------------------------------------- */ + void FixPrint::end_of_step() { - //Only execute if we have advanced one step (normal run) or we are on the same step (rerun) - if ((update->ntimestep != next_print) & (update->ntimestep != next_print-nevery)) return; + if (update->ntimestep != next_print) return; // make a copy of string to work on // substitute for $ variables (no printing) @@ -169,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(); From 60fe0c0b86042e87784cf682f26ef45a040009d0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 14 Nov 2019 09:24:56 -0500 Subject: [PATCH 3/3] Silence compiler warning --- src/fix_print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fix_print.cpp b/src/fix_print.cpp index 67f164e05e..54132a3ce6 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -149,7 +149,7 @@ void FixPrint::init() /* ---------------------------------------------------------------------- */ -void FixPrint::setup(int vflag) +void FixPrint::setup(int /* vflag */) { end_of_step(); }