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

Document that topology charges are ignored #1064

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading