Skip to content

Commit

Permalink
Update CI, fix compatibility with OpenMM 7.7 (#249)
Browse files Browse the repository at this point in the history
* Only test against OpenFF Toolkit 0.10.3 and on Python 3.7+

* Tinker with CI

* Update Python versions

* Try `--use-pep517`

* Pin to Openmm 7.6

* Debug: Turn off switching function in ALL cases

* Attempt to isolate CustomNonbondedForce.setUseSwitchingFunction

* Isolate mmopts

* Debug

* Focus tests more on old failures

* Drop tinker stuff

* Fix typo

* Remove some debug code

* Revert debug state

* Fix syntax, add back Python 3.6

* Update src/openmmio.py

Co-authored-by: Jeff Wagner <[email protected]>

* Allow a version of the toolkit compatible with Python 3.6

Versions 0.10.1 and 0.10.2 are broken but not yet off of conda-forge, so
the pinning here MUST ensure that old builds are 0.10.0 or OLDER

* Unpin OpenMM

* Allow old pip

* Fix syntax in version constraints

* Install dataclasses backport for networkx

Co-authored-by: Jeff Wagner <[email protected]>
  • Loading branch information
mattwthompson and j-wags authored Mar 8, 2022
1 parent a8659b2 commit c655df6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
50 changes: 22 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- "master"

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

jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -18,9 +22,11 @@ jobs:
- macOS-latest
- ubuntu-latest
python-version:
- 3.6
- 3.7
- 3.8
- "3.6"
- "3.7"
- "3.8"
- "3.9"

env:
CI_OS: ${{ matrix.os }}
PYVER: ${{ matrix.python-version }}
Expand All @@ -30,11 +36,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- uses: conda-incubator/[email protected]
- name: Install dependencies with Minicondna
uses: conda-incubator/[email protected]
with:
python-version: ${{ matrix.python-version }}
activate-environment: test
channel-priority: true
mamba-version: "*"
activate-environment: forcebalance-test
environment-file: devtools/conda-envs/test_env.yaml
auto-activate-base: false

Expand All @@ -46,33 +53,19 @@ jobs:
ulimit -a
- name: Environment Information
shell: bash -l {0}
run: |
conda info --all
conda list
- name: Install OpenFF stack and OpenEye on Python 3.6+
if: ${{ matrix.python-version != 2.7}}
shell: bash -l {0}
run: |
conda install openff-toolkit -c conda-forge -y
# Need to replace ndcctools with this block
# - name: Install Work Queue
# shell: bash -l {0}
# run: |
# wget https://raw.githubusercontent.com/leeping/forcebalance/master/tools/install-cctools.sh
# bash install-cctools.sh
# echo "Checking for Work Queue import; if successful, no message will be printed"
# python -c "import work_queue"
# export PATH="$GITHUB_WORKSPACE/opt/cctools/current/bin:$PATH"

- name: Install GROMACS
shell: bash -l {0}
run: |
# This will not install double precision, needs to be replaced with a fresh build
conda install gromacs=2019.1 -c bioconda -c conda-forge -y
- name: Install Tinker
run: |
if [[ "$CI_OS" == 'ubuntu-latest' ]]; then
Expand Down Expand Up @@ -101,26 +94,27 @@ jobs:
tar xvjf targets.tar.bz2
cd ../../
- name: Install backport of dataclasses
if: ${{ matrix.python-version == 3.6}}
run: |
pip install dataclasses
- name: Install package
shell: bash -l {0}
run: |
# python setup.py install
python -m pip install --no-deps .
python -c "import forcebalance; print(forcebalance.__version__)"
- name: Run tests
run: |
pytest -v --cov=forcebalance --cov-config=setup.cfg --durations=0 --cov-report=xml
- name: Run water study
shell: bash -l {0}
run: |
cd studies/001_water_tutorial
tar xvjf targets.tar.bz2
ForceBalance very_simple.in
cd ../../
- name: Run tests
shell: bash -l {0}
run: |
pytest -v --cov=forcebalance --cov-config=setup.cfg --durations=0 --cov-report=xml
- name: Codecov
uses: codecov/[email protected]
with:
Expand Down
12 changes: 4 additions & 8 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: test
name: forcebalance-test
channels:
- conda-forge
- omnia
- ambermd
- bioconda
dependencies:
# Base depends
- python
- pip

# Testing
- pytest
- pytest-cov
Expand All @@ -22,9 +20,7 @@ dependencies:
- pymbar
- openmm
- ambertools
# The following two are not compatible with python 2.7 and 3.5, so they are conditionally installed in .travis.yml
#- openforcefield
#- openeye-toolkits

- ndcctools
- geometric
- gromacs =2019.1
- openff-toolkit >=0.10.3|<=0.10.0
13 changes: 12 additions & 1 deletion src/openmmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,18 @@ def update_simulation(self, **kwargs):
#printcool_dictionary(self.mmopts, title="Creating/updating simulation in engine %s with system settings:" % (self.name))
# for b in list(self.mod.topology.bonds()):
# print b[0].index, b[1].index
self.system = self.forcefield.createSystem(self.mod.topology, **self.mmopts)
try:
self.system = self.forcefield.createSystem(self.mod.topology, **self.mmopts)
# This try/except block catches a failure case introduced by the release of openmm 7.7
# where a ValueError would be raised if createSystem was given an unused kwarg.
# Now, when that error occurs, we remove the unused kwargs from mmopts.
# More info at https://github.com/leeping/forcebalance/issues/246
except ValueError as e:
if 'useSwitchingFunction' not in str(e):
raise e
self.mmopts.pop('useSwitchingFunction')
self.mmopts.pop('switchingDistance')
self.system = self.forcefield.createSystem(self.mod.topology, **self.mmopts)
self.vsinfo = PrepareVirtualSites(self.system)
self.nbcharges = np.zeros(self.system.getNumParticles())

Expand Down

0 comments on commit c655df6

Please sign in to comment.