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
Attributes
anglesThe list of angles in the topology.
atomsThe list of atoms in the topology.
bondsThe list of bonds in the topology.
impropersThe list of impropers in the topology.
moleculeIt returns the molecule that belongs to this topology element.
parametersIt returns the parameter wrapper that belongs to this topology element.
propersThe list of propers in the topology.
-