From fe3f96f18ebb80e6b61b8918a06278e5b57f5021 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 21 Sep 2026 14:14:53 +0100 Subject: [PATCH] Silence Sire progress bars when a runner is constructed, not on import. --- CHANGELOG.md | 1 + src/somd2/__init__.py | 8 -------- src/somd2/runner/_base.py | 5 +++++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f419f9..33a768b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Changelog * Please add an item to this CHANGELOG for any new features or bug fixes when creating a PR. * Increase the default `cutoff` from 7.5 Å to 9 Å, matching common practice and giving faster PME on current GPUs, since the shorter cutoff shifts too much work onto the reciprocal space grid [#209](https://github.com/OpenBioSim/somd2/pull/209). * Buffer energy components and write them at checkpoint time, rather than rewriting the parquet file on every energy save, which cost a few milliseconds per replica per cycle and grew with the length of the run [#212](https://github.com/OpenBioSim/somd2/pull/212). +* Silence Sire's progress bars when a runner is constructed rather than when `somd2` is imported, so that importing `somd2` as a library no longer changes how Sire reports progress [#215](https://github.com/OpenBioSim/somd2/pull/215). [2026.2.0](https://github.com/openbiosim/somd2/compare/2026.1.0...2026.2.0) - Sep 2026 -------------------------------------------------------------------------------------- diff --git a/src/somd2/__init__.py b/src/somd2/__init__.py index 7f0a24a..0591409 100644 --- a/src/somd2/__init__.py +++ b/src/somd2/__init__.py @@ -19,14 +19,6 @@ # along with SOMD2. If not, see . ##################################################################### -# Disable Sire progress bars until we work out the best way to handle -# them for the SOMD2 runner, i.e. when running multiple dynamics objects -# in parallel. -from sire.base import ProgressBar as _ProgressBar - -_ProgressBar.set_silent() -del _ProgressBar - from loguru import logger as _logger from . import runner diff --git a/src/somd2/runner/_base.py b/src/somd2/runner/_base.py index 023e67d..16fec0d 100644 --- a/src/somd2/runner/_base.py +++ b/src/somd2/runner/_base.py @@ -85,6 +85,11 @@ def __init__(self, system, config): # user's final choice of output directory is known. self._config._setup_output_directory() + # Progress is reported through the logger, so silence Sire's progress + # bars. This also lets Sire run dynamics in longer blocks, since the + # blocks only exist to update the bar. + _sr.base.ProgressBar.set_silent() + if self._config.replica_exchange and self._config.perturbed_system is not None: # Make sure the number of positions is correct. num_atoms = self._system.num_atoms()