From 50b5bb6092bc61b4204e8b3b918b4e120251ea65 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Thu, 22 Feb 2024 13:30:29 +0000 Subject: [PATCH] Recover missing molecule0 and molecule1 properties. [closes #248] --- .../Exscientia/_SireWrappers/_molecule.py | 28 ++++--------------- python/BioSimSpace/_SireWrappers/_molecule.py | 28 ++++--------------- 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py b/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py index 80ed3de08..7da921f96 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py +++ b/python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_molecule.py @@ -80,13 +80,16 @@ def __init__(self, molecule): if isinstance(molecule, _SireMol._Mol.Molecule): super().__init__(molecule) if self._sire_object.hasProperty("is_perturbable"): - self._convertFromMergedMolecule() + # Flag that the molecule is perturbable. + self._is_perturbable = True + + # Extract the end states. if molecule.hasProperty("molecule0"): - self._molecule = Molecule(molecule.property("molecule0")) + self._molecule0 = Molecule(molecule.property("molecule0")) else: self._molecule0, _ = self._extractMolecule() if molecule.hasProperty("molecule1"): - self._molecule = Molecule(molecule.property("molecule1")) + self._molecule1 = Molecule(molecule.property("molecule1")) else: self._molecule1, _ = self._extractMolecule(is_lambda1=True) @@ -1565,25 +1568,6 @@ def _getPropertyMap1(self): return property_map - def _convertFromMergedMolecule(self): - """Convert from a merged molecule.""" - - # Extract the components of the merged molecule. - try: - mol0 = self._sire_object.property("molecule0") - mol1 = self._sire_object.property("molecule1") - except: - raise _IncompatibleError( - "The merged molecule doesn't have the required properties!" - ) - - # Store the components. - self._molecule0 = Molecule(mol0) - self._molecule1 = Molecule(mol1) - - # Flag that the molecule is perturbable. - self._is_perturbable = True - def _fixCharge(self, property_map={}): """ Make the molecular charge an integer value. diff --git a/python/BioSimSpace/_SireWrappers/_molecule.py b/python/BioSimSpace/_SireWrappers/_molecule.py index 02b662c14..44af7619c 100644 --- a/python/BioSimSpace/_SireWrappers/_molecule.py +++ b/python/BioSimSpace/_SireWrappers/_molecule.py @@ -80,13 +80,16 @@ def __init__(self, molecule): if isinstance(molecule, _SireMol._Mol.Molecule): super().__init__(molecule) if self._sire_object.hasProperty("is_perturbable"): - self._convertFromMergedMolecule() + # Flag that the molecule is perturbable. + self._is_perturbable = True + + # Extract the end states. if molecule.hasProperty("molecule0"): - self._molecule = Molecule(molecule.property("molecule0")) + self._molecule0 = Molecule(molecule.property("molecule0")) else: self._molecule0, _ = self._extractMolecule() if molecule.hasProperty("molecule1"): - self._molecule = Molecule(molecule.property("molecule1")) + self._molecule1 = Molecule(molecule.property("molecule1")) else: self._molecule1, _ = self._extractMolecule(is_lambda1=True) @@ -1521,25 +1524,6 @@ def _getPropertyMap1(self): return property_map - def _convertFromMergedMolecule(self): - """Convert from a merged molecule.""" - - # Extract the components of the merged molecule. - try: - mol0 = self._sire_object.property("molecule0") - mol1 = self._sire_object.property("molecule1") - except: - raise _IncompatibleError( - "The merged molecule doesn't have the required properties!" - ) - - # Store the components. - self._molecule0 = Molecule(mol0) - self._molecule1 = Molecule(mol1) - - # Flag that the molecule is perturbable. - self._is_perturbable = True - def _fixCharge(self, property_map={}): """ Make the molecular charge an integer value.