Skip to content

Commit

Permalink
Standardize typing and 0.13.2 releasenotes (#1646)
Browse files Browse the repository at this point in the history
* 0.13.2 releasenotes

* Pin `openff-units=0.2.0`

* fix ff.get_partial_charges return type

* clean up type annotations so they don't have import paths

* fix unnecessary imports identified by flake8

---------

Co-authored-by: Matthew W. Thompson <mattwthompson@protonmail.com>
  • Loading branch information
j-wags and mattwthompson authored Jun 19, 2023
1 parent cbc9bf4 commit e84d92e
Show file tree
Hide file tree
Showing 19 changed files with 91 additions and 106 deletions.
2 changes: 1 addition & 1 deletion devtools/conda-envs/beta_rc_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- openmm >=7.6
- openff-forcefields >=2023.05.1
- smirnoff99Frosst
- openff-units >=0.2
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.2
- openff-nagl >=0.2.2
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/openeye-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- openff-forcefields >=2023.05.1
- smirnoff99Frosst
- openff-amber-ff-ports >=0.0.3
- openff-units >=0.2
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.3
- openff-nagl >=0.2.2
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/openeye.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- openmm >=7.6
- openff-forcefields >=2023.05.1
- smirnoff99Frosst
- openff-units >=0.2
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.3
- openff-nagl >=0.2.2
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/rdkit-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- openff-forcefields >=2023.05.1
- smirnoff99Frosst
- openff-amber-ff-ports >=0.0.3
- openff-units >=0.2
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.3
- openff-nagl >=0.2.2
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/rdkit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
- openmm >=7.6
- openff-forcefields >=2023.05.1
- smirnoff99Frosst
- openff-units >=0.2
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.3
- openff-nagl >=0.2.2
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- openmm >=7.6
- openff-forcefields >=2023.05.1
- smirnoff99Frosst
- openff-units >=0.2
- openff-units =0.2.0
- openff-utilities >=0.1.5
- openff-interchange-base >=0.3.3
- openff-nagl >=0.2.2
Expand Down
10 changes: 2 additions & 8 deletions docs/releasehistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@ Releases follow the `major.minor.micro` scheme recommended by [PEP440](https://w
* `minor` increments add features but do not break API compatibility
* `micro` increments represent bugfix releases or improvements in documentation

## Current development

### Behavior changes
## 0.13.2

### Bugfixes

- [PR #1640](https://github.com/openforcefield/openff-toolkit/pull/1640): Fixes issue [#1633](https://github.com/openforcefield/openff-toolkit/issues/1633) in which some force field attributes were erroneously parsed as `Quantity` objects and issue [#1635](https://github.com/openforcefield/openff-toolkit/issues/1635) in which OpenFF 2.1.0 ("Sage") could not be loaded with Pint 0.22.

### New features

### Improved documentation and warnings
- [PR #1636](https://github.com/openforcefield/openff-toolkit/pull/1636): Make the Molecule Cookbook only pull down QCF records with fully defined stereo.


### Examples updates
- [PR #1636](https://github.com/openforcefield/openff-toolkit/pull/1636) and [PR #1643](https://github.com/openforcefield/openff-toolkit/pull/1643): Make the Molecule Cookbook and `Molecule.from_qcschema` docstring only pull down QCF records with fully defined stereo.


## 0.13.1
Expand Down
18 changes: 9 additions & 9 deletions openff/toolkit/tests/mocking.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import numpy
from openff.units import unit
from openff.units import Quantity, unit

from openff.toolkit.topology import Molecule
from openff.toolkit.typing.engines.smirnoff import VirtualSiteHandler


class VirtualSiteMocking:
@staticmethod
def sp1_conformer() -> unit.Quantity:
return unit.Quantity(
def sp1_conformer() -> Quantity:
return Quantity(
numpy.array(
[
[-2.0, +0.0, +0.0],
Expand All @@ -21,8 +21,8 @@ def sp1_conformer() -> unit.Quantity:
)

@staticmethod
def sp2_conformer() -> unit.Quantity:
return unit.Quantity(
def sp2_conformer() -> Quantity:
return Quantity(
numpy.array(
[
[+1.0, +0.0, +0.0],
Expand All @@ -35,12 +35,12 @@ def sp2_conformer() -> unit.Quantity:
)

@staticmethod
def sp3_conformer() -> unit.Quantity:
def sp3_conformer() -> Quantity:
"""Returns the conformer of a dummy tetrahedral molecule with the
first atom positioned at (0, 1, 0), the second atom at (0, 0, 0) and
the remaining atoms at the corners of the tetrahedron.
"""
return unit.Quantity(
return Quantity(
numpy.array(
[
[+0.0, +1.0, +0.0],
Expand All @@ -61,7 +61,7 @@ def bond_charge_parameter(
type="BondCharge",
smirks=smirks,
name=name,
charge_increment=unit.Quantity(
charge_increment=Quantity(
[0.1 * param_multiple, 0.2 * param_multiple],
unit.elementary_charge,
),
Expand Down Expand Up @@ -93,7 +93,7 @@ def divalent_parameter(
smirks: str,
match: str,
name: str = "EP",
angle: unit.Quantity = 0.0 * unit.degree,
angle: Quantity = 0.0 * unit.degree,
) -> VirtualSiteHandler.VirtualSiteType:
return VirtualSiteHandler.VirtualSiteType(
type="DivalentLonePair",
Expand Down
6 changes: 3 additions & 3 deletions openff/toolkit/tests/test_toolkit_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np
import pytest
from numpy.testing import assert_allclose
from openff.units import unit
from openff.units import Quantity, unit

from openff.toolkit.tests import create_molecules
from openff.toolkit.tests.utils import requires_openeye, requires_rdkit
Expand Down Expand Up @@ -72,7 +72,7 @@
$$$$
"""

CAFFEINE_2D_COORDS = unit.Quantity(
CAFFEINE_2D_COORDS = Quantity(
np.array(
[
(-1.1875, -9.6542, 0.0000),
Expand Down Expand Up @@ -277,7 +277,7 @@
$$$$
"""

CAFFEINE_3D_COORDS = unit.Quantity(
CAFFEINE_3D_COORDS = Quantity(
np.array(
[
(0.4700, 2.5688, 0.0006),
Expand Down
36 changes: 18 additions & 18 deletions openff/toolkit/tests/test_toolkits.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np
import pytest
from numpy.testing import assert_almost_equal
from openff.units import unit
from openff.units import Quantity, unit

from openff.toolkit.tests.create_molecules import (
create_acetaldehyde,
Expand Down Expand Up @@ -261,9 +261,9 @@ def formic_acid_molecule() -> Molecule:


@pytest.fixture()
def formic_acid_conformers() -> Dict[str, unit.Quantity]:
def formic_acid_conformers() -> Dict[str, Quantity]:
return {
"cis": unit.Quantity(
"cis": Quantity(
np.array(
[
[-0.95927322, -0.91789997, 0.36333418],
Expand All @@ -275,7 +275,7 @@ def formic_acid_conformers() -> Dict[str, unit.Quantity]:
),
unit.angstrom,
),
"trans": unit.Quantity(
"trans": Quantity(
np.array(
[
[-0.95927322, -0.91789997, 0.36333418],
Expand Down Expand Up @@ -382,7 +382,7 @@ def test_to_from_openeye_core_props_filled(self):

# Populate core molecule property fields
molecule.name = "Alice"
partial_charges = unit.Quantity(
partial_charges = Quantity(
np.array(
[
-0.9,
Expand All @@ -408,7 +408,7 @@ def test_to_from_openeye_core_props_filled(self):
unit.elementary_charge,
)
molecule.partial_charges = partial_charges
coords = unit.Quantity(
coords = Quantity(
np.array(
[
["0.0", "1.0", "2.0"],
Expand Down Expand Up @@ -584,7 +584,7 @@ def test_to_from_openeye_none_partial_charges(self):

def test_to_openeye_typed_partial_charges(self):
ethanol = create_ethanol()
ethanol.partial_charges = unit.Quantity(
ethanol.partial_charges = Quantity(
np.zeros(ethanol.n_atoms, dtype=int), unit.elementary_charge
)
oemol = ethanol.to_openeye()
Expand Down Expand Up @@ -973,7 +973,7 @@ def test_write_pdb_preserving_atom_order(self):
water.add_bond(0, 1, 1, False)
water.add_bond(1, 2, 1, False)
water.add_conformer(
unit.Quantity(
Quantity(
np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]),
unit.angstrom,
)
Expand Down Expand Up @@ -1150,7 +1150,7 @@ def test_write_multiconformer_mol_as_sdf(self):
toolkit_wrapper = OpenEyeToolkitWrapper()
filename = get_data_file_path("molecules/ethanol.sdf")
ethanol = Molecule.from_file(filename, toolkit_registry=toolkit_wrapper)
ethanol.partial_charges = unit.Quantity(
ethanol.partial_charges = Quantity(
np.array([-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0]),
unit.elementary_charge,
)
Expand Down Expand Up @@ -1217,7 +1217,7 @@ def test_get_mol2_charges(self):
molecule = Molecule.from_file(filename, toolkit_registry=toolkit_wrapper)
assert len(molecule.conformers) == 1
assert molecule.conformers[0].shape == (15, 3)
target_charges = unit.Quantity(
target_charges = Quantity(
np.array(
[
-0.1342,
Expand Down Expand Up @@ -1349,7 +1349,7 @@ def test_apply_elf_conformer_selection(self):

initial_conformers = [
# Add a conformer with an internal H-bond.
unit.Quantity(
Quantity(
np.array(
[
[0.5477, 0.3297, -0.0621],
Expand All @@ -1366,7 +1366,7 @@ def test_apply_elf_conformer_selection(self):
unit.angstrom,
),
# Add a conformer without an internal H-bond.
unit.Quantity(
Quantity(
np.array(
[
[0.5477, 0.3297, -0.0621],
Expand Down Expand Up @@ -2271,7 +2271,7 @@ def test_to_from_rdkit_core_props_filled(self):

# Populate core molecule property fields
molecule.name = "Alice"
partial_charges = unit.Quantity(
partial_charges = Quantity(
np.array(
[
-0.9,
Expand All @@ -2297,7 +2297,7 @@ def test_to_from_rdkit_core_props_filled(self):
unit.elementary_charge,
)
molecule.partial_charges = partial_charges
coords = unit.Quantity(
coords = Quantity(
np.array(
[
["0.0", "1.0", "2.0"],
Expand Down Expand Up @@ -2749,7 +2749,7 @@ def test_write_multiconformer_mol_as_sdf(self):
toolkit_wrapper = RDKitToolkitWrapper()
filename = get_data_file_path("molecules/ethanol.sdf")
ethanol = Molecule.from_file(filename, toolkit_registry=toolkit_wrapper)
ethanol.partial_charges = unit.Quantity(
ethanol.partial_charges = Quantity(
np.array([-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0]),
unit.elementary_charge,
)
Expand Down Expand Up @@ -3042,7 +3042,7 @@ def test_elf_select_diverse_conformers(
self,
formic_acid_molecule: Molecule,
expected_conformer_map: Dict[int, int],
rms_tolerance: unit.Quantity,
rms_tolerance: Quantity,
):
"""Test the greedy selection of 'diverse' ELF conformers."""

Expand Down Expand Up @@ -3077,7 +3077,7 @@ def test_apply_elf_conformer_selection(self):

initial_conformers = [
# Add a conformer with an internal H-bond.
unit.Quantity(
Quantity(
np.array(
[
[0.5477, 0.3297, -0.0621],
Expand All @@ -3094,7 +3094,7 @@ def test_apply_elf_conformer_selection(self):
unit.angstrom,
),
# Add a conformer without an internal H-bond.
unit.Quantity(
Quantity(
np.array(
[
[0.5477, 0.3297, -0.0621],
Expand Down
Loading

0 comments on commit e84d92e

Please sign in to comment.