From 060325a2835f97d9bf529222a1b756d422eb0219 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 9 Dec 2024 10:26:44 +0000 Subject: [PATCH 1/2] Fix update of triclinic box vectors. [closes #265] --- corelib/src/libs/SireMove/openmmfrenergydt.cpp | 12 +++++++----- corelib/src/libs/SireMove/openmmfrenergyst.cpp | 7 ------- corelib/src/libs/SireMove/openmmmdintegrator.cpp | 11 ++++++----- corelib/src/libs/SireMove/openmmpmefep.cpp | 7 ------- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/corelib/src/libs/SireMove/openmmfrenergydt.cpp b/corelib/src/libs/SireMove/openmmfrenergydt.cpp index d8e20ca92..8d2cee119 100644 --- a/corelib/src/libs/SireMove/openmmfrenergydt.cpp +++ b/corelib/src/libs/SireMove/openmmfrenergydt.cpp @@ -1228,9 +1228,9 @@ void OpenMMFrEnergyDT::integrate(IntegratorWorkspace &workspace, const Symbol &n // Set Periodic Box Condition - context_openmm.setPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), - OpenMM::Vec3(0, Box_y_Edge_Length, 0), - OpenMM::Vec3(0, 0, Box_z_Edge_Length)); + system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), + OpenMM::Vec3(0, Box_y_Edge_Length, 0), + OpenMM::Vec3(0, 0, Box_z_Edge_Length)); } // TriclinicBox. else if (ptr_sys.property(space_property).isA()) @@ -1253,9 +1253,11 @@ void OpenMMFrEnergyDT::integrate(IntegratorWorkspace &workspace, const Symbol &n const double zy = v2.y() * OpenMM::NmPerAngstrom; const double zz = v2.z() * OpenMM::NmPerAngstrom; - context_openmm.setPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), - OpenMM::Vec3(zx, zy, zz)); + system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), + OpenMM::Vec3(zx, zy, zz)); } + + context_openmm.reinitialize(); } if (Debug) diff --git a/corelib/src/libs/SireMove/openmmfrenergyst.cpp b/corelib/src/libs/SireMove/openmmfrenergyst.cpp index 17481a97f..ded8dcf8f 100644 --- a/corelib/src/libs/SireMove/openmmfrenergyst.cpp +++ b/corelib/src/libs/SireMove/openmmfrenergyst.cpp @@ -3450,10 +3450,6 @@ void OpenMMFrEnergyST::createContext(IntegratorWorkspace &workspace, SireUnits:: system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), OpenMM::Vec3(0, Box_y_Edge_Length, 0), OpenMM::Vec3(0, 0, Box_z_Edge_Length)); - - openmm_context->setPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), - OpenMM::Vec3(0, Box_y_Edge_Length, 0), - OpenMM::Vec3(0, 0, Box_z_Edge_Length)); } // TriclinicBox. else if (ptr_sys.property(space_property).isA()) @@ -3478,9 +3474,6 @@ void OpenMMFrEnergyST::createContext(IntegratorWorkspace &workspace, SireUnits:: system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), OpenMM::Vec3(zx, zy, zz)); - - openmm_context->setPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), - OpenMM::Vec3(zx, zy, zz)); } openmm_context->reinitialize(); diff --git a/corelib/src/libs/SireMove/openmmmdintegrator.cpp b/corelib/src/libs/SireMove/openmmmdintegrator.cpp index d4f3b80c6..ee6200919 100644 --- a/corelib/src/libs/SireMove/openmmmdintegrator.cpp +++ b/corelib/src/libs/SireMove/openmmmdintegrator.cpp @@ -1157,9 +1157,9 @@ void OpenMMMDIntegrator::createContext(IntegratorWorkspace &workspace, SireUnits // Set Periodic Box Condition - openmm_context->setPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), - OpenMM::Vec3(0, Box_y_Edge_Length, 0), - OpenMM::Vec3(0, 0, Box_z_Edge_Length)); + system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), + OpenMM::Vec3(0, Box_y_Edge_Length, 0), + OpenMM::Vec3(0, 0, Box_z_Edge_Length)); } // TriclinicBox. else if (ptr_sys.property(space_property).isA()) @@ -1182,11 +1182,12 @@ void OpenMMMDIntegrator::createContext(IntegratorWorkspace &workspace, SireUnits const double zy = v2.y() * OpenMM::NmPerAngstrom; const double zz = v2.z() * OpenMM::NmPerAngstrom; - openmm_context->setPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), - OpenMM::Vec3(zx, zy, zz)); + system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), + OpenMM::Vec3(zx, zy, zz)); } is_periodic = true; + openmm_context->reinitialize(); } double AKMAPerPs = 0.04888821; diff --git a/corelib/src/libs/SireMove/openmmpmefep.cpp b/corelib/src/libs/SireMove/openmmpmefep.cpp index 1332bf8ae..f85086460 100644 --- a/corelib/src/libs/SireMove/openmmpmefep.cpp +++ b/corelib/src/libs/SireMove/openmmpmefep.cpp @@ -2954,10 +2954,6 @@ void OpenMMPMEFEP::createContext(IntegratorWorkspace &workspace, SireUnits::Dime system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), OpenMM::Vec3(0, Box_y_Edge_Length, 0), OpenMM::Vec3(0, 0, Box_z_Edge_Length)); - - openmm_context->setPeriodicBoxVectors(OpenMM::Vec3(Box_x_Edge_Length, 0, 0), - OpenMM::Vec3(0, Box_y_Edge_Length, 0), - OpenMM::Vec3(0, 0, Box_z_Edge_Length)); } // TriclinicBox else if (ptr_sys.property(space_property).isA()) @@ -2983,9 +2979,6 @@ void OpenMMPMEFEP::createContext(IntegratorWorkspace &workspace, SireUnits::Dime system_openmm->setDefaultPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), OpenMM::Vec3(zx, zy, zz)); - - openmm_context->setPeriodicBoxVectors(OpenMM::Vec3(xx, xy, xz), OpenMM::Vec3(yx, yy, yz), - OpenMM::Vec3(zx, zy, zz)); } openmm_context->reinitialize(); From c252141c5aad23e52004af7b077b76bea428faca Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Mon, 9 Dec 2024 10:42:04 +0000 Subject: [PATCH 2/2] Update CHANGELOG. --- doc/source/changelog.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 8b0262fe6..84df9d070 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -16,17 +16,32 @@ organisation on `GitHub `__. --------------------------------------------------------------------------------------------- * Please add an item to this CHANGELOG for any new features or bug fixes when creating a PR. + +* Fixed update of triclinic box vectors in ``SOMD`` following ``OpenMM`` bug fix. + +`2024.3.1 `__ - December 2024 +-------------------------------------------------------------------------------------------- + * 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. + * Expose missing ``include_constrained_energies`` kwarg in minimisation function. + * Make minimisation function settings consistent across API. + * 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