Skip to content

Commit

Permalink
Merge pull request #1064 from openforcefield/doc-topology-charges
Browse files Browse the repository at this point in the history
Document that topology charges are ignored
  • Loading branch information
mattwthompson authored Oct 16, 2024
2 parents ea65f20 + ca7ded6 commit 008aefe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/using/edges.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Currently, the `Interchange.topology` attribute is defined by the OpenFF Toolkit

For example, `Interchange.topology.get_positions()` will never include positions of virtual sites. To get the positions of a system with virtual sites included, use `Interchange.get_positions()`. The default behavior of `Interchange.positions` is also to return positions without virtual sites, but this may change in the future.

### Existing charges are ignored by default

`Molecule` and `Topology` objects can store partial charges, but these are ignored by default in methods like `Interchange.from_smirnoff`. This is because partial charges in SMIRNOFF force fields are defined by sections in the force field. To override this behavior, use the `charge_from_molecules` argument. Be aware that charges, and as a result most physics, differ from what's perscribed by the contents of the force field.

## Quirks of `from_openmm`

### Modified masses are ignored
Expand Down
7 changes: 6 additions & 1 deletion openff/interchange/components/interchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def from_smirnoff(
positions are taken from the molecules in topology, if present on all molecules.
charge_from_molecules : `List[openff.toolkit.molecule.Molecule]`, optional
If specified, partial charges will be taken from the given molecules
instead of being determined by the force field.
instead of being determined by the force field. In either case, charges
on the input topology are ignored.
partial_bond_orders_from_molecules : List[openff.toolkit.molecule.Molecule], optional
If specified, partial bond orders will be taken from the given molecules
instead of being determined by the force field.
Expand All @@ -122,6 +123,10 @@ def from_smirnoff(
If the `Molecule` objects in the `topology` argument each contain conformers, the returned `Interchange` object
will have its positions set via concatenating the 0th conformer of each `Molecule`.
If the `Molecule` objects in the `topology` argument have stored partial charges, these are ignored and charges
are assigned according to the contents of the force field. To override the force field and use preset charges,
use the `charge_from_molecules` argument.
Examples
--------
Generate an Interchange object from a single-molecule (OpenFF) topology and
Expand Down

0 comments on commit 008aefe

Please sign in to comment.