change error checks for computes that are not current

This commit is contained in:
Steve Plimpton
2023-05-08 08:55:40 -06:00
parent b3130a2878
commit 49ac79fcdd
7 changed files with 83 additions and 134 deletions

View File

@ -664,20 +664,14 @@ void DumpImage::write()
}
// invoke Compute for per-grid quantities
// only if within a run or minimize
// else require the compute is current
// this prevents the compute from being invoked by the WriteDump class
// cannot invoke before first run, otherwise invoke if necessary
if (grid_compute) {
if (update->whichflag == 0) {
if (grid_compute->invoked_pergrid != update->ntimestep)
error->all(FLERR,"Grid compute {} used in dump image between runs is not current",
grid_compute->id);
} else {
if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) {
grid_compute->compute_pergrid();
grid_compute->invoked_flag |= Compute::INVOKED_PERGRID;
}
if (update->first_update == 0)
error->all(FLERR,"Grid compute used in dump image cannot be invoked before first run");
if (!(grid_compute->invoked_flag & Compute::INVOKED_PERGRID)) {
grid_compute->compute_pergrid();
grid_compute->invoked_flag |= Compute::INVOKED_PERGRID;
}
}