From 2084e18ad214dfcc55f4e7652892034559271ae6 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Mon, 13 Jun 2022 12:46:29 -0600 Subject: [PATCH] Removing junk copied during write_data --- doc/src/bond_bpm_rotational.rst | 4 +++- doc/src/bond_bpm_spring.rst | 4 +++- src/fix_bond_history.cpp | 4 +++- src/fix_property_atom.cpp | 6 +++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index 7211781a4a..cd9d6438be 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -178,7 +178,9 @@ Restart and other info This bond style writes the reference state of each bond to :doc:`binary restart files `. Loading a restart file will -properly resume bonds. +properly resume bonds. However, the reference state is NOT +written to data files. Therefore reading a data file will not +restore bonds which will recalculate their reference state. The single() function of these pair styles returns 0.0 for the energy of a pairwise interaction, since energy is not conserved in these diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst index 619f6c0e8c..8297e5b147 100644 --- a/doc/src/bond_bpm_spring.rst +++ b/doc/src/bond_bpm_spring.rst @@ -141,7 +141,9 @@ Restart and other info This bond style writes the reference state of each bond to :doc:`binary restart files `. Loading a restart -file will properly resume bonds. +file will properly restore bonds. However, the reference state is NOT +written to data files. Therefore reading a data file will not +restore bonds which will recalculate their reference state. The single() function of these pair styles returns 0.0 for the energy of a pairwise interaction, since energy is not conserved in these diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index a0af563b3b..b5b51a963c 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -82,10 +82,12 @@ int FixBondHistory::setmask() void FixBondHistory::post_constructor() { // Store saved bond quantities for each atom using fix property atom + // Don't copy history to data files because this fix is typically + // not yet instantiated - history is only preserved across restarts id_fix = utils::strdup(id + std::string("_FIX_PROP_ATOM")); id_array = utils::strdup(std::string("d2_") + id); - modify->add_fix(fmt::format("{} {} property/atom {} {}", id_fix, group->names[igroup], id_array, + modify->add_fix(fmt::format("{} {} property/atom {} {} writedata no", id_fix, group->names[igroup], id_array, nbond * ndata)); int tmp1, tmp2; index = atom->find_custom(&id_array[3], tmp1, tmp2); diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index a6a1b997e3..38dd00c364 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -35,7 +35,7 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR, "Illegal fix property/atom command"); restart_peratom = 1; - wd_section = 1; + wd_section = 1; // can be overwitten using optional arguments int iarg = 3; nvalue = narg - iarg; @@ -153,6 +153,10 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (iarg + 2 > narg) error->all(FLERR, "Illegal fix property/atom command"); border = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; + } else if (strcmp(arg[iarg], "writedata") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); + wd_section = utils::logical(FLERR,arg[iarg+1],false,lmp); + iarg += 2; } else error->all(FLERR, "Illegal fix property/atom command"); }