diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9202847cb..909b06ccc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,10 @@ on: branches: - "master" +defaults: + run: + shell: bash -l {0} + jobs: test: runs-on: ${{ matrix.os }} @@ -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 }} @@ -30,11 +36,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2.1.1 + - name: Install dependencies with Minicondna + uses: conda-incubator/setup-miniconda@v2.1.1 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 @@ -46,20 +53,12 @@ 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 @@ -67,12 +66,6 @@ jobs: # 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 @@ -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/codecov-action@v2.1.0 with: diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index 0b0bdb7d2..9d319c954 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -1,13 +1,12 @@ -name: test +name: forcebalance-test channels: - conda-forge - - omnia - - ambermd + - bioconda + - openeye dependencies: # Base depends - python - pip - # Testing - pytest - pytest-cov @@ -22,9 +21,10 @@ 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 + - openff-evaluator-base + - openff-recharge + - openeye-toolkits diff --git a/src/openmmio.py b/src/openmmio.py index 404631d19..81b80c9d5 100644 --- a/src/openmmio.py +++ b/src/openmmio.py @@ -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())