Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into pytest-8
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Jun 7, 2024
2 parents 5ad99d8 + fdf3832 commit fcfc6a9
Show file tree
Hide file tree
Showing 72 changed files with 6,835 additions and 3,683 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- [ ] Add [tests](https://github.com/openforcefield/openff-toolkit/tree/main/openff/toolkit/_tests)
- [ ] Update docstrings/[documentation](https://github.com/openforcefield/openff-toolkit/tree/main/docs), if applicable
- [ ] [Lint](https://open-forcefield-toolkit.readthedocs.io/en/latest/developing.html#style-guide) codebase
- [ ] Update [changelog](https://github.com/openforcefield/openff-toolkit/blob/main/docs/releasehistory.rst)
- [ ] Update [changelog](https://github.com/openforcefield/openff-toolkit/blob/main/docs/releasehistory.md)
43 changes: 19 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-12]
python-version: ["3.10", "3.11", "3.12"]
rdkit: [true, false]
openeye: [true, false]
exclude:
- rdkit: false
openeye: false
- openeye: true
python-version: "3.10"
- openeye: true
python-version: "3.11"
- openeye: true
python-version: "3.12"

env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
Expand Down Expand Up @@ -71,17 +71,10 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
- name: Additional info about the build
run: |
uname -a
df -h
ulimit -a
- name: Make oe_license.txt file from GH org secret "OE_LICENSE"
env:
OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}
run: |
echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}
run: echo "${OE_LICENSE_TEXT}" > ${OE_LICENSE}

- name: Install package
run: |
Expand All @@ -94,14 +87,13 @@ jobs:
python -m pip install .
- name: Install test plugins
run: |
python -m pip install utilities/test_plugins
run: python -m pip install utilities/test_plugins

- name: Remove undesired toolkits
run: |
if [ ! -z "${{ env.PACKAGES_TO_REMOVE }}" ]; then
for cpkg in ${{ env.PACKAGES_TO_REMOVE }}; do
if [[ $(conda list | grep $cpkg) ]]; then micromamba remove --force $cpkg --yes ; fi
if [[ $(micromamba list | grep $cpkg) ]]; then micromamba remove --force $cpkg --yes ; fi
done
fi
Expand All @@ -126,15 +118,16 @@ jobs:
- name: Environment Information
run: |
conda info
conda list
micromamba info
micromamba list
- name: Check links
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: pytest -r fE --tb=short openff/toolkit/_tests/test_links.py

- name: Run mypy
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
# subtle differences in Python/mypy versions, just keep it passing on one
if: ${{ matrix.rdkit == true && matrix.openeye && matrix.python-version == 3.10 }}
run: mypy -p "openff.toolkit"

- name: Run unit tests
Expand All @@ -145,22 +138,24 @@ jobs:
PYTEST_ARGS+=" -m 'slow or not slow'"
fi
python -m pytest $PYTEST_ARGS $COV
python -m pytest --durations=20 $PYTEST_ARGS $COV
- name: Run code snippets in docs
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: |
pytest -v --no-cov --doctest-glob="docs/*.rst" --doctest-glob="docs/*.md" docs/
run: pytest -v --no-cov --doctest-glob="docs/*.rst" --doctest-glob="docs/*.md" docs/

- name: Run notebooks in docs
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: |
pytest -v --no-cov --durations=5 --nbval --ignore docs/_build/ docs/
run: pytest -v --no-cov --nbval --ignore docs/_build/ docs/

- name: Run examples in docstrings
if: ${{ matrix.rdkit == true && matrix.openeye == true }}
run: |
pytest -v --no-cov --doctest-modules --ignore-glob='openff/toolkit/_tests/test_*' --ignore=openff/toolkit/data/ --ignore=openff/toolkit/utils/utils.py openff/
pytest openff \
-v -x -n logical --no-cov --doctest-modules \
--ignore-glob='openff/toolkit/_tests*' \
--ignore=openff/toolkit/data/ \
--ignore=openff/toolkit/utils/utils.py
- name: Codecov
uses: codecov/codecov-action@v4
Expand Down
48 changes: 18 additions & 30 deletions .github/workflows/beta_rc.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Weekly test against upstream beta and RC builds
name: Tests against beta/RC builds

on:
schedule:
- cron: "0 0 * * 0"
- cron: "0 3 * * 0"
workflow_dispatch:

defaults:
Expand All @@ -11,21 +11,20 @@ defaults:

jobs:
test:
name: Test beta and RC builds on on ${{ matrix.python-version }}
name: Test beta/RC builds on ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-12
python-version:
- 3.9
- "3.11"

env:
OE_LICENSE: ${{ github.workspace }}/oe_license.txt
PYTEST_ARGS: -r fE --tb=short -nauto
COV: --cov=openff/toolkit --cov-config=setup.cfg --cov-append --cov-report=xml

steps:
- uses: actions/checkout@v4
Expand All @@ -35,16 +34,17 @@ jobs:
- name: Install environment with ${{ env.JOBNAME }}
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/beta_rc_env.yaml
environment-file: devtools/conda-envs/test_env.yaml
condarc: |
channels:
- conda-forge/label/openmm_rc
- conda-forge/label/mdtraj_rc
- openeye/label/rc
- openeye
- conda-forge
create-args: >-
python=${{ matrix.python-version }}
- name: Additional info about the build
run: |
uname -a
df -h
ulimit -a
- name: Make oe_license.txt file from GH org secret "OE_LICENSE"
env:
OE_LICENSE_TEXT: ${{ secrets.OE_LICENSE }}
Expand All @@ -57,36 +57,24 @@ jobs:
python -m pip install .
- name: Install test plugins
run: |
python -m pip install utilities/test_plugins
run: python -m pip install utilities/test_plugins

- name: Environment Information
run: |
conda info
conda list
run: micromamba info && micromamba list

- name: Check links
run: |
pytest -r fE --tb=short openff/toolkit/_tests/test_links.py
run: pytest -r fE --tb=short openff/toolkit/_tests/test_links.py

- name: Run mypy
run: |
mypy --namespace-packages -p "openff.toolkit"
run: mypy -p "openff.toolkit"

- name: Run unit tests
run: |
PYTEST_ARGS+=" --ignore=openff/toolkit/_tests/test_examples.py"
PYTEST_ARGS+=" --ignore=openff/toolkit/_tests/test_links.py"
PYTEST_ARGS+=" -m 'slow or not slow'"
pytest $PYTEST_ARGS $COV
pytest $PYTEST_ARGS
- name: Run code snippets in docs
run: |
pytest -v --doctest-glob="docs/*.rst" --doctest-glob="docs/*.md" docs/
- name: Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
4 changes: 2 additions & 2 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
os: [ubuntu-latest, macos-12]
python-version: ["3.10"]
openeye: ["true", "false"]

env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9"]
os: [ubuntu-latest, macos-12]
python-version: ["3.10"]
rdkit: [true, false]
openeye: [true, false]
exclude:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: ["3.9", "3.10"]
os: [macOS-12, ubuntu-latest]
python-version: ["3.10", "3.11"]

env:
CI_OS: ${{ matrix.os }}
Expand Down
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:
files: ^openff|(^examples/((?!deprecated).)*$)|^docs
repos:
- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.3.0
hooks:
- id: black
- id: black-jupyter
Expand All @@ -22,7 +22,7 @@ repos:
'flake8-bugbear',
]
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
rev: 1.8.5
hooks:
- id: nbqa-pyupgrade
args:
Expand All @@ -31,3 +31,8 @@ repos:
- id: nbqa-flake8
args:
- '--select=F'
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
files: ^docs/.*\.(rst|md)$
13 changes: 12 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Parameter files used by typical molecular dynamics simulation packages do not cu
For example, one could take a structure file and infer bond orders based on bond lengths, or attempt to infer bond orders from force constants in a parameter file.
Such inference work is outside the scope of SMIRNOFF.


## What about starting from a PDB file?

PDB files do not in general provide the chemical identity of small molecules contained therein, and thus do not provide suitable starting points for applying SMIRNOFF to small molecules.
Expand Down Expand Up @@ -95,6 +94,18 @@ source ~/miniconda3/etc/profile.d/conda.sh

and then try rerunning and/or reinstalling the Toolkit.

## How are partial charges assigned in a SMIRNOFF force field?

There are [many charge methods](https://openforcefield.github.io/standards/standards/smirnoff/#partial-charge-and-electrostatics-models) supported by the SMIRNOFF specification. With the exception of water, mainline OpenFF force fields only use AM1-BCC (through `ToolkitAM1BCC`) to assign partial charges. (A future biopolymer force field will likely use library charges for standard residues.)

If OpenEye Toolkits are installed and licensed, the ELF10 variant of AM1-BCC is used. OpenEye's Quacpac (`oequacpac.OEAM1BCCELF10Charges`) is used to generate partial charges.

Otherwise, RDKit is used to generate a conformer which is passed to AmberTool's `sqm` (with `-c bcc`).

Note that, because of differences with the ELF10 variant and other subtle differences between OpenEye Toolkits and RDKit/AmberTools, **assigned partial charges can be expected to differ** based on the available toolkit(s). These numerical differences are often minor but in some molecules or use cases can be significant.

A future charge method may use [NAGL](https://github.com/openforcefield/openff-nagl) to assign partial charges from a graph-convolutional neural network instead of an underlying semi-empirical method. This approach is anticipated to be faster, more scalable, and more consistent than current approaches. As of March 2024, this is under development and not released for general use.

## The partial charges generated by the toolkit don't seem to depend on the molecule's conformation! Is this a bug?

No! This is the intended behavior. The force field parameters of a molecule should be independent of both their chemical environment and conformation so that they can be used and compared across different contexts. When applying AM1BCC partial charges, the toolkit achieves a deterministic output by ignoring the input conformation and producing several new conformations for the same molecule. Partial charges are then computed based on these conformations. This behavior can be controlled with the `use_conformers` argument to [Molecule.assign_partial_charges()](openff.toolkit.topology.Molecule.assign_partial_charges).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| **Status** | [![GH Actions Status](https://github.com/openforcefield/openff-toolkit/workflows/CI/badge.svg)](https://github.com/openforcefield/openff-toolkit/actions?query=branch%3Amain+workflow%3ACI) [![Codecov coverage](https://img.shields.io/codecov/c/github/openforcefield/openff-toolkit.svg?logo=Codecov&logoColor=white)](https://codecov.io/gh/openforcefield/openff-toolkit) |
| :------ |:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Latest Release** | [![Last release tag](https://img.shields.io/github/release-pre/openforcefield/openff-toolkit.svg)](https://github.com/openforcefield/openff-toolkit/releases) [![Commits since release](https://img.shields.io/github/commits-since/openforcefield/openff-toolkit/0.15.2.svg)](https://github.com/openforcefield/openff-toolkit/releases/tag/0.15.2)[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10613658.svg)](https://doi.org/10.5281/zenodo.10613658)
| **Latest Release** | [![Last release tag](https://img.shields.io/github/release-pre/openforcefield/openff-toolkit.svg)](https://github.com/openforcefield/openff-toolkit/releases) [![Commits since release](https://img.shields.io/github/commits-since/openforcefield/openff-toolkit/0.16.0.svg)](https://github.com/openforcefield/openff-toolkit/releases/tag/0.16.0)[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10967071.svg)](https://doi.org/10.5281/zenodo.10967071)
| **Communication** | [![docs stable](https://img.shields.io/badge/docs-stable-5077AB.svg?logo=read%20the%20docs)](https://open-forcefield-toolkit.readthedocs.io/) [![user & dev discussions](https://img.shields.io/badge/user%20%26%20dev%20discussions-GitHub-red?logo=github)](https://github.com/openforcefield/discussions/discussions) |
| **Foundation** | [![license](https://img.shields.io/github/license/openforcefield/openff-toolkit.svg)](https://opensource.org/licenses/MIT) [![platforms](https://img.shields.io/badge/Platforms-Linux%2C%20MacOS-orange.svg)](https://open-forcefield-toolkit.readthedocs.io/en/stable/installation.html) [![python](https://img.shields.io/badge/python-3.9%2C%203.10%2C%203.11-blue.svg)](https://open-forcefield-toolkit.readthedocs.io/en/stable/installation.html) [![Funding](https://img.shields.io/badge/Funding-Open%20Force%20Field%20Consortium-brightgreen.svg)](http://openforcefield.org) |
| **Installation** | [![Releases](https://img.shields.io/badge/obtain-latest-green.svg)](https://github.com/openforcefield/openff-toolkit/releases) [![Conda](https://img.shields.io/conda/v/conda-forge/openff-toolkit.svg)](https://anaconda.org/conda-forge/openff-toolkit) [![Last updated](https://anaconda.org/conda-forge/openff-toolkit/badges/latest_release_relative_date.svg)](https://anaconda.org/conda-forge/openff-toolkit) [![Anaconda Cloud downloads](https://anaconda.org/conda-forge/openff-toolkit/badges/downloads.svg)](https://anaconda.org/conda-forge/openff-toolkit) |
Expand Down
6 changes: 3 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

# Codecov configuration to make it a bit less noisy
coverage:
status:
patch: false
Expand All @@ -12,4 +10,6 @@ comment:
branches: null
behavior: default
flags: null
paths: null
paths: null
ignore:
- "examples/"
52 changes: 0 additions & 52 deletions devtools/conda-envs/beta_rc_env.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions devtools/conda-envs/conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: latest-deployment
channels:
- conda-forge
dependencies:
# Base depends
- openff-toolkit-examples
# Tests
- pytest=7.4
- pytest-rerunfailures
- nbval
- parmed=3
Loading

0 comments on commit fcfc6a9

Please sign in to comment.