From c5463e13f147eca8b9c89a1729b0afc2507f5513 Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 28 Oct 2023 13:22:10 -0400 Subject: [PATCH 1/4] output ninserted for fixes: deposit+pour --- src/GRANULAR/fix_pour.cpp | 12 +++++++++++- src/GRANULAR/fix_pour.h | 1 + src/fix_deposit.cpp | 6 ++++++ src/fix_deposit.h | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index f92bca5073a..8a2470715de 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -57,7 +57,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : if (narg < 6) error->all(FLERR, "Illegal fix pour command"); if (lmp->kokkos) error->all(FLERR, "Cannot yet use fix pour with the KOKKOS package"); - + + scalar_flag = 1; time_depend = 1; if (!atom->radius_flag || !atom->rmass_flag) @@ -1030,6 +1031,15 @@ void FixPour::options(int narg, char **arg) } } +/* ---------------------------------------------------------------------- + output number of successful insertions +------------------------------------------------------------------------- */ + +double FixPour::compute_scalar() +{ + return ninserted; +} + /* ---------------------------------------------------------------------- */ void FixPour::reset_dt() diff --git a/src/GRANULAR/fix_pour.h b/src/GRANULAR/fix_pour.h index 4a6e4abdaee..57db2541df4 100644 --- a/src/GRANULAR/fix_pour.h +++ b/src/GRANULAR/fix_pour.h @@ -32,6 +32,7 @@ class FixPour : public Fix { void init() override; void setup_pre_exchange() override; void pre_exchange() override; + double compute_scalar() override; void reset_dt() override; void *extract(const char *, int &) override; diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 35bc48fe890..ebcaf92beb6 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -51,6 +51,7 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : { if (narg < 7) error->all(FLERR,"Illegal fix deposit command"); + scalar_flag = 1; restart_global = 1; time_depend = 1; @@ -816,6 +817,11 @@ void FixDeposit::options(int narg, char **arg) } } +double FixDeposit::compute_scalar() +{ + return ninserted; +} + /* ---------------------------------------------------------------------- pack entire state of Fix into one write ------------------------------------------------------------------------- */ diff --git a/src/fix_deposit.h b/src/fix_deposit.h index ba5078dbbea..2b866dc068c 100644 --- a/src/fix_deposit.h +++ b/src/fix_deposit.h @@ -32,6 +32,7 @@ class FixDeposit : public Fix { void init() override; void setup_pre_exchange() override; void pre_exchange() override; + double compute_scalar() override; void write_restart(FILE *) override; void restart(char *) override; void *extract(const char *, int &) override; From db91f9413d7773e1bd4901ea4e89198fa3fa9bfe Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 28 Oct 2023 13:41:42 -0400 Subject: [PATCH 2/4] docs --- doc/src/fix_deposit.rst | 9 +++++---- doc/src/fix_pour.rst | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_deposit.rst b/doc/src/fix_deposit.rst index 7d2d28bfa96..08711001c51 100644 --- a/doc/src/fix_deposit.rst +++ b/doc/src/fix_deposit.rst @@ -289,10 +289,11 @@ operation of the fix continues in an uninterrupted fashion. The fix will try to detect it and stop with an error. None of the :doc:`fix_modify ` options are relevant to this -fix. No global or per-atom quantities are stored by this fix for -access by various :doc:`output commands `. No parameter -of this fix can be used with the *start/stop* keywords of the -:doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. +fix. This fix computes a global scalar, which can be accessed by various +output commands. The scalar is the cumulative number of insertions. The +scalar value calculated by this fix is “intensive”. No parameter of this +fix can be used with the *start/stop* keywords of the :doc:`run ` +command. This fix is not invoked during :doc:`energy minimization `. Restrictions """""""""""" diff --git a/doc/src/fix_pour.rst b/doc/src/fix_pour.rst index eca1f70c416..0ad369bf291 100644 --- a/doc/src/fix_pour.rst +++ b/doc/src/fix_pour.rst @@ -245,8 +245,9 @@ produce the same behavior if you adjust the fix pour parameters appropriately. None of the :doc:`fix_modify ` options are relevant to this -fix. No global or per-atom quantities are stored by this fix for -access by various :doc:`output commands `. No parameter +fix. This fix computes a global scalar, which can be accessed by various +output commands. The scalar is the cumulative number of insertions. The +scalar value calculated by this fix is “intensive”. No parameter of this fix can be used with the *start/stop* keywords of the :doc:`run ` command. This fix is not invoked during :doc:`energy minimization `. From 902c43e8c6e84fccd856cf8902a7dab129e4b740 Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 28 Oct 2023 13:45:55 -0400 Subject: [PATCH 3/4] formatting --- src/fix_deposit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index ebcaf92beb6..d2bcb3e855d 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -817,6 +817,10 @@ void FixDeposit::options(int narg, char **arg) } } +/* ---------------------------------------------------------------------- + output number of successful insertions +------------------------------------------------------------------------- */ + double FixDeposit::compute_scalar() { return ninserted; From 56d2a791af693effe5a25a2354dbac16d0ef358d Mon Sep 17 00:00:00 2001 From: Jacob Gissinger Date: Sat, 28 Oct 2023 14:01:39 -0400 Subject: [PATCH 4/4] whitespace --- src/GRANULAR/fix_pour.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 8a2470715de..cc5f0567e80 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -57,7 +57,7 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : if (narg < 6) error->all(FLERR, "Illegal fix pour command"); if (lmp->kokkos) error->all(FLERR, "Cannot yet use fix pour with the KOKKOS package"); - + scalar_flag = 1; time_depend = 1;