Skip to content

Commit

Permalink
Merge branch 'main' into fix/system_template_generator
Browse files Browse the repository at this point in the history
  • Loading branch information
ijpulidos authored Jul 19, 2023
2 parents c198793 + 8660a1a commit 0724acf
Show file tree
Hide file tree
Showing 8 changed files with 387 additions and 272 deletions.
25 changes: 7 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ concurrency:

jobs:
test:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}, Latest openff-toolkit ${{ matrix.latest-openff-toolkit }}
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10"]
latest-openff-toolkit: [true, false]
python-version: ["3.9", "3.10"] # Add 3.11 in with AmberTools 23
exclude:
- python-version: "3.10"
os: macos-latest
Expand All @@ -38,10 +37,10 @@ jobs:
- uses: actions/checkout@v3

- name: Setup Conda Environment
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env.yaml
extra-specs: |
create-args: >-
python=${{ matrix.python-version }}
- name: License OpenEye
Expand All @@ -52,16 +51,6 @@ jobs:
env:
SECRET_OE_LICENSE: ${{ secrets.OE_LICENSE }}

- name: "Install openff-toolkit >= 0.11 API changes"
if: ${{ matrix.latest-openff-toolkit == true }}
run: |
micromamba update -y -c conda-forge "openff-toolkit >=0.11.3"
- name: "Install openff-toolkit < 0.11 API changes"
if: ${{ matrix.latest-openff-toolkit == false }}
run: |
micromamba install -y -c conda-forge "openff-toolkit==0.10.6" "openff-toolkit-base==0.10.6"
- name: Install Package
run: |
pip list
Expand All @@ -77,10 +66,11 @@ jobs:
- name: Test Installed Package
run: |
pytest -v -x --log-cli-level $LOGLEVEL $COV_ARGS --durations=20 \
pytest -v --log-cli-level $LOGLEVEL $COV_ARGS --durations=20 \
openmmforcefields/tests/test_amber_import.py \
openmmforcefields/tests/test_template_generators.py \
openmmforcefields/tests/test_system_generator.py
openmmforcefields/tests/test_system_generator.py \
-k "not TestEspalomaTemplateGenerator"
env:
COV_ARGS: --cov=openmmforcefields --cov-config=setup.cfg --cov-append --cov-report=xml
LOGLEVEL: "INFO"
Expand All @@ -106,7 +96,6 @@ jobs:
working-directory: ./charmm

- name: Run docstrings
if: ${{ matrix.latest-openff-toolkit == true }}
continue-on-error: True
run: |
pytest --doctest-modules openmmforcefields --ignore=openmmforcefields/tests
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/espaloma_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: EspalomaCI

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
schedule:
- cron: "0 0 * * *"

defaults:
run:
shell: bash -l {0}

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
test:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}, Latest openff-toolkit ${{ matrix.latest-openff-toolkit }}
runs-on: ${{ matrix.os }}
env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10"] # Add 3.11 in with AmberTools 23
exclude:
- python-version: "3.10"
os: macos-latest

steps:
- uses: actions/checkout@v3

- name: Setup Conda Environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env.yaml
create-args: >-
python=${{ matrix.python-version }}
- name: Install Package
run: |
pip list
micromamba list
micromamba remove --force openmmforcefields
python -m pip install .
- name: Conda Environment Information
run: |
micromamba info
micromamba list
python -c "from openmmforcefields import __version__, __file__; print(__version__, __file__)"
- name: Test Installed Package
run: |
pytest -v --log-cli-level $LOGLEVEL $COV_ARGS --durations=20 \
-m "espaloma" openmmforcefields/tests --runespaloma
env:
COV_ARGS: --cov=openmmforcefields --cov-config=setup.cfg --cov-append --cov-report=xml
LOGLEVEL: "INFO"
KMP_DUPLICATE_LIB_OK: "True"
10 changes: 5 additions & 5 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ dependencies:
# Testing
- pytest
- pytest-cov
- codecov
- pytest-xdist
- pytest-randomly

# Requirements for converted force field installer
- openmm >=7.6.0

- openff-units >=0.1.8
- openff-amber-ff-ports >=0.0.3
- openff-toolkit >=0.11

# Requirements for conversion tools
- pyyaml
- ambertools >=18.0 # contains sufficiently recent ParmEd
- ambertools =22
- lxml
- networkx

Expand All @@ -41,6 +41,6 @@ dependencies:
# TODO: Rework this once espaloma is on conda-forge
#
- pytorch >=1.8.0
- dgl
- dgl <1
- qcportal >=0.15.0
- espaloma
2 changes: 1 addition & 1 deletion openmmforcefields/ffxml/amber/opc3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</Residue>
</Residues>
<HarmonicBondForce>
<Bond class1="OW" class2="HW" length="0.978882" k="502416.0"/>
<Bond class1="OW" class2="HW" length="0.0978882" k="502416.0"/>
</HarmonicBondForce>
<HarmonicAngleForce>
<!-- angle = arccos(1 - (1.598507**2 / (2*0.978882**2))) -->
Expand Down
2 changes: 1 addition & 1 deletion openmmforcefields/generators/template_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ def __init__(self, molecules=None, cache=None, forcefield=None, **kwargs):
self._smirnoff_forcefield = openff.toolkit.typing.engines.smirnoff.ForceField(filename)
except Exception as e:
_logger.error(e)
raise ValueError(f"Can't find specified SMIRNOFF force field ({forcefield}) in install paths")
raise ValueError(f"Can't find specified SMIRNOFF force field ({forcefield}) in install paths") from e

# Delete constraints, if present
if 'Constraints' in self._smirnoff_forcefield._parameter_handlers:
Expand Down
21 changes: 21 additions & 0 deletions openmmforcefields/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Default configuration and objects for tests"""

import pytest

def pytest_addoption(parser):
parser.addoption(
"--runespaloma", action="store_true", default=False, help="run espaloma tests"
)


def pytest_configure(config):
config.addinivalue_line("markers", "espaloma: mark test as slow to run")


def pytest_collection_modifyitems(config, items):
skip_slow = pytest.mark.skip(reason="need --runespaloma option to run")

if not config.getoption("--runespaloma"):
for item in items:
if "espaloma" in item.keywords:
item.add_marker(skip_slow)
Loading

0 comments on commit 0724acf

Please sign in to comment.