From fd8ff18abca54cfc4c6c83543a2cb45ba6f619ad Mon Sep 17 00:00:00 2001 From: Joel Clemmer Date: Wed, 14 Oct 2020 20:00:48 -0600 Subject: [PATCH] Adding restart method to fix neigh/history --- src/fix_neigh_history.cpp | 21 ++++++++++++++++++++- src/fix_neigh_history.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 88cb3fa64e..14f1e095de 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -40,6 +40,8 @@ FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : if (narg != 4) error->all(FLERR,"Illegal fix NEIGH_HISTORY command"); restart_peratom = 1; + restart_global = 1; + create_attribute = 1; maxexchange_dynamic = 1; @@ -840,6 +842,23 @@ int FixNeighHistory::unpack_exchange(int nlocal, double *buf) return m; } +/* ---------------------------------------------------------------------- + Use write_restart to invoke pre_exchange +------------------------------------------------------------------------- */ + +void FixNeighHistory::write_restart(FILE *fp) +{ + // Call pre-exchange to copy updated history in page file + // back into per-atom arrays prior to packing restart data + + pre_exchange(); + if (comm->me == 0) { + int size = 0; + fwrite(&size,sizeof(int),1,fp); + } +} + + /* ---------------------------------------------------------------------- pack values in local atom-based arrays for restart file ------------------------------------------------------------------------- */ @@ -851,7 +870,7 @@ int FixNeighHistory::pack_restart(int i, double *buf) for (int n = 0; n < npartner[i]; n++) { buf[m++] = partner[i][n]; memcpy(&buf[m],&valuepartner[i][dnum*n],dnumbytes); - m += dnum; + m += dnum; } // pack buf[0] this way because other fixes unpack it buf[0] = m; diff --git a/src/fix_neigh_history.h b/src/fix_neigh_history.h index 51d03f5b12..89c726683a 100644 --- a/src/fix_neigh_history.h +++ b/src/fix_neigh_history.h @@ -53,6 +53,7 @@ class FixNeighHistory : public Fix { void unpack_reverse_comm(int, int *, double *); int pack_exchange(int, double *); int unpack_exchange(int, double *); + void write_restart(FILE *); int pack_restart(int, double *); void unpack_restart(int, int); int size_restart(int);