Unverified Commit 6107f00e authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1164 from akohlmey/fix-halt-for-minimize

Enable use of fix halt for minimizations
parents 1d38f2d7 80e0ddda
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -135,8 +135,7 @@ files"_restart.html. None of the "fix_modify"_fix_modify.html options
are relevant to this fix.  No global or per-atom quantities are stored
by this fix for access by various "output commands"_Howto_output.html.
No parameter of this fix can be used with the {start/stop} keywords of
the "run"_run.html command.  This fix is not invoked during "energy
minimization"_minimize.html.
the "run"_run.html command.

[Restrictions:] none

+11 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ int FixHalt::setmask()
  int mask = 0;
  mask |= END_OF_STEP;
  mask |= POST_RUN;
  mask |= MIN_POST_FORCE;
  return mask;
}

@@ -138,11 +139,21 @@ void FixHalt::init()
  // settings used by TLIMIT

  nextstep = (update->ntimestep/nevery)*nevery + nevery;
  thisstep = -1;
  tratio = 0.5;
}

/* ---------------------------------------------------------------------- */

void FixHalt::min_post_force(int /* vflag */)
{
  if (update->ntimestep == thisstep) return;
  if ((update->ntimestep % nevery) == 0) end_of_step();
  thisstep = update->ntimestep;
}

/* ---------------------------------------------------------------------- */

void FixHalt::end_of_step()
{
  // variable evaluation may invoke computes so wrap with clear/add
+2 −1
Original line number Diff line number Diff line
@@ -32,11 +32,12 @@ class FixHalt : public Fix {
  int setmask();
  void init();
  void end_of_step();
  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;