Skip to content

Commit

Permalink
re-enable gaff (#334)
Browse files Browse the repository at this point in the history
* re-enable gaff

* run espaloma and gaff tests

* gaff has two fs michael

* Use 8.1.2rc1

* Update linters

* Remove Espaloma tests

* Apply suggestions from code review

Co-authored-by: Iván Pulido <[email protected]>

* Use Intel macOS runners

* check if older macos works

* test all the macos versions

* see if rdkit is the issue

* Drop macOS 13

* Typo/fix

* Update dependencies

---------

Co-authored-by: Matthew W. Thompson <[email protected]>
Co-authored-by: Iván Pulido <[email protected]>
  • Loading branch information
3 people authored Jul 19, 2024
1 parent b3fae57 commit 38eb754
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-12, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
amber-conversion: [false]
charmm-conversion: [false]
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Test Installed Package
run: |
pytest -v -n logical --log-cli-level $LOGLEVEL $COV_ARGS --durations=20 \
pytest -v -n logical --rungaff --log-cli-level $LOGLEVEL $COV_ARGS --durations=20 \
openmmforcefields/tests/
# add --rungaff / --runespaloma to run those tests
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
autoupdate_schedule: "quarterly"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.5.1
hooks:
- id: ruff
args: ["--fix", "--unsafe-fixes"]
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ See the corresponding directories for information on how to use the provided con

# [Changelog](https://github.com/openmm/openmmforcefields/releases)

## 0.14.0 Bring back GAFFTemplateGenerator

This release effectively reverts the changes in 0.13.0. This release is **only** compatible with OpenMM 8.1.2. No other changes were made.

## 0.13.0 Temporarily remove GAFFTemplateGenerator

This release temporarily removes GAFFTemplateGenerator because of packaging incompatibilities with
Expand Down
21 changes: 1 addition & 20 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
name: openmmforcefields-test

channels:
- conda-forge

dependencies:
# Base depends
- python
- pip

# Testing
- pytest
- pytest-cov
- pytest-xdist
- pytest-randomly

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

- openmm >=8.1.2,<9
- openff-toolkit >=0.11

# Requirements for conversion tools
- pyyaml
- ambertools >=22,<24
- lxml
- networkx

# JSON caching of residue templates
- tinydb

# Validating URLs
- validators

#
# Espaloma requirements below
#
# espaloma >=0.3.1
10 changes: 1 addition & 9 deletions openmmforcefields/generators/system_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def __init__(
# Create and cache a residue template generator
from openmmforcefields.generators.template_generators import (
SmallMoleculeTemplateGenerator,
GAFFNotSupportedError,
)

self.template_generator = None
Expand All @@ -261,17 +260,10 @@ def __init__(
template_generator_kwargs=self.template_generator_kwargs,
)
break
except (ValueError, GAFFNotSupportedError) as e:
except (ValueError,) as e:
_logger.debug(f" {template_generator_cls.__name__} cannot load {small_molecule_forcefield}")
_logger.debug(e)
if self.template_generator is None:
if small_molecule_forcefield.startswith("gaff"):
raise GAFFNotSupportedError(
"This release (0.13.x) of openmmforcefields temporarily drops GAFF support and "
"thereby the GAFFTemplateGenerator class. Support will be re-introduced in "
"future releases (0.14.x). To use this class, install version 0.12.0 or older."
)

msg = (
"No registered small molecule template generators could load force field "
f"'{small_molecule_forcefield}'\n"
Expand Down
9 changes: 0 additions & 9 deletions openmmforcefields/generators/template_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ class ForceException(Exception):
"""Exception for forces"""


class GAFFNotSupportedError(Exception):
"""Exception for missing GAFF support"""


class SmallMoleculeTemplateGenerator:
"""
Abstract base class for small molecule template generation for OpenMM ForceField.
Expand Down Expand Up @@ -507,11 +503,6 @@ def __init__(self, molecules=None, forcefield=None, cache=None, **kwargs):
Newly parameterized molecules will be written to the cache, saving time next time!
"""
raise GAFFNotSupportedError(
"This release (0.13.x) of openmmforcefields temporarily drops GAFF support and "
"thereby the GAFFTemplateGenerator class. Support will be re-introduced in "
"future releases (0.14.x). To use this class, install version 0.12.0 or older."
)

# Initialize molecules and cache
super().__init__(molecules=molecules, cache=cache)
Expand Down

0 comments on commit 38eb754

Please sign in to comment.