diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 9b07baad9..8b0262fe6 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -16,9 +16,6 @@ organisation on `GitHub `__. --------------------------------------------------------------------------------------------- * Please add an item to this CHANGELOG for any new features or bug fixes when creating a PR. -* Fixed :func:`sire.restraints.get_standard_state_correction` to be consistent with the definition of - the "force constanst" as ``F = 2 ** k ** x`` (rather than ``F = k ** x``). Updated docstrings and - restraints documentation to make it clear how the force constants are defined. * Fixed instantiaton of ``QByteArray`` in ``Sire::Mol::Frame::toByteArray`` and count bytes with ``QByteArray::size``. * Increase timeout before terminating ``QThread`` objects during ``PageCache`` cleanup. * Expose missing ``timeout`` kwarg in :meth:`dynamics.minimise()` method. @@ -27,6 +24,10 @@ organisation on `GitHub `__. * Reload TorchQMForce module if OpenMM platform changes. * Fix calculation of non-equilibrium work when starting from QM state. * Fix stereochemistry in RDKit molecule conversion. +* Fixed :func:`sire.restraints.get_standard_state_correction` to be consistent with the definition of + the "force constanst" as ``F = 2 ** k ** x`` (rather than ``F = k ** x``). Updated docstrings and + restraints documentation to make it clear how the force constants are defined. +* Fix thread safety issue in Sire OpenMM minimiser. `2024.3.0 `__ - October 2024 -------------------------------------------------------------------------------------------- diff --git a/wrapper/Convert/SireOpenMM/openmmminimise.cpp b/wrapper/Convert/SireOpenMM/openmmminimise.cpp index dd5a5f536..500401b4b 100644 --- a/wrapper/Convert/SireOpenMM/openmmminimise.cpp +++ b/wrapper/Convert/SireOpenMM/openmmminimise.cpp @@ -50,6 +50,7 @@ #include // CHAR_BIT #include #include // uint64_t +#include inline auto is_ieee754_nan(double const x) -> bool @@ -91,7 +92,6 @@ inline auto is_ieee754_nan(double const x) #include #include "SireError/errors.h" -#include "SireBase/releasegil.h" #include "SireBase/progressbar.h" #include "SireUnits/units.h" @@ -619,6 +619,8 @@ namespace SireOpenMM double starting_k, double ratchet_scale, double max_constraint_error, double timeout) { + PyThreadState *_save = PyEval_SaveThread(); + if (max_iterations < 0) { max_iterations = std::numeric_limits::max(); @@ -629,8 +631,6 @@ namespace SireOpenMM timeout = std::numeric_limits::max(); } - auto gil = SireBase::release_gil(); - const OpenMM::System &system = context.getSystem(); int num_particles = system.getNumParticles(); @@ -1105,6 +1105,8 @@ namespace SireOpenMM CODELOC); } + PyEval_RestoreThread(_save); + return data.getLog().join("\n"); }