From 560df20a68dec20917d98bc7e3590280464062f0 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 28 Sep 2022 10:00:59 -0600 Subject: [PATCH 1/3] Fixing math syntax in bpm/rotational documenation --- doc/src/bond_bpm_rotational.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst index 5c43071274..bc2f383828 100644 --- a/doc/src/bond_bpm_rotational.rst +++ b/doc/src/bond_bpm_rotational.rst @@ -67,7 +67,7 @@ which is proportional to the tangential shear displacement with a stiffness of :math:`k_s`. This tangential force also induces a torque. In addition, bending and twisting torques are also applied to particles which are proportional to angular bending and twisting -displacements with stiffnesses of :math`k_b` and :math:`k_t', +displacements with stiffnesses of :math:`k_b` and :math:`k_t`, respectively. Details on the calculations of shear displacements and angular displacements can be found in :ref:`(Wang) ` and :ref:`(Wang and Mora) `. From 32686873910b39bc3c987a58320aeba10cdd630e Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 14 Dec 2022 13:39:19 -0700 Subject: [PATCH 2/3] Removing unnecessary clears in update special fix --- src/fix_update_special_bonds.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/fix_update_special_bonds.cpp b/src/fix_update_special_bonds.cpp index 78c520344c..dc9fbb1b13 100644 --- a/src/fix_update_special_bonds.cpp +++ b/src/fix_update_special_bonds.cpp @@ -70,12 +70,6 @@ void FixUpdateSpecialBonds::setup(int /*vflag*/) force->special_coul[3] != 1.0) error->all(FLERR, "Fix update/special/bonds requires special Coulomb weights = 1,1,1"); // Implies neighbor->special_flag = [X, 2, 1, 1] - - new_broken_pairs.clear(); - broken_pairs.clear(); - - new_created_pairs.clear(); - created_pairs.clear(); } /* ---------------------------------------------------------------------- From b60a6e796e803d53096d3109c78716678f741582 Mon Sep 17 00:00:00 2001 From: jtclemm Date: Wed, 14 Dec 2022 14:14:43 -0700 Subject: [PATCH 3/3] Ensuring data is updated before writing restarts --- src/fix_bond_history.cpp | 3 +++ src/fix_update_special_bonds.cpp | 18 ++++++++++++++++++ src/fix_update_special_bonds.h | 1 + 3 files changed, 22 insertions(+) diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp index b5b51a963c..d96ff7f709 100644 --- a/src/fix_bond_history.cpp +++ b/src/fix_bond_history.cpp @@ -264,6 +264,9 @@ void FixBondHistory::write_restart(FILE *fp) double list[1]; list[n++] = stored_flag; + // Update stored values if needed + pre_exchange(); + if (comm->me == 0) { int size = n * sizeof(double); fwrite(&size, sizeof(int), 1, fp); diff --git a/src/fix_update_special_bonds.cpp b/src/fix_update_special_bonds.cpp index dc9fbb1b13..581918dbd3 100644 --- a/src/fix_update_special_bonds.cpp +++ b/src/fix_update_special_bonds.cpp @@ -15,6 +15,7 @@ #include "atom.h" #include "atom_vec.h" +#include "comm.h" #include "error.h" #include "force.h" #include "modify.h" @@ -35,6 +36,8 @@ FixUpdateSpecialBonds::FixUpdateSpecialBonds(LAMMPS *lmp, int narg, char **arg) Fix(lmp, narg, arg) { if (narg != 3) error->all(FLERR, "Illegal fix update/special/bonds command"); + + restart_global = 1; } /* ---------------------------------------------------------------------- */ @@ -241,3 +244,18 @@ void FixUpdateSpecialBonds::add_created_bond(int i, int j) new_created_pairs.push_back(tag_pair); created_pairs.push_back(tag_pair); } + +/* ---------------------------------------------------------------------- + Use write_restart to invoke pre_exchange +------------------------------------------------------------------------- */ + +void FixUpdateSpecialBonds::write_restart(FILE *fp) +{ + // Call pre-exchange to process any broken/created bonds + + pre_exchange(); + if (comm->me == 0) { + int size = 0; + fwrite(&size,sizeof(int),1,fp); + } +} diff --git a/src/fix_update_special_bonds.h b/src/fix_update_special_bonds.h index 825977d37f..594f31d54d 100644 --- a/src/fix_update_special_bonds.h +++ b/src/fix_update_special_bonds.h @@ -36,6 +36,7 @@ class FixUpdateSpecialBonds : public Fix { void pre_force(int) override; void add_broken_bond(int, int); void add_created_bond(int, int); + void write_restart(FILE *) override; protected: // Create two arrays to store bonds broken this timestep (new)