openforcefield.topology.TopologyMolecule

class openforcefield.topology.TopologyMolecule(reference_molecule, topology, local_topology_to_reference_index=None)[source]

TopologyMolecules are built to be an efficient way to store large numbers of copies of the same molecule for parameterization and system preparation.

Warning

This API is experimental and subject to change.

Attributes
angles

Iterable of Tuple[TopologyAtom]: iterator over the angles in this Topology.

atom_start_topology_index

Get the topology index of the first atom in this TopologyMolecule

atoms

Return an iterator of all the TopologyAtoms in this TopologyMolecule

bond_start_topology_index

Get the topology index of the first bond in this TopologyMolecule

bonds

Return an iterator of all the TopologyBonds in this TopologyMolecule

impropers

Iterable of Tuple[TopologyAtom]: iterator over the improper torsions in this Topology.

n_angles

int: number of angles in this Topology.

n_atoms

The number of atoms in this topology.

n_bonds

Get the number of bonds in this TopologyMolecule

n_impropers

int: number of proper torsions in this Topology.

n_particles

Get the number of particles in this TopologyMolecule

n_propers

int: number of proper torsions in this Topology.

n_virtual_sites

Get the number of virtual sites in this TopologyMolecule

particles

Return an iterator of all the TopologyParticles in this TopologyMolecules

propers

Iterable of Tuple[TopologyAtom]: iterator over the proper torsions in this Topology.

reference_molecule

Get the reference molecule for this TopologyMolecule

topology

Get the topology that this TopologyMolecule belongs to

virtual_particle_start_topology_index

Get the topology index of the first virtual particle in this TopologyMolecule

virtual_site_start_topology_index

Get the topology index of the first virtual site in this TopologyMolecule

virtual_sites

Return an iterator of all the TopologyVirtualSites in this TopologyMolecules

Methods

atom(index)

Get the TopologyAtom with a given topology atom index in this TopologyMolecule.

bond(index)

Get the TopologyBond with a given reference molecule index in this TopologyMolecule

from_dict(d)

Static constructor from dictionary representation.

particle(index)

Get the TopologyParticle with a given reference molecule index in this TopologyMolecule

to_dict()

Convert to dictionary representation.

virtual_site(index)

Get the TopologyVirtualSite with a given reference molecule index in this TopologyMolecule

__init__(reference_molecule, topology, local_topology_to_reference_index=None)[source]

Create a new TopologyMolecule.

Parameters
reference_moleculean openforcefield.topology.molecule.Molecule

The reference molecule, with details like formal charges, partial charges, bond orders, partial bond orders, and atomic symbols.

topologyan openforcefield.topology.Topology

The topology that this TopologyMolecule belongs to

local_topology_to_reference_indexdict, optional, default=None

Dictionary of {TopologyMolecule_atom_index : Molecule_atom_index} for the TopologyMolecule that will be built

Methods

__init__(reference_molecule, topology[, …])

Create a new TopologyMolecule.

atom(index)

Get the TopologyAtom with a given topology atom index in this TopologyMolecule.

bond(index)

Get the TopologyBond with a given reference molecule index in this TopologyMolecule

from_dict(d)

Static constructor from dictionary representation.

particle(index)

Get the TopologyParticle with a given reference molecule index in this TopologyMolecule

to_dict()

Convert to dictionary representation.

virtual_site(index)

Get the TopologyVirtualSite with a given reference molecule index in this TopologyMolecule

Attributes

angles

Iterable of Tuple[TopologyAtom]: iterator over the angles in this Topology.

atom_start_topology_index

Get the topology index of the first atom in this TopologyMolecule

atoms

Return an iterator of all the TopologyAtoms in this TopologyMolecule

bond_start_topology_index

Get the topology index of the first bond in this TopologyMolecule

bonds

Return an iterator of all the TopologyBonds in this TopologyMolecule

impropers

Iterable of Tuple[TopologyAtom]: iterator over the improper torsions in this Topology.

n_angles

int: number of angles in this Topology.

n_atoms

The number of atoms in this topology.

