Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ organisation on `GitHub <https://github.com/openbiosim/sire>`__.

* Fix ``delta`` parameter in soft-core Coulomb potential.

* When possible, use the ``SOMD2`` logger for dynamics warnings.

* Fix recursion bug in :func:`sire.base.wrap()` function.

* Fix :meth:`Dynamics.get_rest2_scale()` method.

`2025.3.0 <https://github.com/openbiosim/sire/compare/2025.2.0...2025.3.0>`__ - November 2025
---------------------------------------------------------------------------------------------

Expand Down
34 changes: 24 additions & 10 deletions src/sire/mol/_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ def __init__(self, mols=None, map=None, **kwargs):
else:
self._pressure = None

# Try importing the SOMD2 logger.
try:
from somd2 import _logger as somd2_logger

self._somd2_logger = somd2_logger
except:
self._somd2_logger = None

def is_null(self):
return self._sire_mols is None

Expand Down Expand Up @@ -754,6 +762,15 @@ def integrator(self):
else:
return self._omm_mols.getIntegrator()

def get_rest2_scale(self):
"""
Return the current REST2 scaling factor.
"""
if self.is_null():
return None
else:
return self._omm_mols.get_rest2_scale()

def info(self):
if self.is_null():
return None
Expand Down Expand Up @@ -953,14 +970,19 @@ def _rebuild_and_minimise(self):

from ..utils import Console

Console.warning(
msg = (
"Something went wrong when running dynamics. The system will be "
"minimised, and then dynamics will be attempted again. If an "
"error still occurs, then it is likely that the step size is too "
"large, the molecules are over-constrained, or there is something "
"more fundemental going wrong..."
"more fundamental going wrong..."
)

if self._somd2_logger is not None:
self._somd2_logger.warning(msg)
else:
Console.warning(msg)

# rebuild the molecules
from ..convert import to

Expand Down Expand Up @@ -1909,16 +1931,8 @@ def get_rest2_scale(self):
"""
Return the current REST2 scaling factor.
"""
if self.is_null():
return None
return self._d.get_rest2_scale()

def set_rest2_scale(self, rest2_scale: float):
"""
Set the current REST2 scaling factor.
"""
self._d.set_rest2_scale(rest2_scale=rest2_scale)

def ensemble(self):
"""
Return the ensemble in which the simulation is being performed
Expand Down