Skip to content

Commit

Permalink
Do not assume "method" keyword argument specified in vdWHandler 0.3 (
Browse files Browse the repository at this point in the history
…#1689)

* Do not assume "method" keyword argument specified

* Update release history

---------

Co-authored-by: Jeff Wagner <[email protected]>
  • Loading branch information
mattwthompson and j-wags authored Aug 8, 2023
1 parent f1f2fa2 commit 91120f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/releasehistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +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


## 0.14.3

### Bugfixes

- [PR #1689](https://github.com/openforcefield/openff-toolkit/pull/1689): Fixes [#1688](https://github.com/openforcefield/openff-toolkit/issues/1688) in which automatic up-conversion of version 0.3 of `vdWHandler` created via the Python API errored out if `method` was not specified.
- [PR #1690](https://github.com/openforcefield/openff-toolkit/pull/1690): Fixes a circular-import bug that occurs when attempting to print a "no cheminformatics toolkits available" warning.


## 0.14.2

### Behavior changes
Expand Down
9 changes: 9 additions & 0 deletions openff/toolkit/_tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1759,6 +1759,15 @@ def test_upconversion(self):
# https://github.com/openforcefield/openff-toolkit/issues/1680
pytest.skip("ParameterAttribute.__delete__ not implemented")

def test_issue_1668(self):
"""Reproduce https://github.com/openforcefield/openff-toolkit/issues/1688"""
handler1 = vdWHandler(version=0.3)
handler2 = vdWHandler(version=0.3, method="cutoff")

assert handler1.version == handler2.version
assert handler1.periodic_method == handler2.periodic_method
assert handler1.nonperiodic_method == handler2.nonperiodic_method

def test_upconversion_unknown_kwarg(self):
with pytest.raises(
NotImplementedError,
Expand Down
2 changes: 1 addition & 1 deletion openff/toolkit/typing/engines/smirnoff/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@ def __init__(self, **kwargs):
logger.info("Attempting to up-convert vdW section from 0.3 to 0.4")

# This is the only supported value of "method" is version 0.3
if kwargs.get("method") == "cutoff":
if kwargs.get("method") in ("cutoff", None):
kwargs["periodic_method"] = "cutoff"
kwargs["nonperiodic_method"] = "no-cutoff"
kwargs["version"] = 0.4
Expand Down

0 comments on commit 91120f4

Please sign in to comment.