more debugging and features
This commit is contained in:
@ -330,6 +330,8 @@ void Dump::write()
|
||||
|
||||
if (delay_flag && update->ntimestep < delaystep) return;
|
||||
|
||||
printf("DUMP %ld\n",update->ntimestep);
|
||||
|
||||
// if file per timestep, open new file
|
||||
|
||||
if (multifile) openfile();
|
||||
|
||||
@ -198,6 +198,7 @@ void FixDtReset::end_of_step()
|
||||
laststep = update->ntimestep;
|
||||
|
||||
// calls to other classes that need to know timestep size changed
|
||||
// similar logic is in Input::timestep()
|
||||
|
||||
update->update_time();
|
||||
update->dt = dt;
|
||||
|
||||
@ -1836,8 +1836,24 @@ void Input::timer_command()
|
||||
void Input::timestep()
|
||||
{
|
||||
if (narg != 1) error->all(FLERR,"Illegal timestep command");
|
||||
|
||||
update->update_time();
|
||||
update->dt = utils::numeric(FLERR,arg[0],false,lmp);
|
||||
update->dt_default = 0;
|
||||
|
||||
if (update->first_update == 0) return;
|
||||
|
||||
// calls to other classes that need to know timestep size changed
|
||||
// similar logic is in FixDtReset::end_of_step()
|
||||
// only if a run has already occurred
|
||||
|
||||
int respaflag = 0;
|
||||
if (utils::strmatch(update->integrate_style, "^respa")) respaflag = 1;
|
||||
if (respaflag) update->integrate->reset_dt();
|
||||
|
||||
if (force->pair) force->pair->reset_dt();
|
||||
for (int i = 0; i < modify->nfix; i++) modify->fix[i]->reset_dt();
|
||||
output->reset_dt();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -565,42 +565,22 @@ void Output::write_restart(bigint ntimestep)
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
timestep is being changed, called by update->reset_timestep()
|
||||
reset next output values for dumps, restart, thermo output
|
||||
for dumps, require that no dump is "active"
|
||||
meaning that a snapshot has already been output
|
||||
reset next output values restart and thermo output
|
||||
reset to smallest value >= new timestep
|
||||
if next timestep set by variable evaluation,
|
||||
eval for ntimestep-1, so current ntimestep can be returned if needed
|
||||
no guarantee that variable can be evaluated for ntimestep-1
|
||||
if it depends on computes, but live with that rare case for now
|
||||
e.g. if it depends on computes, but live with that rare case for now
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Output::reset_timestep(bigint ntimestep)
|
||||
{
|
||||
next_dump_any = MAXBIGINT;
|
||||
for (int idump = 0; idump < ndump; idump++) {
|
||||
if (every_dump[idump]) {
|
||||
next_dump[idump] = (ntimestep/every_dump[idump])*every_dump[idump];
|
||||
if (next_dump[idump] < ntimestep) next_dump[idump] += every_dump[idump];
|
||||
} else {
|
||||
// ivar_dump may not be initialized
|
||||
if (ivar_dump[idump] < 0) {
|
||||
ivar_dump[idump] = input->variable->find(var_dump[idump]);
|
||||
if (ivar_dump[idump] < 0)
|
||||
error->all(FLERR,"Variable name for dump every does not exist");
|
||||
if (!input->variable->equalstyle(ivar_dump[idump]))
|
||||
error->all(FLERR,"Variable for dump every is invalid style");
|
||||
}
|
||||
modify->clearstep_compute();
|
||||
update->ntimestep--;
|
||||
bigint nextdump = static_cast<bigint>
|
||||
(input->variable->compute_equal(ivar_dump[idump]));
|
||||
if (nextdump < ntimestep)
|
||||
error->all(FLERR,"Dump every variable returned a bad timestep");
|
||||
update->ntimestep++;
|
||||
next_dump[idump] = nextdump;
|
||||
modify->addstep_compute(next_dump[idump]);
|
||||
}
|
||||
next_dump_any = MIN(next_dump_any,next_dump[idump]);
|
||||
}
|
||||
for (int idump = 0; idump < ndump; idump++)
|
||||
if (last_dump[idump] >= 0)
|
||||
error->all("Cannot reset timestep with active dump - must undump first");
|
||||
|
||||
if (restart_flag_single) {
|
||||
if (restart_every_single) {
|
||||
@ -669,21 +649,30 @@ void Output::reset_timestep(bigint ntimestep)
|
||||
|
||||
void Output::reset_dt()
|
||||
{
|
||||
next_dump_any = MAXBIGINT;
|
||||
|
||||
bigint ntimestep = update->ntimestep;
|
||||
|
||||
next_dump_any = MAXBIGINT;
|
||||
|
||||
for (int idump = 0; idump < ndump; idump++) {
|
||||
if (mode_dump[idump] == 1) {
|
||||
|
||||
// reset next_dump for unchanged next_time_dump, 2 arg for reset_dt()
|
||||
// reset next_dump but do not change next_time_dump, 2 arg for reset_dt()
|
||||
// do not invoke for a dump already scheduled for this step
|
||||
// use compute_all() b/c don't know what computes will be needed
|
||||
|
||||
if (next_dump[idump] != ntimestep) {
|
||||
calculate_next_dump(2,idump,update->ntimestep);
|
||||
if (dump[idump]->clearstep || var_dump[idump])
|
||||
modify->addstep_compute_all(next_dump[idump]);
|
||||
|
||||
// NOTE: think I should not do this here
|
||||
// for time dumps, calc_next_dump should calc the next timestep
|
||||
// as one less and not add it to computes
|
||||
// then on that step, write() should not actually write the dump
|
||||
// but trigger it on next step and addstep_compute_all for that step
|
||||
// b/c when write() is called, the next-step timestep is set
|
||||
// unless run every timestep is invoked in-between!
|
||||
|
||||
//if (dump[idump]->clearstep || var_dump[idump])
|
||||
// modify->addstep_compute_all(next_dump[idump]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -491,6 +491,7 @@ void Update::reset_timestep(bigint newstep)
|
||||
}
|
||||
|
||||
// changes to output that depend on timestep
|
||||
// no active dumps allowed
|
||||
|
||||
output->reset_timestep(ntimestep);
|
||||
|
||||
|
||||
@ -252,6 +252,8 @@ void Verlet::run(int n)
|
||||
ntimestep = ++update->ntimestep;
|
||||
ev_set(ntimestep);
|
||||
|
||||
printf("VERLET %ld: %d %d\n",ntimestep,eflag,vflag);
|
||||
|
||||
// initial time integration
|
||||
|
||||
timer->stamp();
|
||||
|
||||
Reference in New Issue
Block a user