Skip to content

Commit

Permalink
Fix incorrect assignment of TIP3P parameters in Sage (#1200) (#1220)
Browse files Browse the repository at this point in the history
* Add test for TIP3P charges with Sage

* Do not uniquify SMARTS in LibraryChargeHandler

* Also test standalone TIP3P file

* Consolidate tip3p charge tests

* black

* Update release history

Co-authored-by: j-wags <jwagnerjpl@gmail.com>

Co-authored-by: j-wags <jwagnerjpl@gmail.com>
  • Loading branch information
mattwthompson and j-wags authored Mar 23, 2022
1 parent a8d8b09 commit f297b64
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
11 changes: 11 additions & 0 deletions docs/releasehistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ print(value_roundtrip)
- [PR #1213](https://github.com/openforcefield/openff-toolkit/pull/1213): Removes
`Topology.charge_model` and `Topology.fractional_bond_order_model`.

### Critical bugfixes

- [PR #1200](https://github.com/openforcefield/openforcefield/pull/1200): Fixes a bug
([Issue #1199](https://github.com/openforcefield/openff-toolkit/issues/428)) in which library
charges were ignored in some force fields, including `openff-2.0.0` code name "Sage." This resulted in
the TIP3P partial charges included Sage not being applied correctly in versions 0.10.1 and 0.10.2 of the
OpenFF Toolkit. This regression was not present in version 0.10.0 and earlier and therefore is not
believed to have any impact on the fitting or benchmarking of the first release of Sage (version
2.0.0). The change causing regression only affected library charges and therefore no other
parameter types are believed to be affected.

### Behaviors changed and bugfixes

- [PR #1182](https://github.com/openforcefield/openforcefield/pull/1182) and
Expand Down
16 changes: 12 additions & 4 deletions openff/toolkit/tests/test_forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -2430,11 +2430,19 @@ def test_some_charges_from_molecule(self, toolkit_registry, registry_description
q, sigma, epsilon = nonbondedForce.getParticleParameters(particle_index)
assert q != (0.0 * unit.elementary_charge)

def test_library_charges_to_single_water(self):
@pytest.mark.parametrize(
"ff_inputs",
[
[
"test_forcefields/test_forcefield.offxml",
"test_forcefields/tip3p.offxml",
],
["openff-2.0.0.offxml"],
],
)
def test_library_charges_to_single_water(self, ff_inputs):
"""Test assigning charges to one water molecule using library charges"""
ff = ForceField(
"test_forcefields/test_forcefield.offxml", "test_forcefields/tip3p.offxml"
)
ff = ForceField(*ff_inputs)
mol = Molecule.from_file(
get_data_file_path(os.path.join("systems", "monomers", "water.sdf"))
)
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 @@ -4059,7 +4059,7 @@ def from_molecule(cls, molecule):
_INFOTYPE = LibraryChargeType # info type to store
_DEPENDENCIES = [vdWHandler, ElectrostaticsHandler]

def find_matches(self, entity, unique=True):
def find_matches(self, entity, unique=False):
"""Find the elements of the topology/molecule matched by a parameter type.
Parameters
Expand Down

0 comments on commit f297b64

Please # to comment.