Merge pull request #1484 from akohlmey/reneighbor-64-bit-restart-fix

Restart updates for fixes atom/swap, deposit, and gcmc
This commit is contained in:
Axel Kohlmeyer
2019-05-31 13:05:53 -04:00
committed by GitHub
6 changed files with 62 additions and 11 deletions

View File

@ -141,11 +141,16 @@ specify if this should be done.
This fix writes the state of the fix to "binary restart
files"_restart.html. This includes information about the random
number generator seed, the next timestep for MC exchanges, etc. See
number generator seed, the next timestep for MC exchanges, the number
of exchange attempts and successes etc. See
the "read_restart"_read_restart.html command for info on how to
re-specify a fix in an input script that reads a restart file, so that
the operation of the fix continues in an uninterrupted fashion.
NOTE: For this to work correctly, the timestep must [not] be changed
after reading the restart with "reset_timestep"_reset_timestep.html.
The fix will try to detect it and stop with an error.
None of the "fix_modify"_fix_modify.html options are relevant to this
fix.

View File

@ -261,6 +261,10 @@ next timestep for deposition, etc. See the
a fix in an input script that reads a restart file, so that the
operation of the fix continues in an uninterrupted fashion.
NOTE: For this to work correctly, the timestep must [not] be changed
after reading the restart with "reset_timestep"_reset_timestep.html.
The fix will try to detect it and stop with an error.
None of the "fix_modify"_fix_modify.html options are relevant to this
fix. No global or per-atom quantities are stored by this fix for
access by various "output commands"_Howto_output.html. No parameter

View File

@ -373,11 +373,16 @@ adds all inserted atoms of the specified type to the
This fix writes the state of the fix to "binary restart
files"_restart.html. This includes information about the random
number generator seed, the next timestep for MC exchanges, etc. See
number generator seed, the next timestep for MC exchanges, the number
of MC step attempts and successes etc. See
the "read_restart"_read_restart.html command for info on how to
re-specify a fix in an input script that reads a restart file, so that
the operation of the fix continues in an uninterrupted fashion.
NOTE: For this to work correctly, the timestep must [not] be changed
after reading the restart with "reset_timestep"_reset_timestep.html.
The fix will try to detect it and stop with an error.
None of the "fix_modify"_fix_modify.html options are relevant to this
fix.

View File

@ -771,10 +771,13 @@ double FixAtomSwap::memory_usage()
void FixAtomSwap::write_restart(FILE *fp)
{
int n = 0;
double list[4];
double list[6];
list[n++] = random_equal->state();
list[n++] = random_unequal->state();
list[n++] = next_reneighbor;
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);
@ -798,5 +801,12 @@ void FixAtomSwap::restart(char *buf)
seed = static_cast<int> (list[n++]);
random_unequal->reset(seed);
next_reneighbor = static_cast<int> (list[n++]);
next_reneighbor = (bigint) ubuf(list[n++]).i;
nswap_attempts = static_cast<int>(list[n++]);
nswap_successes = static_cast<int>(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");
}

View File

@ -2531,10 +2531,19 @@ double FixGCMC::memory_usage()
void FixGCMC::write_restart(FILE *fp)
{
int n = 0;
double list[4];
double list[12];
list[n++] = random_equal->state();
list[n++] = random_unequal->state();
list[n++] = next_reneighbor;
list[n++] = ubuf(next_reneighbor).d;
list[n++] = ntranslation_attempts;
list[n++] = ntranslation_successes;
list[n++] = nrotation_attempts;
list[n++] = nrotation_successes;
list[n++] = ndeletion_attempts;
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);
@ -2558,7 +2567,20 @@ void FixGCMC::restart(char *buf)
seed = static_cast<int> (list[n++]);
random_unequal->reset(seed);
next_reneighbor = static_cast<int> (list[n++]);
next_reneighbor = (bigint) ubuf(list[n++]).i;
ntranslation_attempts = list[n++];
ntranslation_successes = list[n++];
nrotation_attempts = list[n++];
nrotation_successes = list[n++];
ndeletion_attempts = list[n++];
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) {

View File

@ -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++] = next_reneighbor;
list[n++] = ubuf(next_reneighbor).d;
list[n++] = ubuf(update->ntimestep).d;
if (comm->me == 0) {
int size = n * sizeof(double);
@ -823,7 +824,11 @@ void FixDeposit::restart(char *buf)
seed = static_cast<int> (list[n++]);
ninserted = static_cast<int> (list[n++]);
nfirst = static_cast<int> (list[n++]);
next_reneighbor = static_cast<int> (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);
}