From 5ba3c38ae0ef4d2d9fd22a4615d362f9d41930d5 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Wed, 2 Dec 2026 15:11:14 +0000 Subject: [PATCH] Backport fix from PR #307. [ci skip] --- src/somd2/runner/_base.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/somd2/runner/_base.py b/src/somd2/runner/_base.py index f8e889ed..48cb9635 100644 --- a/src/somd2/runner/_base.py +++ b/src/somd2/runner/_base.py @@ -90,6 +90,8 @@ def __init__(self, system, config): # user's final choice of output directory is known. self._config._setup_output_directory() + self._log_system_size() + # GCMC of solvent water is only well defined at constant volume. if self._config.gcmc and self._config.pressure is not None: _logger.info( @@ -1155,6 +1157,22 @@ def _has_restraints(self, restraint_type): for restraint in self._config.restraints or [] ) + def _log_system_size(self): + """ + Log the number of atoms and virtual sites in the input system. + """ + try: + num_virtual_sites = sum( + mol.property("n_virtual_sites").as_integer() + for mol in self._system.molecules("property n_virtual_sites") + ) + except KeyError: + num_virtual_sites = 0 + _logger.info( + f"System contains {self._system.num_atoms()} atoms and " + f"{num_virtual_sites} virtual sites." + ) + def _add_boresch_restraint(self, device=None): """ Generate a Boresch restraint for an ABFE bound leg with no user-supplied @@ -1178,6 +1196,9 @@ def _add_boresch_restraint(self, device=None): _logger.error(msg) raise RuntimeError(msg) + for restraint in restraints: + _logger.info(f"Boresch restraint: {restraint}") + self._dynamics_kwargs["restraints"] = ( self._dynamics_kwargs["restraints"] or [] ) + [restraints]