From 80e0dddae072acd04e29d93941018e91751f154d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 19 Oct 2018 14:08:25 -0400 Subject: [PATCH] use min_post_force() method to hook fix halt into minimization --- src/fix_halt.cpp | 6 +++++- src/fix_halt.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index 8acc08b107..5fda4c30d6 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -119,6 +119,7 @@ int FixHalt::setmask() int mask = 0; mask |= END_OF_STEP; mask |= POST_RUN; + mask |= MIN_POST_FORCE; return mask; } @@ -138,14 +139,17 @@ void FixHalt::init() // settings used by TLIMIT nextstep = (update->ntimestep/nevery)*nevery + nevery; + thisstep = -1; tratio = 0.5; } /* ---------------------------------------------------------------------- */ -void FixHalt::min_step(double, double *) +void FixHalt::min_post_force(int /* vflag */) { + if (update->ntimestep == thisstep) return; if ((update->ntimestep % nevery) == 0) end_of_step(); + thisstep = update->ntimestep; } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_halt.h b/src/fix_halt.h index 1bc49bbe1c..372c915a7f 100644 --- a/src/fix_halt.h +++ b/src/fix_halt.h @@ -32,12 +32,12 @@ class FixHalt : public Fix { int setmask(); void init(); void end_of_step(); - void min_step(double, double *); + void min_post_force(int); void post_run(); private: int attribute,operation,eflag,msgflag,ivar; - bigint nextstep; + bigint nextstep,thisstep; double value,tratio; char *idvar;