Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-vendor toolkit_registry_manager #722

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mattwthompson
Copy link
Contributor

Developers certificate of origin

I came across #711 and couldn't resist at least a minimal patch. This has the benefit of leaving other stuff in place and the downside of creating a function that doesn't strictly need to exist. The actual usage remains (I think) fairly clean-looking, i.e. as distinct from

diff --git a/openfe/protocols/openmm_afe/equil_solvation_afe_method.py b/openfe/protocols/openmm_afe/equil_solvation_afe_method.py
index 3122b3f..c301bd0 100644
--- a/openfe/protocols/openmm_afe/equil_solvation_afe_method.py
+++ b/openfe/protocols/openmm_afe/equil_solvation_afe_method.py
@@ -38,6 +38,12 @@ import itertools
 import numpy as np
 import numpy.typing as npt
 from openff.units import unit
+from openff.toolkit.utils.toolkits import (
+    toolkit_registry_manager,
+    AmberToolsToolkitWrapper,
+    RDKitToolkitWrapper,
+    ToolkitRegistry,
+)
 from openmmtools import multistate
 from typing import Optional, Union
 from typing import Any, Iterable
@@ -58,7 +64,7 @@ from openfe.protocols.openmm_afe.equil_afe_settings import (
 )
 from ..openmm_utils import system_validation, settings_validation
 from .base import BaseAbsoluteUnit
-from openfe.utils import without_oechem_backend, log_system_probe
+from openfe.utils import log_system_probe
 from openfe.due import due, Doi
 
 
@@ -778,7 +784,9 @@ class AbsoluteSolvationVacuumUnit(BaseAbsoluteUnit):
     ) -> dict[str, Any]:
         log_system_probe(logging.INFO, paths=[ctx.scratch])
 
-        with without_oechem_backend():
+        with toolkit_registry_manager(
+            ToolkitRegistry([RDKitToolkitWrapper, AmberToolsToolkitWrapper()])
+        ):
             outputs = self.run(scratch_basepath=ctx.scratch,
                                shared_basepath=ctx.shared)
 

@pep8speaks
Copy link

pep8speaks commented Feb 13, 2024

Hello @mattwthompson! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-03-01 08:01:44 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants