openff.interchange.models.TopologyKey

pydantic model openff.interchange.models.TopologyKey[source]

A unique identifier of a segment of a chemical topology.

These refer to a single portion of a chemical graph, i.e. a single valence term, (a bond, angle, or dihedral) or a single atom. These target only the information in the chemical graph and do not store physics parameters. For example, a TopologyKey corresponding to a bond would store the indices of the two atoms that compose the bond, but not the force constant or equilibrium bond length as determined by the force field.

Examples

Create a TopologyKey identifying some speicfic angle

>>> from openff.interchange.models import TopologyKey
>>> this_angle = TopologyKey(atom_indices=(2, 1, 3))
>>> this_angle
TopologyKey(atom_indices=(2, 1, 3), mult=None, bond_order=None)

Create a TopologyKey indentifying just one atom

>>> this_atom = TopologyKey(atom_indices=(4,))
>>> this_atom
TopologyKey(atom_indices=(4,), mult=None, bond_order=None)

Layer multiple TopologyKey objects that point to the same torsion

>>> key1 = TopologyKey(atom_indices=(1, 2, 5, 6), mult=0)
>>> key2 = TopologyKey(atom_indices=(1, 2, 5, 6), mult=1)
>>> assert key1 != key2
Config
  • arbitrary_types_allowed: bool = True

  • json_encoders: dict = {<class ‘openff.units.units.Quantity’>: <function custom_quantity_encoder at 0x7fdff3466f70>}

  • json_loads: function = <function json_loader at 0x7fdff3459280>

  • validate_assignment: bool = True

Fields
field atom_indices: Tuple[int, ...] = ()

The indices of the atoms occupied by this interaction

field mult: Optional[int] = None

The index of this duplicate interaction

field bond_order: Optional[float] = None

If this key represents as topology component subject to interpolation between multiple parameters(s), the bond order determining the coefficients of the wrapped potentials.