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

Test against openff-interchange-0.4.0beta1 #1930

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions devtools/conda-envs/conda.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: latest-deployment
channels:
- conda-forge/label/openff-interchange_rc
- conda-forge
dependencies:
# Base depends
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/conda_oe.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: latest-deployment
channels:
- conda-forge/label/openff-interchange_rc
- conda-forge
- openeye
dependencies:
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/installer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: constructor

channels:
- conda-forge/label/openff-interchange_rc
- defaults
- conda-forge

Expand Down
7 changes: 5 additions & 2 deletions devtools/conda-envs/openeye-examples.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: openeye-examples
channels:
- conda-forge/label/openff-interchange_rc
- openeye
- conda-forge
dependencies:
# Base depends
- python
- pydantic =1
- pydantic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both packaging and testing yamls, should we set this to pydantic >2? Or is it redundant since it will be impossible to install this with a pydantic-1-compatible Interchange?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I think pydantic >2/pydantic >=2 would be unwise since that bets on current builds being compatible with Pydantic v3+ out of the box, which I don't trust. pydantic =2 should be fine, if a little redundant since the toolkit itself has no direct opinions on Pydantic compatibility
  • Yes, installing v1 (install-time/packaging level) will be impossible with Interchange 0.4

- packaging
- numpy
- networkx
Expand All @@ -19,7 +20,7 @@ dependencies:
- openff-amber-ff-ports >=0.0.3
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.19
- openff-interchange-base >=0.4.0beta1
- openff-nagl-base ~=0.4.0
- openff-nagl-models ==0.3.0
- typing_extensions
Expand All @@ -43,3 +44,5 @@ dependencies:
- pdbfixer
- openmmforcefields >=0.11.2
- gromacs >=2023.3
- pip:
- git+https://github.com/openforcefield/openff-interchange.git@fix-1052
7 changes: 5 additions & 2 deletions devtools/conda-envs/openeye.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: openff-toolkit-test-openeye
channels:
- conda-forge/label/openff-interchange_rc
- openeye
- conda-forge
dependencies:
# Base depends
- python
- pydantic =1
- pydantic
- packaging
- numpy
- networkx
Expand All @@ -19,7 +20,7 @@ dependencies:
- openff-units =0.2.0
- openff-amber-ff-ports
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.19
- openff-interchange-base >=0.4.0beta1
- openff-nagl-base ~=0.4.0
- openff-nagl-models ==0.3.0
- typing_extensions
Expand All @@ -40,3 +41,5 @@ dependencies:
- mdtraj
- nglview
- parmed =3
- pip:
- git+https://github.com/openforcefield/openff-interchange.git@fix-1052
7 changes: 5 additions & 2 deletions devtools/conda-envs/rdkit-examples.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: rdkit-examples
channels:
- conda-forge/label/openff-interchange_rc
- conda-forge
dependencies:
# Base depends
- python
- pydantic =1
- pydantic
- packaging
- numpy
- networkx
Expand All @@ -18,7 +19,7 @@ dependencies:
- openff-amber-ff-ports >=0.0.3
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.19
- openff-interchange-base >=0.4.0beta1
- openff-nagl-base ~=0.4.0
- openff-nagl-models ==0.3.0
- typing_extensions
Expand All @@ -45,3 +46,5 @@ dependencies:
- pdbfixer
- openmmforcefields >=0.11.2
- gromacs >=2023.3
- pip:
- git+https://github.com/openforcefield/openff-interchange.git@fix-1052
7 changes: 5 additions & 2 deletions devtools/conda-envs/rdkit.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: openff-toolkit-test-rdkit
channels:
- conda-forge/label/openff-interchange_rc
- conda-forge
dependencies:
# Base depends
- python
- pydantic =1
- pydantic
- packaging
- numpy
- networkx
Expand All @@ -18,7 +19,7 @@ dependencies:
- openff-units =0.2.0
- openff-amber-ff-ports
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.19
- openff-interchange-base >=0.4.0beta1
- openff-nagl-base ~=0.4.0
- openff-nagl-models ==0.3.0
- typing_extensions
Expand All @@ -39,3 +40,5 @@ dependencies:
- qcportal >=0.50
- qcengine
- nglview
- pip:
- git+https://github.com/openforcefield/openff-interchange.git@fix-1052
1 change: 1 addition & 0 deletions devtools/conda-envs/release-build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: release-build
channels:
- conda-forge/label/openff-interchange_rc
- conda-forge

dependencies:
Expand Down
6 changes: 4 additions & 2 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: openff-toolkit-test
channels:
- conda-forge/label/openff-interchange_rc
- openeye
- conda-forge
dependencies:
Expand All @@ -19,7 +20,7 @@ dependencies:
- openff-units =0.2.0
- openff-amber-ff-ports
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.19
- openff-interchange-base >=0.4.0beta1
- openff-nagl-base ~=0.4.0
- openff-nagl-models ==0.3.0
# Toolkit-specific
Expand Down Expand Up @@ -47,7 +48,7 @@ dependencies:
- nomkl
- mypy
- typing_extensions
- pydantic =1
- pydantic
- pip:
- types-setuptools
- types-toml
Expand All @@ -56,3 +57,4 @@ dependencies:
- types-xmltodict
- types-cachetools
- mongo-types
- git+https://github.com/openforcefield/openff-interchange.git@fix-1052
12 changes: 3 additions & 9 deletions openff/toolkit/_tests/test_forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -4015,6 +4015,8 @@ def test_fractional_bondorder_invalid_interpolation_method(self):
Ensure that requesting an invalid interpolation method leads to a
FractionalBondOrderInterpolationMethodUnsupportedError
"""
from pydantic import ValidationError

mol = create_ethanol()

forcefield = ForceField(
Expand All @@ -4025,18 +4027,10 @@ def test_fractional_bondorder_invalid_interpolation_method(self):
)._fractional_bondorder_interpolation = "invalid method name"
topology = Topology.from_molecules([mol])

# This error will be either from v1 of the package (if v1 is installed)
# or the faked v1 API (if v2 is installed). Ensure the v1 error or a
# mimick of it is imported
try:
from pydantic.v1 import ValidationError
except ImportError:
from pydantic import ValidationError

# If important, this can be a custom exception instead of a verbose ValidationError
with pytest.raises(
ValidationError,
match="given=invalid method name",
match="Input should be 'linear'.*input_value='invalid method name'",
):
forcefield.create_openmm_system(
topology,
Expand Down
6 changes: 2 additions & 4 deletions openff/toolkit/typing/engines/smirnoff/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,6 @@ def get_partial_charges(self, molecule: "Molecule", **kwargs: Any) -> Quantity:
charge calculation to be cached.

"""
from openff.interchange import Interchange

from openff.toolkit import Molecule, unit

if not isinstance(molecule, Molecule):
Expand All @@ -1396,8 +1394,8 @@ def get_partial_charges(self, molecule: "Molecule", **kwargs: Any) -> Quantity:
return Quantity(
[
c.m
for c in Interchange.from_smirnoff(
force_field=self, topology=[molecule], **kwargs
for c in self.create_interchange(
topology=molecule.to_topology(), **kwargs,
)["Electrostatics"].charges.values()
],
unit.elementary_charge,
Expand Down
Loading