diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 915311990..8f0c435ae 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -26,6 +26,7 @@ organisation on `GitHub `__. * Add support for boresch restraints to PME. * Port SOMD torsion fix to PME code. * Fix issues with ``atomtype`` and ``atom`` records for dummy atoms in GROMACS topology files. +* Fix issues with positionally restrained atoms in perturbable systems. `2024.2.0 `__ - June 2024 diff --git a/tests/convert/test_openmm_restraints.py b/tests/convert/test_openmm_restraints.py index 7f2b5ee2e..c7dcd8bf7 100644 --- a/tests/convert/test_openmm_restraints.py +++ b/tests/convert/test_openmm_restraints.py @@ -6,8 +6,12 @@ "openmm" not in sr.convert.supported_formats(), reason="openmm support is not available", ) -def test_openmm_positional_restraints(kigaki_mols, openmm_platform): - mols = kigaki_mols +@pytest.mark.parametrize("molecules", ["kigaki_mols", "merged_ethane_methanol"]) +def test_openmm_positional_restraints(molecules, openmm_platform, request): + mols = request.getfixturevalue(molecules) + + if mols[0].is_perturbable(): + mols = sr.morph.link_to_reference(mols) mol = mols[0] diff --git a/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp b/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp index 684b9a58b..60228871a 100644 --- a/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp +++ b/wrapper/Convert/SireOpenMM/sire_to_openmm_system.cpp @@ -315,7 +315,8 @@ void _add_positional_restraints(const SireMM::PositionalRestraints &restraints, auto ghost_nonghostff = lambda_lever.getForce("ghost/non-ghost", system); std::vector custom_params = {1.0, 0.0, 0.0}; - std::vector custom_clj_params = {0.0, 0.0, 0.0, 0.0}; + // Define null parameters used to add these particles to the ghost forces (5 total) + std::vector custom_clj_params = {0.0, 0.0, 0.0, 0.0, 0.0}; // we need to add all of the positions as anchor particles for (const auto &restraint : atom_restraints)