diff --git a/docs/releasehistory.md b/docs/releasehistory.md index 3a73dfcc..e41babb1 100644 --- a/docs/releasehistory.md +++ b/docs/releasehistory.md @@ -22,6 +22,7 @@ Please note that all releases prior to a version 1.0.0 are considered pre-releas * Several classes and methods which were deprecated in the 0.3 line of releases are now removed. * Previously-deprecated examples are removed. * `ProperTorsionKey` no longer accepts an empty tuple as atom indices. +* Fixes a regression in which some `ElectrostaticsCollection.charges` properties did not return cached values. ## 0.3.30 - 2024-08 diff --git a/openff/interchange/common/_nonbonded.py b/openff/interchange/common/_nonbonded.py index 7bc66281..ecb47d60 100644 --- a/openff/interchange/common/_nonbonded.py +++ b/openff/interchange/common/_nonbonded.py @@ -105,13 +105,13 @@ class ElectrostaticsCollection(_NonbondedCollection): # _charges: dict[Any, _ElementaryChargeQuantity] = PrivateAttr(default_factory=dict) _charges_cached: bool = PrivateAttr(default=False) - @computed_field + @computed_field # type: ignore[misc] @property def charges( self, ) -> dict[TopologyKey | LibraryChargeTopologyKey | VirtualSiteKey, _ElementaryChargeQuantity]: """Get the total partial charge on each atom, including virtual sites.""" - if len(self._charges) == 0 or self._charges_cached is False: + if len(self._charges) == 0 or self._charges_cached is False: # type: ignore[has-type] self._charges = self._get_charges(include_virtual_sites=False) self._charges_cached = True diff --git a/openff/interchange/components/potentials.py b/openff/interchange/components/potentials.py index 9d6b334e..5161f2cb 100644 --- a/openff/interchange/components/potentials.py +++ b/openff/interchange/components/potentials.py @@ -33,7 +33,7 @@ if has_package("jax"): from jax import Array else: - Array = Any + Array = Any # type: ignore class Potential(_BaseModel): diff --git a/openff/interchange/smirnoff/_nonbonded.py b/openff/interchange/smirnoff/_nonbonded.py index 3be641cd..74f360f2 100644 --- a/openff/interchange/smirnoff/_nonbonded.py +++ b/openff/interchange/smirnoff/_nonbonded.py @@ -298,7 +298,7 @@ def _charges_without_virtual_sites( """Get the total partial charge on each atom, excluding virtual sites.""" return self._get_charges(include_virtual_sites=False) - @computed_field + @computed_field # type: ignore[misc] @property def charges( self,