peleffy.topology.Topology

class peleffy.topology.Topology(molecule, parameters)[source]

It represents the topology of a molecule.

__init__(molecule, parameters)[source]

It initializes a molecular topology representation, given a molecule and its parameters.

Parameters
  • molecule (a peleffy.topology.Molecule) – The peleffy’s Molecule object whose topology will be built

  • parameters (a BaseParameterWrapper) – The parameter wrapper belonging to the molecule

Examples

Load a molecule from a PDB file, parameterize it with a force field and generate its topology

>>> from peleffy.topology import Molecule
>>> molecule = Molecule('molecule.pdb')
>>> molecule.parameterize('openff_unconstrained-1.2.0.offxml')
>>> from peleffy.forcefield import OpenForceField
>>> openff = OpenForceField('openff_unconstrained-1.2.1.offxml')
>>> parameters = openff.parameterize(molecule)
>>> from peleffy.topology import Topology
>>> topology = Topology(molecule, parameters)

Once a topology has been built, topological elements such as atoms, bonds, angles and dihedrals are easily accessible through the attributes below

>>> topology.atoms
>>> topology.bonds
>>> topology.angles
>>> topology.propers
>>> topology.impropers
add_OFF_improper(improper)[source]

It adds an improper dihedral to the molecule’s list of OFF impropers.

Parameters

improper (an peleffy.topology.OFFImproper) – The OFFImproper to add

add_OFF_proper(proper)[source]

It adds a proper dihedral to the molecule’s list of OFF propers.

Parameters

proper (an peleffy.topology.OFFProper) – The OFFProper to add

add_angle(angle)[source]

It adds an angle to the molecule’s list of angles.

Parameters

angle (an peleffy.topology.Angle) – The Angle to add

add_atom(atom)[source]

It adds an atom to the molecule’s list of atoms.

Parameters

atom (an peleffy.topology.Atom) – The Atom to add

add_bond(bond)[source]

It adds a bond to the molecule’s list of bonds.

Parameters

bond (an peleffy.topology.Bond) – The Bond to add

add_improper(improper)[source]

It adds an improper dihedral to the molecule’s list of impropers.

Parameters

improper (an peleffy.topology.Improper) – The Improper to add

add_proper(proper)[source]

It adds a proper dihedral to the molecule’s list of propers.

Parameters

proper (an peleffy.topology.Proper) – The Proper to add

Attributes

angles

The list of angles in the topology.

atoms

The list of atoms in the topology.

bonds

The list of bonds in the topology.

impropers

The list of impropers in the topology.

molecule

It returns the molecule that belongs to this topology element.

parameters

It returns the parameter wrapper that belongs to this topology element.

propers

The list of propers in the topology.