-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from OpenBioSim/backport_244
Backport fixes from PR #244
- Loading branch information
Showing
7 changed files
with
85 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
###################################################################### | ||
# BioSimSpace: Making biomolecular simulation a breeze! | ||
# | ||
# Copyright: 2017-2023 | ||
# Copyright: 2017-2024 | ||
# | ||
# Authors: Lester Hedges <[email protected]> | ||
# | ||
|
@@ -566,7 +566,7 @@ def readMolecules( | |
prop = property_map.get("time", "time") | ||
time = system.property(prop) | ||
system.removeSharedProperty(prop) | ||
system.setProperties(prop, time) | ||
system.setProperty(prop, time) | ||
except: | ||
pass | ||
|
||
|
@@ -1148,6 +1148,24 @@ def readPerturbableSystem(top0, coords0, top1, coords1, property_map={}): | |
# Update the molecule in the original system. | ||
system0.updateMolecules(mol) | ||
|
||
# Remove "space" and "time" shared properties since this causes incorrect | ||
# behaviour when extracting molecules and recombining them to make other | ||
# systems. | ||
try: | ||
# Space. | ||
prop = property_map.get("space", "space") | ||
space = system0._sire_object.property(prop) | ||
system0._sire_object.removeSharedProperty(prop) | ||
system0._sire_object.setProperty(prop, space) | ||
|
||
# Time. | ||
prop = property_map.get("time", "time") | ||
time = system0._sire_object.property(prop) | ||
system0._sire_object.removeSharedProperty(prop) | ||
system0._sire_object.setProperty(prop, time) | ||
except: | ||
pass | ||
|
||
return system0 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
###################################################################### | ||
# BioSimSpace: Making biomolecular simulation a breeze! | ||
# | ||
# Copyright: 2017-2023 | ||
# Copyright: 2017-2024 | ||
# | ||
# Authors: Lester Hedges <[email protected]> | ||
# | ||
|
@@ -37,7 +37,6 @@ | |
|
||
import os as _os | ||
|
||
_parmed = _try_import("parmed") | ||
import queue as _queue | ||
import subprocess as _subprocess | ||
|
||
|
@@ -189,10 +188,6 @@ def run(self, molecule, work_dir=None, queue=None): | |
else: | ||
is_smiles = False | ||
|
||
# The following is adapted from the Open Force Field examples, where an | ||
# OpenFF system is converted to AMBER format files using ParmEd: | ||
# https://github.com/openforcefield/openff-toolkit/blob/master/examples/using_smirnoff_in_amber_or_gromacs/convert_to_amber_gromacs.ipynb | ||
|
||
if is_smiles: | ||
# Convert SMILES string to an OpenFF molecule. | ||
try: | ||
|
@@ -353,7 +348,7 @@ def run(self, molecule, work_dir=None, queue=None): | |
if par_mol.nMolecules() == 1: | ||
par_mol = par_mol.getMolecules()[0] | ||
except Exception as e: | ||
msg = "Failed to read molecule from: 'parmed.prmtop', 'parmed.inpcrd'" | ||
msg = "Failed to read molecule from: 'interchange.prmtop', 'interchange.inpcrd'" | ||
if _isVerbose(): | ||
msg += ": " + getattr(e, "message", repr(e)) | ||
raise IOError(msg) from e | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
###################################################################### | ||
# BioSimSpace: Making biomolecular simulation a breeze! | ||
# | ||
# Copyright: 2017-2023 | ||
# Copyright: 2017-2024 | ||
# | ||
# Authors: Lester Hedges <[email protected]> | ||
# | ||
|
@@ -46,6 +46,7 @@ | |
from .._Config import Amber as _AmberConfig | ||
from .._Exceptions import IncompatibleError as _IncompatibleError | ||
from .._Exceptions import MissingSoftwareError as _MissingSoftwareError | ||
from ..Protocol._free_energy_mixin import _FreeEnergyMixin | ||
from ..Protocol._position_restraint_mixin import _PositionRestraintMixin | ||
from .._SireWrappers import System as _System | ||
from ..Types._type import Type as _Type | ||
|
@@ -126,7 +127,7 @@ def __init__( | |
) | ||
|
||
# Catch unsupported protocols. | ||
if isinstance(protocol, _Protocol.FreeEnergy): | ||
if isinstance(protocol, _FreeEnergyMixin): | ||
raise _IncompatibleError( | ||
"Unsupported protocol: '%s'" % self._protocol.__class__.__name__ | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
###################################################################### | ||
# BioSimSpace: Making biomolecular simulation a breeze! | ||
# | ||
# Copyright: 2017-2023 | ||
# Copyright: 2017-2024 | ||
# | ||
# Authors: Lester Hedges <[email protected]> | ||
# | ||
|
@@ -566,7 +566,7 @@ def readMolecules( | |
prop = property_map.get("time", "time") | ||
time = system.property(prop) | ||
system.removeSharedProperty(prop) | ||
system.setProperties(prop, time) | ||
system.setProperty(prop, time) | ||
except: | ||
pass | ||
|
||
|
@@ -1148,6 +1148,24 @@ def readPerturbableSystem(top0, coords0, top1, coords1, property_map={}): | |
# Update the molecule in the original system. | ||
system0.updateMolecules(mol) | ||
|
||
# Remove "space" and "time" shared properties since this causes incorrect | ||
# behaviour when extracting molecules and recombining them to make other | ||
# systems. | ||
try: | ||
# Space. | ||
prop = property_map.get("space", "space") | ||
space = system0._sire_object.property(prop) | ||
system0._sire_object.removeSharedProperty(prop) | ||
system0._sire_object.setProperty(prop, space) | ||
|
||
# Time. | ||
prop = property_map.get("time", "time") | ||
time = system0._sire_object.property(prop) | ||
system0._sire_object.removeSharedProperty(prop) | ||
system0._sire_object.setPropery(prop, time) | ||
except: | ||
pass | ||
|
||
return system0 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
###################################################################### | ||
# BioSimSpace: Making biomolecular simulation a breeze! | ||
# | ||
# Copyright: 2017-2023 | ||
# Copyright: 2017-2024 | ||
# | ||
# Authors: Lester Hedges <[email protected]> | ||
# | ||
|
@@ -37,7 +37,6 @@ | |
|
||
import os as _os | ||
|
||
_parmed = _try_import("parmed") | ||
import queue as _queue | ||
import subprocess as _subprocess | ||
|
||
|
@@ -189,10 +188,6 @@ def run(self, molecule, work_dir=None, queue=None): | |
else: | ||
is_smiles = False | ||
|
||
# The following is adapted from the Open Force Field examples, where an | ||
# OpenFF system is converted to AMBER format files using ParmEd: | ||
# https://github.com/openforcefield/openff-toolkit/blob/master/examples/using_smirnoff_in_amber_or_gromacs/convert_to_amber_gromacs.ipynb | ||
|
||
if is_smiles: | ||
# Convert SMILES string to an OpenFF molecule. | ||
try: | ||
|
@@ -353,7 +348,7 @@ def run(self, molecule, work_dir=None, queue=None): | |
if par_mol.nMolecules() == 1: | ||
par_mol = par_mol.getMolecules()[0] | ||
except Exception as e: | ||
msg = "Failed to read molecule from: 'parmed.prmtop', 'parmed.inpcrd'" | ||
msg = "Failed to read molecule from: 'interchange.prmtop', 'interchange.inpcrd'" | ||
if _isVerbose(): | ||
msg += ": " + getattr(e, "message", repr(e)) | ||
raise IOError(msg) from e | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters