Skip to content

Commit

Permalink
Fix 1757 (#1758)
Browse files Browse the repository at this point in the history
* Handle `None` version

* Test #1757

* Syntax
  • Loading branch information
mattwthompson authored Nov 2, 2023
1 parent dcd78c9 commit 64621ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions openff/toolkit/_tests/test_forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,23 @@ class BogusHandler(ParameterHandler):

assert force_field["bogus"] is not None

def test_handy_handler_creation(self):
"""See issue #1757"""
for key in [
"vdW",
"Electrostatics",
"ToolkitAM1BCC",
"LibraryCharges",
"ChargeIncrementModel",
"Bonds",
"Angles",
"ProperTorsions",
"ImproperTorsions",
"VirtualSites",
"GBSA",
]:
ForceField().get_parameter_handler(key)


class TestForceFieldPluginLoading:
def test_handlers_tracked_if_already_loaded(self):
Expand Down
4 changes: 3 additions & 1 deletion openff/toolkit/typing/engines/smirnoff/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,9 @@ def to_dict(
)

def __init__(self, **kwargs):
if Version(str(kwargs.get("version"))) > Version("0.3"):
if kwargs.get("version") is None:
kwargs["version"] = 0.5
elif Version(str(kwargs.get("version"))) > Version("0.3"):
if "method" in kwargs:
raise SMIRNOFFSpecError(
"`method` attribute has been removed in version 0.4 of the vdW tag. Use "
Expand Down

0 comments on commit 64621ae

Please sign in to comment.