n_bonds

Get the number of bonds in this TopologyMolecule

n_impropers

int: number of proper torsions in this Topology.

n_particles

Get the number of particles in this TopologyMolecule

n_propers

int: number of proper torsions in this Topology.

n_virtual_sites

Get the number of virtual sites in this TopologyMolecule

particles

Return an iterator of all the TopologyParticles in this TopologyMolecules

propers

Iterable of Tuple[TopologyAtom]: iterator over the proper torsions in this Topology.

reference_molecule

Get the reference molecule for this TopologyMolecule

topology

Get the topology that this TopologyMolecule belongs to

virtual_particle_start_topology_index

Get the topology index of the first virtual particle in this TopologyMolecule

virtual_site_start_topology_index

Get the topology index of the first virtual site in this TopologyMolecule

virtual_sites

Return an iterator of all the TopologyVirtualSites in this TopologyMolecules

property topology

Get the topology that this TopologyMolecule belongs to

Returns
an openforcefield.topology.Topology
property reference_molecule

Get the reference molecule for this TopologyMolecule

Returns
an openforcefield.topology.molecule.Molecule
property n_atoms

The number of atoms in this topology.

Returns
int
atom(index)[source]

Get the TopologyAtom with a given topology atom index in this TopologyMolecule.

Parameters
indexint

Index of the TopologyAtom within this TopologyMolecule to retrieve

Returns
an openforcefield.topology.TopologyAtom
property atoms

Return an iterator of all the TopologyAtoms in this TopologyMolecule

Returns
an iterator of openforcefield.topology.TopologyAtoms
property atom_start_topology_index

Get the topology index of the first atom in this TopologyMolecule

property virtual_particle_start_topology_index

Get the topology index of the first virtual particle in this TopologyMolecule

bond(index)[source]

Get the TopologyBond with a given reference molecule index in this TopologyMolecule

Parameters
indexint

Index of the TopologyBond within this TopologyMolecule to retrieve

Returns
an openforcefield.topology.TopologyBond
property bonds

Return an iterator of all the TopologyBonds in this TopologyMolecule

Returns
an iterator of openforcefield.topology.TopologyBonds
property n_bonds

Get the number of bonds in this TopologyMolecule

Returns
intnumber of bonds
property bond_start_topology_index

Get the topology index of the first bond in this TopologyMolecule

particle(index)[source]

Get the TopologyParticle with a given reference molecule index in this TopologyMolecule

Parameters
indexint

Index of the TopologyParticle within this TopologyMolecule to retrieve

Returns
an openforcefield.topology.TopologyParticle
property particles

Return an iterator of all the TopologyParticles in this TopologyMolecules

Returns
an iterator of openforcefield.topology.TopologyParticle
property n_particles

Get the number of particles in this TopologyMolecule

Returns
intThe number of particles
virtual_site(index)[source]

Get the TopologyVirtualSite with a given reference molecule index in this TopologyMolecule

Parameters
indexint

Index of the TopologyVirtualSite within this TopologyMolecule to retrieve

Returns
an openforcefield.topology.TopologyVirtualSite
property virtual_sites

Return an iterator of all the TopologyVirtualSites in this TopologyMolecules

Returns
an iterator of openforcefield.topology.TopologyVirtualSite
property n_virtual_sites

Get the number of virtual sites in this TopologyMolecule

Returns
int
property angles

Iterable of Tuple[TopologyAtom]: iterator over the angles in this Topology.

property n_angles

int: number of angles in this Topology.

property propers

Iterable of Tuple[TopologyAtom]: iterator over the proper torsions in this Topology.

property n_propers

int: number of proper torsions in this Topology.

property impropers

Iterable of Tuple[TopologyAtom]: iterator over the improper torsions in this Topology.

property n_impropers

int: number of proper torsions in this Topology.

property virtual_site_start_topology_index

Get the topology index of the first virtual site in this TopologyMolecule

to_dict()[source]

Convert to dictionary representation.

classmethod from_dict(d)[source]

Static constructor from dictionary representation.