reorder thermo and dump output so dump styles include correct thermo data
This commit is contained in:
@ -190,6 +190,32 @@ void Output::setup(int memflag)
|
||||
{
|
||||
bigint ntimestep = update->ntimestep;
|
||||
|
||||
// print memory usage unless being called between multiple runs
|
||||
|
||||
if (memflag) memory_usage();
|
||||
|
||||
// set next_thermo to multiple of every or variable eval if var defined
|
||||
// ensure thermo output on last step of run
|
||||
// thermo may invoke computes so wrap with clear/add
|
||||
|
||||
modify->clearstep_compute();
|
||||
|
||||
thermo->header();
|
||||
thermo->compute(0);
|
||||
last_thermo = ntimestep;
|
||||
|
||||
if (var_thermo) {
|
||||
next_thermo = static_cast<bigint>
|
||||
(input->variable->compute_equal(ivar_thermo));
|
||||
if (next_thermo <= ntimestep)
|
||||
error->all(FLERR,"Thermo every variable returned a bad timestep");
|
||||
} else if (thermo_every) {
|
||||
next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every;
|
||||
next_thermo = MIN(next_thermo,update->laststep);
|
||||
} else next_thermo = update->laststep;
|
||||
|
||||
modify->addstep_compute(next_thermo);
|
||||
|
||||
// consider all dumps
|
||||
// decide whether to write snapshot and/or calculate next step for dump
|
||||
|
||||
@ -257,7 +283,7 @@ void Output::setup(int memflag)
|
||||
next_dump_any = MIN(next_dump_any,next_dump[idump]);
|
||||
}
|
||||
|
||||
// if no dumps, set next_dump_any to last+1 so will not influence next
|
||||
// if no dumps, set next_dump_any to last+1 so will not influence next
|
||||
|
||||
} else next_dump_any = update->laststep + 1;
|
||||
|
||||
@ -298,32 +324,6 @@ void Output::setup(int memflag)
|
||||
next_restart = MIN(next_restart_single,next_restart_double);
|
||||
} else next_restart = update->laststep + 1;
|
||||
|
||||
// print memory usage unless being called between multiple runs
|
||||
|
||||
if (memflag) memory_usage();
|
||||
|
||||
// set next_thermo to multiple of every or variable eval if var defined
|
||||
// ensure thermo output on last step of run
|
||||
// thermo may invoke computes so wrap with clear/add
|
||||
|
||||
modify->clearstep_compute();
|
||||
|
||||
thermo->header();
|
||||
thermo->compute(0);
|
||||
last_thermo = ntimestep;
|
||||
|
||||
if (var_thermo) {
|
||||
next_thermo = static_cast<bigint>
|
||||
(input->variable->compute_equal(ivar_thermo));
|
||||
if (next_thermo <= ntimestep)
|
||||
error->all(FLERR,"Thermo every variable returned a bad timestep");
|
||||
} else if (thermo_every) {
|
||||
next_thermo = (ntimestep/thermo_every)*thermo_every + thermo_every;
|
||||
next_thermo = MIN(next_thermo,update->laststep);
|
||||
} else next_thermo = update->laststep;
|
||||
|
||||
modify->addstep_compute(next_thermo);
|
||||
|
||||
// next = next timestep any output will be done
|
||||
|
||||
next = MIN(next_dump_any,next_restart);
|
||||
@ -338,6 +338,24 @@ void Output::setup(int memflag)
|
||||
|
||||
void Output::write(bigint ntimestep)
|
||||
{
|
||||
// ensure next_thermo forces output on last step of run
|
||||
// thermo may invoke computes so wrap with clear/add
|
||||
|
||||
if (next_thermo == ntimestep) {
|
||||
modify->clearstep_compute();
|
||||
if (last_thermo != ntimestep) thermo->compute(1);
|
||||
last_thermo = ntimestep;
|
||||
if (var_thermo) {
|
||||
next_thermo = static_cast<bigint>
|
||||
(input->variable->compute_equal(ivar_thermo));
|
||||
if (next_thermo <= ntimestep)
|
||||
error->all(FLERR,"Thermo every variable returned a bad timestep");
|
||||
} else if (thermo_every) next_thermo += thermo_every;
|
||||
else next_thermo = update->laststep;
|
||||
next_thermo = MIN(next_thermo,update->laststep);
|
||||
modify->addstep_compute(next_thermo);
|
||||
}
|
||||
|
||||
// perform dump if its next_dump = current ntimestep
|
||||
// but not if it was already written on this step
|
||||
// set next_dump and also next_time_dump for mode_dump = 1
|
||||
@ -437,24 +455,6 @@ void Output::write(bigint ntimestep)
|
||||
next_restart = MIN(next_restart_single,next_restart_double);
|
||||
}
|
||||
|
||||
// ensure next_thermo forces output on last step of run
|
||||
// thermo may invoke computes so wrap with clear/add
|
||||
|
||||
if (next_thermo == ntimestep) {
|
||||
modify->clearstep_compute();
|
||||
if (last_thermo != ntimestep) thermo->compute(1);
|
||||
last_thermo = ntimestep;
|
||||
if (var_thermo) {
|
||||
next_thermo = static_cast<bigint>
|
||||
(input->variable->compute_equal(ivar_thermo));
|
||||
if (next_thermo <= ntimestep)
|
||||
error->all(FLERR,"Thermo every variable returned a bad timestep");
|
||||
} else if (thermo_every) next_thermo += thermo_every;
|
||||
else next_thermo = update->laststep;
|
||||
next_thermo = MIN(next_thermo,update->laststep);
|
||||
modify->addstep_compute(next_thermo);
|
||||
}
|
||||
|
||||
// next = next timestep any output will be done
|
||||
|
||||
next = MIN(next_dump_any,next_restart);
|
||||
|
||||
Reference in New Issue
Block a user