From 49e9f996ca312d60fef7d551ca885fae62856c8a Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 2 Sep 2024 16:36:28 +0100 Subject: [PATCH] Fix alchemical ion logging. --- src/somd2/runner/_runner.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/somd2/runner/_runner.py b/src/somd2/runner/_runner.py index fe0c24e..b0f5224 100644 --- a/src/somd2/runner/_runner.py +++ b/src/somd2/runner/_runner.py @@ -191,15 +191,18 @@ def __init__(self, system, config): f"The charge difference of {charge_diff} between the end states " f"does not match the specified value of {self._config.charge_difference}" ) - else: + # The user value takes precedence. + charge_diff = self._config.charge_difference _logger.info( - f"There is a charge difference of {charge_diff} between the end states. " - f"Adding alchemical ions to keep the charge constant." + f"Using user-specified value of {self._config.charge_difference}" ) - - # The user value takes precedence. - if self._config.charge_difference is not None: - charge_diff = self._config.charge_difference + else: + # Report that the charge will automatically be held constant. + if charge_diff != 0 and self._config.charge_difference is None: + _logger.info( + f"There is a charge difference of {charge_diff} between the end states. " + f"Adding alchemical ions to keep the charge constant." + ) # Create alchemical ions. if charge_diff != 0: