Skip to content

Commit

Permalink
FIX: Add suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Dec 9, 2024
1 parent 6effa12 commit 356718f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions openff/interchange/components/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ def _simple_topology_from_openmm(
# in associated OpenFF topology, since stripping out virtual sites offsets particle indices
openmm_openff_particle_map: dict[int, int | ImportedVirtualSiteKey] = dict()

# TODO: This is nearly identical to Topology._openmm_topology_to_networkx.
# Should this method be replaced with a direct call to that?
for atom in openmm_topology.atoms():
if atom.element is None:
assert isinstance(
Expand Down
8 changes: 4 additions & 4 deletions openff/interchange/interop/openmm/_import/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from openff.interchange.exceptions import UnsupportedImportError

_UNSUPPORTED_VIRTUAL_SITE_TYPES: set[type] = {
openmm.TwoParticleAverageSite,
openmm.OutOfPlaneSite,
_SUPPORTED_VIRTUAL_SITE_TYPES: set[type] = {
openmm.ThreeParticleAverageSite,
openmm.LocalCoordinatesSite,
}


Expand All @@ -17,7 +17,7 @@ def _check_compatible_inputs(
"""Check that inputs are compatible and supported."""
for index in range(system.getNumParticles()):
if system.isVirtualSite(index):
if type(system.getVirtualSite(index)) in _UNSUPPORTED_VIRTUAL_SITE_TYPES:
if type(system.getVirtualSite(index)) not in _SUPPORTED_VIRTUAL_SITE_TYPES:
raise UnsupportedImportError(
f"A particle is a virtual site of type {type(system.getVirtualSite(index))}, "
"which is not yet supported.",
Expand Down

0 comments on commit 356718f

Please sign in to comment.