Skip to content

Commit

Permalink
MAINT: Only test with OpenMM
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Jan 16, 2025
1 parent ab32ee7 commit 373dd71
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
- false
openmm:
- true
- false

env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
COV: --cov=openff/interchange --cov-report=xml --cov-config=pyproject.toml --cov-append

steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 9 additions & 5 deletions openff/interchange/components/interchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
from openff.toolkit import ForceField

if has_package("foyer"):
from foyer import Forcefield as FoyerForcefield
try:
from foyer.forcefield import Forcefield as FoyerForcefield
except ModuleNotFoundError:
# case of openff/interchange/foyer/ being detected as the real package
pass
if has_package("nglview"):
import nglview

Expand Down Expand Up @@ -836,13 +840,13 @@ def from_foyer(
>>> from openff.interchange import Interchange
>>> from openff.toolkit import Molecule, Topology
>>> from foyer import Forcefield
>>> from foyer.forcefield import Forcefield # doctest: +SKIP
>>> mol = Molecule.from_smiles("CC")
>>> mol.generate_conformers(n_conformers=1)
>>> top = Topology.from_molecules([mol])
>>> oplsaa = Forcefield(name="oplsaa")
>>> interchange = Interchange.from_foyer(topology=top, force_field=oplsaa)
>>> interchange
>>> oplsaa = Forcefield(name="oplsaa") # doctest: +SKIP
>>> interchange = Interchange.from_foyer(topology=top, force_field=oplsaa) # doctest: +SKIP
>>> interchange # doctest: +SKIP
Interchange with 8 collections, non-periodic topology with 8 atoms.
"""
Expand Down
7 changes: 6 additions & 1 deletion openff/interchange/foyer/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
from typing import TYPE_CHECKING

from openff.toolkit import Topology
from openff.utilities import has_package

from openff.interchange.components.potentials import Collection, Potential
from openff.interchange.models import PotentialKey, TopologyKey

if TYPE_CHECKING:
from foyer import Forcefield
if has_package("foyer"):
try:
from foyer.forcefield import Forcefield
except ModuleNotFoundError:
pass


# Is this the safest way to achieve PotentialKey id separation?
Expand Down
5 changes: 4 additions & 1 deletion openff/interchange/foyer/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
from openff.interchange.models import TopologyKey

if has_package("foyer"):
from foyer.forcefield import Forcefield
try:
from foyer.forcefield import Forcefield
except ModuleNotFoundError:
pass

_CollectionAlias = type[Collection]

Expand Down
5 changes: 4 additions & 1 deletion openff/interchange/foyer/_nonbonded.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from openff.interchange.models import PotentialKey, TopologyKey

if has_package("foyer"):
from foyer import Forcefield
try:
from foyer.forcefield import Forcefield
except ModuleNotFoundError:
pass


class FoyerVDWHandler(vdWCollection):
Expand Down

0 comments on commit 373dd71

Please sign in to comment.