All Classes Namespaces Functions Variables Pages
Topology Class Reference

Topology stores the topological information about a system. More...

Inheritance diagram for Topology:

## Public Member Functions

def | __init__
| Create a new Topology object. More...
def | __repr__
def | addChain
| Create a new Chain and add it to the Topology. More...
def | addResidue
| Create a new Residue and add it to the Topology. More...
def | addAtom
| Create a new Atom and add it to the Topology. More...
def | addBond
| Create a new bond and add it to the Topology. More...
def | chains
| Iterate over all Chains in the Topology. More...
def | residues
| Iterate over all Residues in the Topology. More...
def | atoms
| Iterate over all Atoms in the Topology. More...
def | bonds
| Iterate over all bonds (each represented as a tuple of two Atoms) in the Topology. More...
def | getPeriodicBoxVectors
| Get the vectors defining the periodic box. More...
def | setPeriodicBoxVectors
| Set the vectors defining the periodic box. More...
def | getUnitCellDimensions
| Get the dimensions of the crystallographic unit cell. More...
def | setUnitCellDimensions
| Set the dimensions of the crystallographic unit cell. More...
def | createStandardBonds
| Create bonds based on the atom and residue names for all standard residue types. More...
def | createDisulfideBonds
| Identify disulfide bonds based on proximity and add them to the Topology. More...

## Static Public Member Functions

def | loadBondDefinitions
| Load an XML file containing definitions of bonds that should be used by createStandardBonds(). More...

## Detailed Description

Topology stores the topological information about a system.

The structure of a Topology object is similar to that of a PDB file. It consists of a set of Chains (often but not always corresponding to polymer chains). Each Chain contains a set of Residues, and each Residue contains a set of Atoms. In addition, the Topology stores a list of which atom pairs are bonded to each other, and the dimensions of the crystallographic unit cell.

Atom and residue names should follow the PDB 3.0 nomenclature for all molecules for which one exists.

## Constructor & Destructor Documentation

def __init__ | ( |  | self | ) |

Create a new Topology object.

References Topology._bonds, Topology._chains, Topology._numAtoms, Topology._numResidues, Topology._periodicBoxVectors, and GromacsGroFile._periodicBoxVectors.

## Member Function Documentation

def __repr__ | ( |  | self | ) |

References Topology._bonds, Topology._chains, GromacsTopFile._MoleculeType.atoms, Topology.atoms(), ForceField._SystemData.atoms, ForceField._TemplateData.atoms, ForceField._VirtualSiteData.atoms, and Topology.residues().

def addAtom | ( |  | self,
|  |  | name,
|  |  | element,
|  |  | residue,
|  |  | id = `None`
| ) |  |

Create a new Atom and add it to the Topology.

Parameters

  name | (string) The name of the atom to add
  element | (Element) The element of the atom to add
  residue | (Residue) The Residue to add it to
  id | (string=None) An optional identifier for the atom. If this is omitted, an id is generated based on the atom index.

Returns
  the newly created Atom

References Topology._numAtoms.

def addBond | ( |  | self,
|  |  | atom1,
|  |  | atom2
| ) |  |

Create a new bond and add it to the Topology.

Parameters

  atom1 | (Atom) The first Atom connected by the bond
  atom2 | (Atom) The second Atom connected by the bond

Referenced by Topology.createDisulfideBonds(), and Topology.createStandardBonds().

def addChain | ( |  | self,
|  |  | id = `None`
| ) |  |

Create a new Chain and add it to the Topology.

Parameters

  id | (string=None) An optional identifier for the chain. If this is omitted, an id is generated based on the chain index.

Returns
  the newly created Chain

References Topology._chains.

def addResidue | ( |  | self,
|  |  | name,
|  |  | chain,
|  |  | id = `None`
| ) |  |

Create a new Residue and add it to the Topology.

Parameters

  name | (string) The name of the residue to add
  chain | (Chain) The Chain to add it to
  id | (string=None) An optional identifier for the residue. If this is omitted, an id is generated based on the residue index.

Returns
  the newly created Residue

References Topology._numResidues.

def atoms | ( |  | self | ) |

Iterate over all Atoms in the Topology.

References Topology._chains.

Referenced by Topology.__repr__(), and ForceField.registerScript().

def bonds | ( |  | self | ) |

Iterate over all bonds (each represented as a tuple of two Atoms) in the Topology.

References Topology._bonds.

Referenced by ForceField.registerScript().

def chains | ( |  | self | ) |

Iterate over all Chains in the Topology.

References Topology._chains.

def createDisulfideBonds | ( |  | self,
|  |  | positions
| ) |  |

Identify disulfide bonds based on proximity and add them to the Topology.

Parameters

  positions | (list) The list of atomic positions based on which to identify bonded atoms

References Topology.addBond(), ForceField._TemplateData.addBond(), AmoebaBondForce.addBond(), CustomBondForce.addBond(), CustomCompoundBondForce.addBond(), GBVIForce.addBond(), HarmonicBondForce.addBond(), and Topology.residues().

def createStandardBonds | ( |  | self | ) |

Create bonds based on the atom and residue names for all standard residue types.

Definitions for standard amino acids and nucleotides are built in. You can call loadBondDefinitions() to load additional definitions for other residue types.

References Topology._chains, Topology.addBond(), ForceField._TemplateData.addBond(), AmoebaBondForce.addBond(), CustomBondForce.addBond(), CustomCompoundBondForce.addBond(), GBVIForce.addBond(), and HarmonicBondForce.addBond().

def getPeriodicBoxVectors | ( |  | self | ) |

Get the vectors defining the periodic box.

The return value may be None if this Topology does not represent a periodic structure.

References Topology._periodicBoxVectors, and GromacsGroFile._periodicBoxVectors.

def getUnitCellDimensions | ( |  | self | ) |

Get the dimensions of the crystallographic unit cell.

The return value may be None if this Topology does not represent a periodic structure.

References Topology._periodicBoxVectors, and GromacsGroFile._periodicBoxVectors.

def loadBondDefinitions | ( |  | file | ) |

static

Load an XML file containing definitions of bonds that should be used by createStandardBonds().

The built in residues.xml file containing definitions for standard amino acids and nucleotides is loaded automatically. This method can be used to load additional definitions for other residue types. They will then be used in subsequent calls to createStandardBonds(). This is a static method, so it affects subsequent calls on all Topology objects. Also note that PDBFile calls createStandardBonds() automatically when a file is loaded, so the newly loaded definitions will be used for any PDB file loaded after this is called.

def residues | ( |  | self | ) |

Iterate over all Residues in the Topology.

References Topology._chains.

Referenced by Topology.__repr__(), and Topology.createDisulfideBonds().

def setPeriodicBoxVectors | ( |  | self,
|  |  | vectors
| ) |  |

Set the vectors defining the periodic box.

References Topology._periodicBoxVectors, and GromacsGroFile._periodicBoxVectors.

def setUnitCellDimensions | ( |  | self,
|  |  | dimensions
| ) |  |

Set the dimensions of the crystallographic unit cell.

This method is an alternative to setPeriodicBoxVectors() for the case of a rectangular box. It sets the box vectors to be orthogonal to each other and to have the specified lengths.

References Topology._periodicBoxVectors, and GromacsGroFile._periodicBoxVectors.

The documentation for this class was generated from the following file:

- topology.py