diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index aad8d7447f..7d817ffbb1 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -777,6 +777,7 @@ void FixAtomSwap::write_restart(FILE *fp) list[n++] = ubuf(next_reneighbor).d; list[n++] = nswap_attempts; list[n++] = nswap_successes; + list[n++] = ubuf(update->ntimestep).d; if (comm->me == 0) { int size = n * sizeof(double); @@ -804,4 +805,8 @@ void FixAtomSwap::restart(char *buf) nswap_attempts = static_cast(list[n++]); nswap_successes = static_cast(list[n++]); + + bigint ntimestep_restart = (bigint) ubuf(list[n++]).i; + if (ntimestep_restart != update->ntimestep) + error->all(FLERR,"Must not reset timestep when restarting fix atom/swap"); } diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index f3a11a1000..7ab0879335 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -2543,7 +2543,7 @@ void FixGCMC::write_restart(FILE *fp) list[n++] = ndeletion_successes; list[n++] = ninsertion_attempts; list[n++] = ninsertion_successes; - + list[n++] = ubuf(update->ntimestep).d; if (comm->me == 0) { int size = n * sizeof(double); @@ -2577,6 +2577,10 @@ void FixGCMC::restart(char *buf) ndeletion_successes = list[n++]; ninsertion_attempts = list[n++]; ninsertion_successes = list[n++]; + + bigint ntimestep_restart = (bigint) ubuf(list[n++]).i; + if (ntimestep_restart != update->ntimestep) + error->all(FLERR,"Must not reset timestep when restarting fix gcmc"); } void FixGCMC::grow_molecule_arrays(int nmolatoms) { diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index a1d0669f32..66aed34846 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -798,11 +798,12 @@ void FixDeposit::options(int narg, char **arg) void FixDeposit::write_restart(FILE *fp) { int n = 0; - double list[4]; + double list[5]; list[n++] = random->state(); list[n++] = ninserted; list[n++] = nfirst; list[n++] = ubuf(next_reneighbor).d; + list[n++] = ubuf(update->ntimestep).d; if (comm->me == 0) { int size = n * sizeof(double); @@ -825,6 +826,10 @@ void FixDeposit::restart(char *buf) nfirst = static_cast (list[n++]); next_reneighbor = (bigint) ubuf(list[n++]).i; + bigint ntimestep_restart = (bigint) ubuf(list[n++]).i; + if (ntimestep_restart != update->ntimestep) + error->all(FLERR,"Must not reset timestep when restarting this fix"); + random->reset(seed); }