Merge pull request #1740 from cabb99/master

Fix print patch to allow print on rerun
This commit is contained in:
Axel Kohlmeyer
2019-11-14 09:25:50 -05:00
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@ -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,6 +149,13 @@ void FixPrint::init()
/* ---------------------------------------------------------------------- */
void FixPrint::setup(int /* vflag */)
{
end_of_step();
}
/* ---------------------------------------------------------------------- */
void FixPrint::end_of_step()
{
if (update->ntimestep != next_print) return;
@ -168,6 +178,7 @@ void FixPrint::end_of_step()
} else {
next_print = (update->ntimestep/nevery)*nevery + nevery;
}
modify->addstep_compute(next_print);
if (me == 0) {

View File

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