Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation of from_openmm and related features #1008

Merged
merged 5 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ using/collections.md
using/migrating.md
using/plugins.md
using/status.md
using/edges.md
using/experimental.md

```
Expand Down
33 changes: 33 additions & 0 deletions docs/using/edges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Sharp edges

## Quirks of `from_openmm`

### Modified masses are ignored

The OpenFF Toolkit does not support isotopes or modifiying masses from the values defined in the periodic table. In the `Topology` and `Molecule` classes, particles masses are defined only by their atomic number. When topologies are read from OpenMM, the particle mass is ignored and the atomic number of the element is read and used to define the atomic properties.
mattwthompson marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternate:

Suggested change
The OpenFF Toolkit does not support isotopes or modifiying masses from the values defined in the periodic table. In the `Topology` and `Molecule` classes, particles masses are defined only by their atomic number. When topologies are read from OpenMM, the particle mass is ignored and the atomic number of the element is read and used to define the atomic properties.
The OpenFF Toolkit does not support isotopes or modifying masses from the values defined in the periodic table. In the `Topology` and `Molecule` classes, particles masses are defined only by their atomic number. When topologies are read from OpenMM, the particle mass is ignored and the atomic number of the element is read and used to define the atomic properties.


As a consequence, systems with hydrogen mass repartitioning (HMR) applied have HMR "un-done" (masses are effectively shifted from hydrogens back to their heavy atoms). To re-apply HMR (shift masses back to hydrogens), use the API at export time, likely with a `hydrogen_mass` argument in an export method.
mattwthompson marked this conversation as resolved.
Show resolved Hide resolved

For updates, [search "HMR" in the issue tracker](https://github.com/search?q=repo%3Aopenforcefield%2Fopenff-interchange+hmr&type=issues&s=updated&o=desc) or raise a [new issue](https://github.com/openforcefield/openff-interchange/issues/new/choose).

Keywords: OpenMM, HMR, hydrogen mass repartioning

### Force constants of constrained bonds may be lost in conversions

Commonly, OpenMM systems prepared by other tools constrain bonds (i.e. bonds between hydrogen and heavy atoms) and/or use rigid waters. These (topological) bonds lack force constants, which may be required by other engines.
mattwthompson marked this conversation as resolved.
Show resolved Hide resolved

For example, consider an OpenMM system prepared, from the OpenMM API, with `ForceField.createSystem(..., constraints=HBonds, rigidWaters=True)` and then imported with `Interchange.from_openmm`. The constrained bonds (including all bonds in waters) don't contain physics parameters (force constant `k` and equilibrium bond length). (These parameters are allowed to exist in a `HarmonicBondForce`, and sometimes they do, but there's also no reason for them to be defined when running OpenMM simulations with these constraints, so they're usually dropped.) When exporting this system to GROMACS or another engine that needs these parameters, the export will either crash due to missing parameters or silently write a file with some missing or blank parameters.
mattwthompson marked this conversation as resolved.
Show resolved Hide resolved

For more, see [issue #1005](https://github.com/openforcefield/openff-interchange/issues/1005#issue-2405679510).

Keywords: OpenMM, GROMACS, constraints, bond constraints, rigid water

## Quirks with GROMACS

### Residue indices must be begin at 1
mattwthompson marked this conversation as resolved.
Show resolved Hide resolved

Whether by informal convention or official standard, residue numbers in GROMACS files begin at 1. Other tools may start the residue numbers at 0. If a topology contains residue numbers below 1, exporting to GROMACS will trigger an error (though not necessarily while exporting to other formats). A workaround for 0-indexed residue numbers is to simply increment all residue numbers by 1.

For more, see [issue #1007](https://github.com/openforcefield/openff-interchange/issues/1007)

Keywords: GROMACS, residue number, resnum, residue index
8 changes: 8 additions & 0 deletions openff/interchange/components/interchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@ def to_openmm_system(
system : openmm.System
The OpenMM System object.

Notes
-----
There are some sharp edges and quirks when using this method. Be aware of some documented
issues in the "Sharp edges" section of the user guide. If you encounter surprising
behavior that is not documented, please raise an issue.

https://docs.openforcefield.org/projects/interchange/en/stable/using/edges.html

mattwthompson marked this conversation as resolved.
Show resolved Hide resolved
"""
from openff.interchange.interop.openmm import (
to_openmm_system as _to_openmm_system,
Expand Down
Loading