Skip to content
Merged

Fix CI #2249

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ repos:
- id: ruff-format
- id: ruff-check
args: [--fix]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.20.0
hooks:
- id: blacken-docs
files: ^docs/.*\.(rst|md)$
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.30.1
hooks:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,26 @@ SMIRNOFF force fields can be parsed by the `ForceField` class, which offers meth
# Load a molecule into the OpenFF Molecule object
from openff.toolkit import Molecule
from openff.toolkit.utils import get_data_file_path
sdf_file_path = get_data_file_path('molecules/ethanol.sdf')

sdf_file_path = get_data_file_path("molecules/ethanol.sdf")
molecule = Molecule.from_file(sdf_file_path)

# Create an OpenFF Topology object from the molecule
from openff.toolkit import Topology

topology = Topology.from_molecules(molecule)

# Load the latest OpenFF force field release: version 2.1.0, codename "Sage"
from openff.toolkit import ForceField
forcefield = ForceField('openff-2.3.0.offxml')

forcefield = ForceField("openff-2.3.0.offxml")


# Create an Interchange object for representations in other formats
interchange = forcefield.create_interchange(topology)

# Create an OpenMM system representing the molecule with SMIRNOFF-applied parameters
openmm_system = interchange.to_openmm(topology)

```

Detailed examples of using SMIRNOFF with the toolkit can be found [in the documentation](https://open-forcefield-toolkit.readthedocs.io/en/stable/examples.html).
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
- msgpack-python
- pydantic =2
- qcelemental
- qcportal >=0.50
- qcportal >=0.70
- qcengine
- nbval
- mdtraj
Expand Down
16 changes: 8 additions & 8 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ dependencies:
- msgpack-python
- pydantic =2
- qcelemental
- qcportal >=0.50
- qcportal >=0.70
- qcengine
- nglview
- mdtraj
- nbval
- mypy =2
- types-setuptools
- types-toml
- types-PyYAML
- types-networkx
- types-xmltodict
- types-cachetools
- pip:
- mypy ==2
- types-setuptools
- types-toml
- types-PyYAML
- types-networkx
- types-xmltodict
- types-cachetools
- mongo-types
16 changes: 8 additions & 8 deletions devtools/conda-envs/test_env_no_openeye.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ dependencies:
- msgpack-python
- pydantic =2
- qcelemental
- qcportal >=0.50
- qcportal >=0.70
- qcengine
- nglview
- mypy =2
- types-setuptools
- types-toml
- types-PyYAML
- types-networkx
- types-xmltodict
- types-cachetools
- pip:
- mypy ==2
- types-setuptools
- types-toml
- types-PyYAML
- types-networkx
- types-xmltodict
- types-cachetools
- mongo-types
5 changes: 1 addition & 4 deletions docs/api/toolkits.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,8 @@ The [`toolkit_registry_manager`] context manager allows `GLOBAL_TOOLKIT_REGISTRY
>>> from openff.toolkit.utils import toolkit_registry_manager
>>> print(len(GLOBAL_TOOLKIT_REGISTRY.registered_toolkits))
5
>>> with toolkit_registry_manager(
... ToolkitRegistry([RDKitToolkitWrapper(), AmberToolsToolkitWrapper()])
... ):
>>> with toolkit_registry_manager(ToolkitRegistry([RDKitToolkitWrapper(), AmberToolsToolkitWrapper()])):
... print(len(GLOBAL_TOOLKIT_REGISTRY.registered_toolkits))
...
2

```
Expand Down
13 changes: 10 additions & 3 deletions openff/toolkit/topology/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def add_bond(self, bond: "Bond"):

self._bonds.append(bond)

def to_dict(self) -> dict[str, None | str | int | bool | dict[Any, Any]]:
def to_dict(self) -> dict[str, str | int | bool | dict[Any, Any] | None]:
"""Return a dict representation of the :class:`Atom` class instance.

Output dictionary keys and values align with parameters used to initialize
Expand Down Expand Up @@ -1170,7 +1170,14 @@ def to_dict(self) -> dict:
# https://mypy.readthedocs.io/en/latest/typed_dict.html#typeddict
molecule_dict: dict[
str,
str | bytes | dict[str, Any] | list[str] | list[bytes] | list[HierarchyElement] | list[dict[str, Any]] | None,
str
| bytes
| dict[str, Any]
| list[str]
| list[bytes]
| list[HierarchyElement]
| list[dict[str, Any]]
| None,
] = dict()
molecule_dict["name"] = self._name

Expand Down Expand Up @@ -1953,7 +1960,7 @@ def are_isomorphic(
bond_stereochemistry_matching: bool = True,
strip_pyrimidal_n_atom_stereo: bool = True,
toolkit_registry: TKR = GLOBAL_TOOLKIT_REGISTRY,
) -> tuple[bool, None | dict[int, int]]:
) -> tuple[bool, dict[int, int] | None]:
"""
Determine if ``mol1`` is isomorphic to ``mol2``.

Expand Down
4 changes: 2 additions & 2 deletions openff/toolkit/topology/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ def from_openmm(
cls,
openmm_topology: "openmm.app.Topology",
unique_molecules: Iterable[FrozenMolecule] | None = None,
positions: Union[None, Quantity, "OMMQuantity"] = None,
positions: Union[Quantity, "OMMQuantity", None] = None,
) -> "Topology":
"""
Construct an OpenFF Topology object from an OpenMM Topology object.
Expand Down Expand Up @@ -2124,7 +2124,7 @@ def from_mdtraj(
cls,
mdtraj_topology: "mdtraj.Topology",
unique_molecules: Iterable[MoleculeLike] | None = None,
positions: Union[None, "OMMQuantity", Quantity] = None,
positions: Union["OMMQuantity", Quantity, None] = None,
):
"""
Construct an OpenFF ``Topology`` from an MDTraj ``Topology``
Expand Down
Loading