From 9c0cc4376a493f5941c0a84eec6fca90dda45768 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Fri, 30 Jan 2026 20:39:47 +0000 Subject: [PATCH] Clamp exponent to avoid overflow warnings. [ref #8] --- src/loch/_sampler.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/loch/_sampler.py b/src/loch/_sampler.py index 98155bb..faec480 100644 --- a/src/loch/_sampler.py +++ b/src/loch/_sampler.py @@ -1401,7 +1401,11 @@ def move(self, context: _openmm.Context) -> list[int]: # Compute the PME acceptance correction. acc_prob = _np.exp( - -self._beta_openmm * (final_energy - initial_energy - dE_RF) + min( + 0.0, + -self._beta_openmm + * (final_energy - initial_energy - dE_RF), + ) ) # Store the PME energy change and acceptance probability. @@ -1482,7 +1486,11 @@ def move(self, context: _openmm.Context) -> list[int]: # Compute the PME acceptance correction. acc_prob = _np.exp( - -self._beta_openmm * (final_energy - initial_energy - dE_RF) + min( + 0.0, + -self._beta_openmm + * (final_energy - initial_energy - dE_RF), + ) ) # Store the PME energy change and acceptance probability.