Skip to content

Commit

Permalink
Merge pull request #759 from openforcefield/cleaner-openmm-nonbonded
Browse files Browse the repository at this point in the history
Clean up internal processing of non-bonded data to OpenMM
  • Loading branch information
mattwthompson authored Jul 6, 2023
2 parents e229859 + 2ce51c0 commit 0a47567
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pytest
from openff.toolkit import Molecule
from openff.units import unit

from openff.interchange._tests import _BaseTest
from openff.interchange.exceptions import UnsupportedCutoffMethodError


class TestUnsupportedCases(_BaseTest):
def test_ljpme_nonperiodic(self, sage):
interchange = sage.create_interchange(Molecule.from_smiles("CC").to_topology())

interchange["vdW"].method = "pme"

with pytest.raises(
UnsupportedCutoffMethodError,
match="not valid for non-periodic systems",
):
interchange.to_openmm(combine_nonbonded_forces=False)

@pytest.mark.parametrize("periodic", [True, False])
def test_reaction_field(self, sage, periodic):
interchange = sage.create_interchange(Molecule.from_smiles("CC").to_topology())

if periodic:
interchange.box = [4, 4, 4] * unit.nanometer
interchange["Electrostatics"].periodic_potential = "reaction-field"
else:
interchange["Electrostatics"].nonperiodic_potential = "reaction-field"

with pytest.raises(
UnsupportedCutoffMethodError,
match="Reaction field electrostatics not supported. ",
):
interchange.to_openmm(combine_nonbonded_forces=False)
Loading

0 comments on commit 0a47567

Please sign in to comment.