From 5553c0b6cfa7afdc1c7e6edc4d3d21c31cc2fc0b Mon Sep 17 00:00:00 2001 From: "Matthew W. Thompson" Date: Tue, 17 Sep 2024 14:36:45 -0500 Subject: [PATCH] TST: Reproduce issue #1049 --- openff/interchange/_tests/test_issues.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/openff/interchange/_tests/test_issues.py b/openff/interchange/_tests/test_issues.py index 7b381ec2..d9c5acd7 100644 --- a/openff/interchange/_tests/test_issues.py +++ b/openff/interchange/_tests/test_issues.py @@ -112,3 +112,26 @@ def test_issue_1031(monkeypatch): # check a few atom names to ensure these didn't end up being empty sets for atom_name in ("NE2", "H3", "HA", "CH3", "CA", "CB", "CE1"): assert atom_name in openff_atom_names + + +def test_issue_1049(): + pytest.importorskip("openmm") + + topology = Topology.from_molecules( + [ + Molecule.from_smiles("C"), + Molecule.from_smiles("O"), + Molecule.from_smiles("O"), + ], + ) + + interchange = ForceField("openff-2.2.0.offxml", "opc.offxml").create_interchange(topology) + + openmm_topology = interchange.to_openmm_topology() + openmm_system = interchange.to_openmm_system() + + # the same index in system should also be a virtual site in the topology + for particle_index, particle in enumerate(openmm_topology.atoms()): + assert openmm_system.isVirtualSite(particle_index) == ( + particle.element is None + ), f"particle index {particle_index} is a virtual site in the system OR topology but not both"