Skip to content

Commit

Permalink
Another simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Oct 1, 2024
1 parent e1d9491 commit 94bac50
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions openff/toolkit/typing/engines/smirnoff/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from packaging.version import Version

from openff.toolkit import Quantity, unit
from openff.toolkit import Quantity
from openff.toolkit.typing.engines.smirnoff.io import ParameterIOHandler
from openff.toolkit.typing.engines.smirnoff.parameters import ParameterHandler
from openff.toolkit.typing.engines.smirnoff.plugins import load_handler_plugins
Expand Down Expand Up @@ -1383,9 +1383,7 @@ def get_partial_charges(self, molecule: "Molecule", **kwargs: Any) -> Quantity:
charge calculation to be cached.
"""
from openff.interchange import Interchange

from openff.toolkit import Molecule
from openff.toolkit import Molecule, unit

if not isinstance(molecule, Molecule):
raise ValueError(
Expand All @@ -1396,8 +1394,8 @@ def get_partial_charges(self, molecule: "Molecule", **kwargs: Any) -> Quantity:
return Quantity(
[
c.m
for c in Interchange.from_smirnoff(
force_field=self, topology=[molecule], **kwargs
for c in self.create_interchange(
topology=molecule.to_topology(), **kwargs,
)["Electrostatics"].charges.values()
],
unit.elementary_charge,
Expand Down

0 comments on commit 94bac50

Please sign in to comment.