Unverified Commit 3e4fd3da authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

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

Restart updates for fixes atom/swap, deposit, and gcmc
parents 3e05b983 8b169d97
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -141,11 +141,16 @@ specify if this should be done.


This fix writes the state of the fix to "binary restart
This fix writes the state of the fix to "binary restart
files"_restart.html.  This includes information about the random
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
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
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.
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
None of the "fix_modify"_fix_modify.html options are relevant to this
fix.
fix.


+4 −0
Original line number Original line Diff line number Diff line
@@ -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
a fix in an input script that reads a restart file, so that the
operation of the fix continues in an uninterrupted fashion.
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
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
fix.  No global or per-atom quantities are stored by this fix for
access by various "output commands"_Howto_output.html.  No parameter
access by various "output commands"_Howto_output.html.  No parameter
+6 −1
Original line number Original line Diff line number Diff line
@@ -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
This fix writes the state of the fix to "binary restart
files"_restart.html.  This includes information about the random
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
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
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.
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
None of the "fix_modify"_fix_modify.html options are relevant to this
fix.
fix.


+13 −3
Original line number Original line Diff line number Diff line
@@ -771,10 +771,13 @@ double FixAtomSwap::memory_usage()
void FixAtomSwap::write_restart(FILE *fp)
void FixAtomSwap::write_restart(FILE *fp)
{
{
  int n = 0;
  int n = 0;
  double list[4];
  double list[6];
  list[n++] = random_equal->state();
  list[n++] = random_equal->state();
  list[n++] = random_unequal->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) {
  if (comm->me == 0) {
    int size = n * sizeof(double);
    int size = n * sizeof(double);
@@ -798,5 +801,12 @@ void FixAtomSwap::restart(char *buf)
  seed = static_cast<int> (list[n++]);
  seed = static_cast<int> (list[n++]);
  random_unequal->reset(seed);
  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");
}
}
+25 −3
Original line number Original line Diff line number Diff line
@@ -2531,10 +2531,19 @@ double FixGCMC::memory_usage()
void FixGCMC::write_restart(FILE *fp)
void FixGCMC::write_restart(FILE *fp)
{
{
  int n = 0;
  int n = 0;
  double list[4];
  double list[12];
  list[n++] = random_equal->state();
  list[n++] = random_equal->state();
  list[n++] = random_unequal->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) {
  if (comm->me == 0) {
    int size = n * sizeof(double);
    int size = n * sizeof(double);
@@ -2558,7 +2567,20 @@ void FixGCMC::restart(char *buf)
  seed = static_cast<int> (list[n++]);
  seed = static_cast<int> (list[n++]);
  random_unequal->reset(seed);
  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) {
void FixGCMC::grow_molecule_arrays(int nmolatoms) {
Loading