From 3fabe581c3c0ca98ae662f1d3e265ff15cdcbca0 Mon Sep 17 00:00:00 2001 From: Lily Wang <31115101+lilyminium@users.noreply.github.com> Date: Thu, 12 Sep 2024 23:51:57 +1000 Subject: [PATCH] Add 2.2.1 (#113) * add ff files * add draft version * Update README * Do not assume `canary` is a module * print actual error * could it be flaky conformer gen? minimize first? * Lint --------- Co-authored-by: Matthew W. Thompson --- README.md | 6 +- canary/scripts/test_hmr.py | 20 +- openforcefields/offxml/openff-2.2.1.offxml | 395 ++++++++++++++++++ .../offxml/openff_unconstrained-2.2.1.offxml | 394 +++++++++++++++++ 4 files changed, 807 insertions(+), 8 deletions(-) create mode 100644 openforcefields/offxml/openff-2.2.1.offxml create mode 100644 openforcefields/offxml/openff_unconstrained-2.2.1.offxml diff --git a/README.md b/README.md index 5b63843..6991a56 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenFF Force Fields -[![Build Status](https://github.com/openforcefield/openff-forcefields/workflows/CI/badge.svg)](https://github.com/openforcefield/openff-forcefields/actions?query=branch%3Amaster+workflow%3ACI) +[![Build Status](https://github.com/openforcefield/openff-forcefields/workflows/CI/badge.svg)](https://github.com/openforcefield/openff-forcefields/actions?query=branch%3Amain+workflow%3ACI) This repository contains force fields released by the [Open Force Field Initiative](https://openforcefield.org). @@ -28,6 +28,8 @@ Details for each force field in this repository can be found in the following ta | Filename | DOI | FF line | Release Date | Major format changes? | |---------------------------------------------|-----------------------------------------------------------------------------------------------------------|---------|---------------|-----------------------| +| `openff-2.2.1.offxml` | | Sage | September 11, 2024 | No | +| `openff_unconstrained-2.2.1.offxml` | | Sage | September 11, 2024 | No | | `openff-2.2.1-rc1.offxml` | | Sage | July 22, 2024 | No | | `openff_unconstrained-2.2.1-rc1.offxml` | | Sage | July 22, 2024 | No | | `openff-2.2.0.offxml` | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10995191.svg)](https://doi.org/10.5281/zenodo.10995191) | Sage | April 18, 2024 | No | @@ -177,6 +179,8 @@ Force fields moving forward will be called `name-X.Y.Z` - `2024.07.0`: This release adds `openff-2.2.1-rc1.offxml` and `openff_unconstrained-2.2.1-rc1.offxml`, which contains re-fit valence parameters where linear angles have been pinned to linear equilibrium values. +- `2024.09.0` This release adds the Sage 2.2.1 force field with `openff-2.2.1.offxml` and `openff_unconstrained-2.2.1.offxml`, with identifical parameters to 2.2.1-rc1. + #### Acknowledgements Project based on the diff --git a/canary/scripts/test_hmr.py b/canary/scripts/test_hmr.py index 4024f38..a6d3d11 100644 --- a/canary/scripts/test_hmr.py +++ b/canary/scripts/test_hmr.py @@ -1,13 +1,13 @@ -import importlib.resources +import pathlib import sys import numpy as np import openmm.app import openmm.unit -from openff.toolkit.topology import Molecule +from openff.toolkit import ForceField, Molecule from openmmforcefields.generators import SystemGenerator -DATA_PATH = importlib.resources.files("canary") / "data" +DATA_PATH = pathlib.Path(".") / "canary" / "data" coverage_mols = DATA_PATH / "coverage.smi" propyne_mols = DATA_PATH / "propynes.smi" @@ -58,8 +58,13 @@ def hmr_driver(mol, ff_name): integrator = openmm.LangevinMiddleIntegrator(temperature, collision_rate, timestep) context = openmm.Context(system, integrator) + + # generate conformers, minimize, and set positions mol.generate_conformers(n_conformers=1) - context.setPositions(mol.conformers[0].to_openmm()) + ff = ForceField(f"{ff_name}.offxml") + ic = ff.create_interchange(mol.to_topology()) + ic.minimize() + context.setPositions(ic.positions.to_openmm()) # Run for 10 ps integrator.step(2500) @@ -73,7 +78,7 @@ def hmr_driver(mol, ff_name): if __name__ == "__main__": """This function expects to be called with a list of OFFXML files passed to it, - i.e. piped from git diff upstream/master --name-only""" + i.e. piped from git diff upstream/main --name-only""" # Read force field filenames from stdin failed_runs = [] for line in sys.stdin: @@ -98,11 +103,12 @@ def hmr_driver(mol, ff_name): except NANEnergyError: failed_runs.append([mol.to_smiles(), ff_name, "NaN energy"]) - except Exception: + except Exception as e: # OpenMM's OpenMMException cannot be caught as it does not # inherit from BaseException; therefore this clause may # hit other errors than NaN positions - failed_runs.append([mol.to_smiles(), ff_name, "NaN position(s)"]) + # failed_runs.append([mol.to_smiles(), ff_name, "NaN position(s)"]) + failed_runs.append([mol.to_smiles(), ff_name, str(e)]) if len(failed_runs) > 0: raise HMRCanaryError("HMR tests failed:", failed_runs) diff --git a/openforcefields/offxml/openff-2.2.1.offxml b/openforcefields/offxml/openff-2.2.1.offxml new file mode 100644 index 0000000..2e7c9da --- /dev/null +++ b/openforcefields/offxml/openff-2.2.1.offxml @@ -0,0 +1,395 @@ + + + The Open Force Field Initiative + 2024-09-11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openforcefields/offxml/openff_unconstrained-2.2.1.offxml b/openforcefields/offxml/openff_unconstrained-2.2.1.offxml new file mode 100644 index 0000000..4124048 --- /dev/null +++ b/openforcefields/offxml/openff_unconstrained-2.2.1.offxml @@ -0,0 +1,394 @@ + + + The Open Force Field Initiative + 2024-09-11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +