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

Enable use of fix halt for minimizations
This commit is contained in:
Axel Kohlmeyer 2018-10-23 10:35:26 -04:00 committed by GitHub
commit 6107f00e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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;