-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #759 from openforcefield/cleaner-openmm-nonbonded
Clean up internal processing of non-bonded data to OpenMM
- Loading branch information
Showing
3 changed files
with
128 additions
and
94 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
openff/interchange/_tests/unit_tests/interop/openmm/test_nonbonded.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.