Skip to content

Commit

Permalink
Fixed thread safety issue in Sire OpenMM minimiser.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Nov 8, 2024
1 parent 39fc304 commit 5793db2
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/somd2/runner/_repex.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,23 +557,12 @@ def _minimise(self, index):
"""
_logger.info(f"Minimising at {_lam_sym} = {self._lambda_values[index]:.5f}")

# Note: For now we minimise with the LocalEnergyMinimizer in OpenMM
# since dynamics.minimise() is not thread safe.

try:
from openmm import LocalEnergyMinimizer

# Get the dynamics object.
dynamics = self._dynamics_cache.get(index)

# Get the context.
context = dynamics.context()

# Minimise.
LocalEnergyMinimizer.minimize(context)

# Clear the internal dynamics state.
dynamics._d._clear_state()
dynamics.minimise(timeout=self._config.timeout)

except Exception as e:
return False, index, e
Expand Down

0 comments on commit 5793db2

Please sign in to comment.