diff --git a/src/neighbor.h b/src/neighbor.h index 25df310bce..2e45476f92 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -28,6 +28,7 @@ class Neighbor : protected Pointers { int pgsize; // size of neighbor page int oneatom; // max # of neighbors for one atom int includegroup; // only build pairwise lists for this group + int build_once; // 1 if only build lists once per run double skin; // skin distance double cutneighmin; // min neighbor cutoff for all type pairs @@ -79,7 +80,6 @@ class Neighbor : protected Pointers { int maxbond,maxangle,maxdihedral,maximproper; // size of bond lists int maxwt; // max weighting factor applied + 1 - int build_once; // 1 if only build lists once per run int must_check; // 1 if must check other classes to reneigh int restart_check; // 1 if restart enabled, 0 if no int fix_check; // # of fixes that induce reneigh diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 5b19ada3e1..2f2f73a200 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -26,6 +26,7 @@ #include "dihedral.h" #include "improper.h" #include "update.h" +#include "neighbor.h" #include "domain.h" #include "modify.h" #include "universe.h" @@ -119,6 +120,15 @@ void WriteRestart::command(int narg, char **arg) void WriteRestart::write(char *file) { + // special case where reneighboring is not done in integrator + // on timestep restart file is written (due to build_once being set) + // if box is changing, must be reset, else restart file will have + // wrong box size and atoms will be lost when restart file is read + // other calls to pbc and domain and comm are not made, + // b/c they only make sense if reneighboring is actually performed + + if (neighbor->build_once) domain->reset_box(); + // natoms = sum of nlocal = value to write into restart file // if unequal and thermo lostflag is "error", don't write restart file