Skip to content

Commit 9c0cc43

Browse files
committed
Clamp exponent to avoid overflow warnings. [ref #8]
1 parent d447e31 commit 9c0cc43

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/loch/_sampler.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,11 @@ def move(self, context: _openmm.Context) -> list[int]:
14011401

14021402
# Compute the PME acceptance correction.
14031403
acc_prob = _np.exp(
1404-
-self._beta_openmm * (final_energy - initial_energy - dE_RF)
1404+
min(
1405+
0.0,
1406+
-self._beta_openmm
1407+
* (final_energy - initial_energy - dE_RF),
1408+
)
14051409
)
14061410

14071411
# Store the PME energy change and acceptance probability.
@@ -1482,7 +1486,11 @@ def move(self, context: _openmm.Context) -> list[int]:
14821486

14831487
# Compute the PME acceptance correction.
14841488
acc_prob = _np.exp(
1485-
-self._beta_openmm * (final_energy - initial_energy - dE_RF)
1489+
min(
1490+
0.0,
1491+
-self._beta_openmm
1492+
* (final_energy - initial_energy - dE_RF),
1493+
)
14861494
)
14871495

14881496
# Store the PME energy change and acceptance probability.

0 commit comments

Comments
 (0)