Skip to content

Commit

Permalink
Remove openff.toolkit.typing.chemistry, attempt 2 (#1664)
Browse files Browse the repository at this point in the history
* Revert "Revert "Remove `openff.toolkit.typing.chemistry` (#1509)" (#1663)"

This reverts commit 1456fe0.

* update releasehistory
  • Loading branch information
j-wags authored Jul 31, 2023
1 parent b7f33e0 commit 794b699
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 519 deletions.
1 change: 1 addition & 0 deletions docs/releasehistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Releases follow the `major.minor.micro` scheme recommended by [PEP440](https://w
## Current development

### API-breaking changes
- [PR #1664](https://github.com/openforcefield/openff-toolkit/pull/1664): Removes `ChemicalEnvironment` and the entire `openff.toolkit.typing.chemistry` submodule, which was deprecated in 0.12.0.

### Behavior changes
- [PR #1675](https://github.com/openforcefield/openff-toolkit/pull/1675): Makes InChI parsing failures more informative and gives them their own exception type, `InChIParseError`.
Expand Down
13 changes: 0 additions & 13 deletions docs/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
Force field typing tools
========================

Chemical environments
---------------------

Tools for representing and operating on chemical environments

.. currentmodule:: openff.toolkit.typing.chemistry
.. autosummary::
:nosignatures:
:toctree: api/generated/

ChemicalEnvironment


Force field typing engines
--------------------------

Expand Down
212 changes: 0 additions & 212 deletions openff/toolkit/_tests/test_chemicalenvironment.py

This file was deleted.

7 changes: 0 additions & 7 deletions openff/toolkit/_tests/test_molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3207,13 +3207,6 @@ def test_add_atoms_and_bonds(self, molecule):

assert molecule == molecule_copy

def test_chemical_environment_old_arg(self):
from openff.toolkit.typing.chemistry import ChemicalEnvironment

molecule = create_ethanol()
with pytest.raises(ValueError, match="'query' must be a SMARTS"):
molecule.chemical_environment_matches(ChemicalEnvironment("[*:1]"))

@requires_openeye
def test_chemical_environment_matches_OE(self):
"""Test chemical environment matches"""
Expand Down
19 changes: 0 additions & 19 deletions openff/toolkit/_tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,25 +820,6 @@ def test_create(self):
p2 = ParameterType(smirks="[#1:1]")
ParameterList([p1, p2])

@pytest.mark.wip(
reason="Until ChemicalEnvironment won't be refactored to use the ToolkitRegistry "
"API, the smirks assignment will fail with RDKit."
)
def test_getitem(self):
"""Test ParameterList __getitem__ overloading."""
p1 = ParameterType(smirks="[*:1]")
p2 = ParameterType(smirks="[#1:1]")
parameters = ParameterList([p1, p2])
assert parameters[0] == p1
assert parameters[1] == p2
assert parameters[p1.smirks] == p1
assert parameters[p2.smirks] == p2

# Note that this call access __getitem__, not __setitem__.
parameters["[*:1]"].smirks = "[*X4:1]"
assert parameters[0].smirks == "[*X4:1]"
assert p1.smirks == "[*X4:1]"

def test_index(self):
"""
Tests the ParameterList.index() function by attempting lookups by SMIRKS and by ParameterType equivalence.
Expand Down
9 changes: 2 additions & 7 deletions openff/toolkit/topology/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -3531,26 +3531,21 @@ def chemical_environment_matches(
``chemical_environment_matches``
"""
if isinstance(query, str):
smirks = query
else:
raise ValueError("'query' must be a SMARTS/SMIRKS string")

# Use specified cheminformatics toolkit to determine matches with specified aromaticity model
# TODO: Simplify this by requiring a toolkit registry for the molecule?
# TODO: Do we have to pass along an aromaticity model?
if isinstance(toolkit_registry, ToolkitRegistry):
matches = toolkit_registry.call(
"find_smarts_matches",
self,
smirks,
query,
unique=unique,
raise_exception_types=[],
)
elif isinstance(toolkit_registry, ToolkitWrapper):
matches = toolkit_registry.find_smarts_matches( # type: ignore[attr-defined]
self,
smirks,
query,
unique=unique,
)
else:
Expand Down
10 changes: 0 additions & 10 deletions openff/toolkit/typing/chemistry/__init__.py

This file was deleted.

Loading

0 comments on commit 794b699

Please sign in to comment.