From cee85d1635f6a08811a88f7edafa94afed0b71a1 Mon Sep 17 00:00:00 2001 From: Jeff Wagner Date: Wed, 26 Apr 2023 09:40:30 -0700 Subject: [PATCH] fix 1583 by kekulizing before reperceiving aromaticity, update releasenotes (#1591) --- docs/releasehistory.md | 1 + openff/toolkit/tests/test_toolkits.py | 9 +++++++++ openff/toolkit/utils/rdkit_wrapper.py | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/releasehistory.md b/docs/releasehistory.md index e4c73d725..d34f961f6 100644 --- a/docs/releasehistory.md +++ b/docs/releasehistory.md @@ -17,6 +17,7 @@ Releases follow the `major.minor.micro` scheme recommended by [PEP440](https://w ### Bugfixes - [PR #1589](https://github.com/openforcefield/openff-toolkit/pull/1589): Fixes [Issue #1579](https://github.com/openforcefield/openff-toolkit/issues/1579), where Molecule.from_polymer_pdb could not handle NH2 caps at C termini. +- [PR #1591](https://github.com/openforcefield/openff-toolkit/pull/1591): Fixes [#1563](https://github.com/openforcefield/openff-toolkit/issues/1563), where `from_rdkit` would sometimes raise an error about radicals if a molecule using a non-MDL aromaticity model was provided. ### Improved documentation and warnings diff --git a/openff/toolkit/tests/test_toolkits.py b/openff/toolkit/tests/test_toolkits.py index f982c0847..a32346a9e 100644 --- a/openff/toolkit/tests/test_toolkits.py +++ b/openff/toolkit/tests/test_toolkits.py @@ -2527,6 +2527,15 @@ def test_from_rdkit_radical(self): with pytest.raises(RadicalsNotSupportedError): RDKitToolkitWrapper().from_rdkit(rdmol) + def test_from_rdkit_incompatible_aromaticity(self): + """Test loading an rdmol where the aromaticity was set by a model that disagrees with MDL""" + from rdkit import Chem + + smi = "c2scnc2C" + rdmol = Chem.MolFromSmiles(smi) + Chem.SetAromaticity(rdmol, Chem.AromaticityModel.AROMATICITY_RDKIT) + Molecule.from_rdkit(rdmol) + def test_from_rdkit_transition_metal_radical(self): """Test that parsing an rdmol with a transition metal radical works.""" from rdkit import Chem diff --git a/openff/toolkit/utils/rdkit_wrapper.py b/openff/toolkit/utils/rdkit_wrapper.py index 3f928f579..e82c515da 100644 --- a/openff/toolkit/utils/rdkit_wrapper.py +++ b/openff/toolkit/utils/rdkit_wrapper.py @@ -1790,7 +1790,6 @@ def from_rdkit( ^ Chem.SANITIZE_SETAROMATICITY ^ Chem.SANITIZE_ADJUSTHS ^ Chem.SANITIZE_CLEANUPCHIRALITY - ^ Chem.SANITIZE_KEKULIZE ), ) Chem.SetAromaticity(rdmol, Chem.AromaticityModel.AROMATICITY_MDL)