diff --git a/src/min.cpp b/src/min.cpp index 25b62ea09d..cc31f65bbe 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -301,10 +301,6 @@ void Min::run() timer->barrier_stop(TIME_LOOP); - // delete fix_minimize at end of run - - modify->delete_fix("MINIMIZE"); - // reset reneighboring criteria neighbor->every = neigh_every; @@ -318,6 +314,15 @@ void Min::run() fnorminf_final = fnorm_inf(); } +/* ---------------------------------------------------------------------- + delete fix at end of run, so its atom arrays won't persist +------------------------------------------------------------------------- */ + +void Min::cleanup() +{ + modify->delete_fix("MINIMIZE"); +} + /* ---------------------------------------------------------------------- evaluate potential energy and forces may migrate atoms due to reneighboring diff --git a/src/min.h b/src/min.h index dc05ebfb06..30f86fbefd 100644 --- a/src/min.h +++ b/src/min.h @@ -31,16 +31,16 @@ class Min : protected Pointers { void init(); void setup(); void run(); + void cleanup(); + void request(class Pair *, int, double); + double memory_usage() {return 0.0;} + void modify_params(int, char **); virtual void init_style() {} virtual void setup_style() = 0; virtual void reset_vectors() = 0; virtual int iterate(int) = 0; - void request(class Pair *, int, double); - double memory_usage() {return 0.0;} - void modify_params(int, char **); - protected: int eflag,vflag; // flags for energy/virial computation int virial_style; // compute virial explicitly or implicitly diff --git a/src/minimize.cpp b/src/minimize.cpp index 8132713070..a324e1f7bc 100644 --- a/src/minimize.cpp +++ b/src/minimize.cpp @@ -42,14 +42,14 @@ void Minimize::command(int narg, char **arg) if (update->etol < 0.0 || update->ftol < 0.0) error->all("Illegal minimize command"); + update->whichflag = 2; update->beginstep = update->firststep = update->ntimestep; update->endstep = update->laststep = update->firststep + update->nsteps; - update->whichflag = 2; - lmp->init(); update->minimize->setup(); update->minimize->run(); + update->minimize->cleanup(); Finish finish(lmp); finish.end(1);