Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into from-openmm-positio…
Browse files Browse the repository at this point in the history
…ns-warning
  • Loading branch information
mattwthompson committed Mar 19, 2024
2 parents 9e4cee9 + 547dd1e commit 7a95d55
Show file tree
Hide file tree
Showing 25 changed files with 625 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Install OpenMM
if: ${{ matrix.openmm == true }}
run: |
micromamba install openmm "smirnoff-plugins =2024" -c conda-forge
micromamba install openmm openmmforcefields "smirnoff-plugins =2024" -c conda-forge
pip install git+https://github.com/jthorton/de-forcefields.git
- name: Uninstall OpenMM
Expand Down
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
hooks:
- id: add-trailing-comma
- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.3.0
hooks:
- id: black
files: ^openff|plugins|stubs
Expand Down Expand Up @@ -45,6 +45,11 @@ repos:
files: ^openff|plugins|stubs
exclude: openff/interchange/_version.py|setup.py
args: ["--py39-plus"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args: ["check", "--select", "NPY"]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/beta_env.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: beta-env
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge/label/openmm_rc
- conda-forge
- openeye
Expand All @@ -22,6 +21,7 @@ dependencies:
- foyer >=0.12.1
# Testing
- mdtraj
- openmmforcefields
- intermol
- openeye-toolkits >=2023.2
- pytest-cov
Expand Down
9 changes: 5 additions & 4 deletions devtools/conda-envs/dev_env.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: openff-interchange-dev
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge
- openeye
dependencies:
# Core
- python
- python =3.10
- pip
- numpy
- pydantic
- pydantic =2
- openmm
# OpenFF stack
- openff-toolkit =0.15.2
Expand All @@ -18,8 +17,9 @@ dependencies:
# openff-nagl
# openff-nagl-models
# Optional features
- mbuild
- mbuild =0.17
- foyer >=0.12.1
- gmso =0.12
# Testing
- mdtraj
- intermol
Expand All @@ -34,6 +34,7 @@ dependencies:
- gromacs =2023.3=nompi_*_103
- lammps
- panedr
- openmmforcefields
# Typing
- mypy =1.3
- typing-extensions
Expand Down
1 change: 0 additions & 1 deletion devtools/conda-envs/docs_env.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: interchange-docs
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge
dependencies:
# Base depends
Expand Down
1 change: 0 additions & 1 deletion devtools/conda-envs/examples_env.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: interchange-examples-env
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge
- openeye
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: openff-interchange-env
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge
dependencies:
# Core
Expand All @@ -19,6 +18,7 @@ dependencies:
- mbuild
# Testing
- mdtraj
- openmmforcefields
- intermol
- jax
- pytest
Expand Down
1 change: 1 addition & 0 deletions docs/releasehistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Please note that all releases prior to a version 1.0.0 are considered pre-releas

* #933 Fixes #934 in which atom order was sometimes mangled in `Interchange.from_openmm`.
* #929 A warning is raised when positions are not passed to `Interchange.from_openmm`.
* #930 Adds `additional_forces` argument to `create_openmm_simulation`.

## 0.3.23 - 2024-03-07

Expand Down
74 changes: 37 additions & 37 deletions examples/ligand_in_water/ligand_in_water.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,11 @@
"import openmm\n",
"import openmm.app\n",
"import openmm.unit\n",
"from openff.toolkit import ForceField, Molecule, Topology\n",
"from openff.units import unit\n",
"from openff.toolkit import ForceField, Molecule, unit\n",
"from rich.pretty import pprint\n",
"\n",
"from openff.interchange import Interchange\n",
"from openff.interchange.components._packmol import (\n",
" RHOMBIC_DODECAHEDRON,\n",
" UNIT_CUBE,\n",
" pack_box,\n",
")\n",
"from openff.interchange.interop.openmm import to_openmm_positions"
"from openff.interchange.components._packmol import RHOMBIC_DODECAHEDRON, pack_box"
]
},
{
Expand Down Expand Up @@ -168,19 +162,17 @@
" )\n",
"\n",
" barostat = openmm.MonteCarloBarostat(\n",
" 1.0 * openmm.unit.bar, 293.15 * openmm.unit.kelvin, 25\n",
" 1.0 * openmm.unit.bar,\n",
" 293.15 * openmm.unit.kelvin,\n",
" 25,\n",
" )\n",
"\n",
" simulation = interchange.to_openmm_simulation(\n",
" combine_nonbonded_forces=True,\n",
" integrator=integrator,\n",
" additional_forces=[barostat],\n",
" )\n",
"\n",
" simulation.system.addForce(barostat)\n",
"\n",
" # https://github.com/openmm/openmm/wiki/Frequently-Asked-Questions#why-does-it-ignore-changes-i-make-to-a-system-or-force\n",
" simulation.context.reinitialize(preserveState=True)\n",
"\n",
" # https://github.com/openmm/openmm/issues/3736#issuecomment-1217250635\n",
" simulation.minimizeEnergy()\n",
"\n",
Expand Down Expand Up @@ -245,10 +237,18 @@
" print(f\"Elapsed time: {(end_time - start_time):.2f} seconds\")"
]
},
{
"cell_type": "markdown",
"id": "15",
"metadata": {},
"source": [
"We should observe (small) fluctuations in the density of the simulation, which is running under the NPT ensemble. If the initial density was a good guess, there shouldn't be significant changes from the initial value around $30 nm^3$."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "15",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -257,7 +257,7 @@
},
{
"cell_type": "markdown",
"id": "16",
"id": "17",
"metadata": {},
"source": [
"## Appendix A: visualizing the trajectory\n",
Expand All @@ -268,7 +268,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"id": "18",
"metadata": {
"tags": [
"nbval-skip"
Expand All @@ -283,7 +283,7 @@
},
{
"cell_type": "markdown",
"id": "18",
"id": "19",
"metadata": {},
"source": [
"## Appendix B: Using the OPC water model\n",
Expand All @@ -294,7 +294,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "19",
"id": "20",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -304,7 +304,7 @@
},
{
"cell_type": "markdown",
"id": "20",
"id": "21",
"metadata": {},
"source": [
"We can also get a rough visualization of a single water molecule including the virtual site."
Expand All @@ -313,7 +313,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "21",
"id": "22",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -328,7 +328,7 @@
},
{
"cell_type": "markdown",
"id": "22",
"id": "23",
"metadata": {},
"source": [
"Since we want to use a different force field with the same chemical topology - a ligand in a box of water - we can re-use the same `Topology` object we prepared earlier, re-using the same functions we defined above!"
Expand All @@ -337,7 +337,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "23",
"id": "24",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -350,7 +350,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "24",
"id": "25",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -360,7 +360,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "25",
"id": "26",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -372,7 +372,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "26",
"id": "27",
"metadata": {
"tags": [
"nbval-skip"
Expand Down Expand Up @@ -406,7 +406,7 @@
},
{
"cell_type": "markdown",
"id": "27",
"id": "28",
"metadata": {},
"source": [
"## Appendix C: Using the TIP4P-FB water model with GROMACS\n",
Expand All @@ -417,7 +417,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "28",
"id": "29",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -433,7 +433,7 @@
},
{
"cell_type": "markdown",
"id": "29",
"id": "30",
"metadata": {},
"source": [
"To use a different force field, such as [TIP4P-FB](https://pubs.acs.org/doi/10.1021/jz500737m), simply point the `ForceField` constructor at a different file:"
Expand All @@ -442,7 +442,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "30",
"id": "31",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -451,7 +451,7 @@
},
{
"cell_type": "markdown",
"id": "31",
"id": "32",
"metadata": {},
"source": [
"From here we can create a new `Interchange` object - necessary since we're using a different force field - and use the `Interchange.to_gromacs` method to write GROMACS files."
Expand All @@ -460,7 +460,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "32",
"id": "33",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -473,7 +473,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "33",
"id": "34",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -484,7 +484,7 @@
},
{
"cell_type": "markdown",
"id": "34",
"id": "35",
"metadata": {},
"source": [
"Now, with GROMACS files written, we can use the bundled `run.mdp` file to compile and run a GROMACS simulation!"
Expand All @@ -493,7 +493,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "35",
"id": "36",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -504,7 +504,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "36",
"id": "37",
"metadata": {
"tags": [
"nbval-skip"
Expand Down Expand Up @@ -535,7 +535,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 4 additions & 0 deletions openff/interchange/_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from typing import Optional

import numpy
import pytest
from openff.toolkit import Molecule
from openff.toolkit.utils import (
Expand Down Expand Up @@ -42,6 +43,9 @@
)


_rng = numpy.random.default_rng(12345)


def get_test_file_path(test_file: str) -> pathlib.Path:
"""Given a filename in the collection of data files, return its full path."""
test_dir_path = get_test_files_dir_path()
Expand Down
Loading

0 comments on commit 7a95d55

Please sign in to comment.