# Modeller Class Reference

Modeller provides tools for editing molecular models, such as adding water or missing hydrogens. More...

List of all members.

## Classes
class | _Hydrogen
| Inner class used to encapsulate data about a hydrogen atom.
class | _ResidueData
| Inner class used to encapsulate data about the hydrogens for a residue.
## Public Member Functions
def | __init__
| Create a new Modeller object.
def | getTopology
| Get the Topology of the model.
def | getPositions
| Get the atomic positions.
def | add
| Add chains, residues, atoms, and bonds to the model.
def | delete
| Delete chains, residues, atoms, and bonds from the model.
def | deleteWater
| Delete all water molecules from the model.
def | convertWater
| Convert all water molecules to a different water model.
def | addSolvent
| Add solvent (both water and ions) to the model to fill a rectangular box.
def | loadHydrogenDefinitions
| Load an XML file containing definitions of hydrogens that should be added by addHydrogens().
def | addHydrogens
| Add missing hydrogens to the model.
def | addExtraParticles
| Add missing extra particles to the model that are required by a force field.
## Public Attributes
| topology
| The Topology describing the structure of the system.
| positions
| The list of atom positions.

## Detailed Description

Modeller provides tools for editing molecular models, such as adding water or missing hydrogens.

To use it, create a Modeller object, specifying the initial Topology and atom positions. You can then call various methods to change the model in different ways. Each time you do, a new Topology and list of coordinates is created to represent the changed model. Finally, call getTopology() and getPositions() to get the results.

## Member Function Documentation

def __init__ | ( |  | self,
|  |  | topology,
|  |  | positions |
| ) |  |  |

Create a new Modeller object.

Parameters:

  | topology | (Topology) the initial Topology of the model
  | positions | (list) the initial atomic positions

def add | ( |  | self,
|  |  | addTopology,
|  |  | addPositions |
| ) |  |  |

Add chains, residues, atoms, and bonds to the model.

Specify what to add by providing a new Topology object and the corresponding atomic positions. All chains, residues, atoms, and bonds contained in the Topology are added to the model.

Parameters:

  | addTopoology | (Topology) a Topology whose contents should be added to the model
  | addPositions | (list) the positions of the atoms to add

def addExtraParticles | ( |  | self,
|  |  | forcefield |
| ) |  |  |

Add missing extra particles to the model that are required by a force field.

Some force fields use "extra particles" that do not represent actual atoms, but still need to be included in the System. Examples include lone pairs, Drude particles, and the virtual sites used in some water models to adjust the charge distribution. Extra particles can be recognized by the fact that their element is None.

This method is primarily used to add extra particles, but it can also remove them. It tries to match every residue in the Topology to a template in the force field. If there is no match, it will both add and remove extra particles as necessary to make it match.

Parameters:

  | forcefield | (ForceField) the ForceField defining what extra particles should be present

def addHydrogens | ( |  | self,
|  |  | forcefield = `None`,
|  |  | pH = `7.0`,
|  |  | variants = `None`,
|  |  | platform = `None` |
| ) |  |  |

Add missing hydrogens to the model.

Some residues can exist in multiple forms depending on the pH and properties of the local environment. These variants differ in the presence or absence of particular hydrogens. In particular, the following variants are supported:

Aspartic acid: ASH: Neutral form with a hydrogen on one of the delta oxygens ASP: Negatively charged form without a hydrogen on either delta oxygen

Cysteine: CYS: Neutral form with a hydrogen on the sulfur CYX: No hydrogen on the sulfur (either negatively charged, or part of a disulfide bond)

Glutamic acid: GLH: Neutral form with a hydrogen on one of the epsilon oxygens GLU: Negatively charged form without a hydrogen on either epsilon oxygen

Histidine: HID: Neutral form with a hydrogen on the ND1 atom HIE: Neutral form with a hydrogen on the NE2 atom HIP: Positively charged form with hydrogens on both ND1 and NE2

Lysine: LYN: Neutral form with two hydrogens on the zeta nitrogen LYS: Positively charged form with three hydrogens on the zeta nitrogen

The variant to use for each residue is determined by the following rules:

1. The most common variant at the specified pH is selected. 2. Any Cysteine that participates in a disulfide bond uses the CYX variant regardless of pH. 3. For a neutral Histidine residue, the HID or HIE variant is selected based on which one forms a better hydrogen bond.

You can override these rules by explicitly specifying a variant for any residue. Also keep in mind that this function will only add hydrogens. It will never remove ones that are already present in the model, regardless of the specified pH.

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

Parameters:

  | forcefield | (ForceField=None) the ForceField to use for determining the positions of hydrogens. If this is None, positions will be picked which are generally reasonable but not optimized for any particular ForceField.
  | pH | (float=7.0) the pH based on which to select variants
  | variants | (list=None) an optional list of variants to use. If this is specified, its length must equal the number of residues in the model. variants[i] is the name of the variant to use for residue i (indexed starting at 0). If an element is None, the standard rules will be followed to select a variant for that residue.
  | platform | (Platform=None) the Platform to use when computing the hydrogen atom positions. If this is None, the default Platform will be used.

Returns:
  a list of what variant was actually selected for each residue, in the same format as the variants parameter

def addSolvent | ( |  | self,
|  |  | forcefield,
|  |  | model = `'tip3p'`,
|  |  | boxSize = `None`,
|  |  | padding = `None`,
|  |  | positiveIon = `'Na+'`,
|  |  | negativeIon = `'Cl-'`,
|  |  | ionicStrength = `0*molar` |
| ) |  |  |

Add solvent (both water and ions) to the model to fill a rectangular box.

The algorithm works as follows: 1. Water molecules are added to fill the box. 2. Water molecules are removed if their distance to any solute atom is less than the sum of their van der Waals radii. 3. If the solute is charged, enough positive or negative ions are added to neutralize it. Each ion is added by randomly selecting a water molecule and replacing it with the ion. 4. Ion pairs are added to give the requested total ionic strength.

The box size can be specified in three ways. First, you can explicitly give a box size to use. Alternatively, you can give a padding distance. The largest dimension of the solute (along the x, y, or z axis) is determined, and a cubic box of size (largest dimension)+2*padding is used. Finally, if neither a box size nor a padding distance is specified, the existing Topology's unit cell dimensions are used.

Parameters:

  | forcefield | (ForceField) the ForceField to use for determining van der Waals radii and atomic charges
  | model | (string='tip3p') the water model to use. Supported values are 'tip3p', 'spce', 'tip4pew', and 'tip5p'.
  | boxSize | (Vec3=None) the size of the box to fill with water
  | padding | (distance=None) the padding distance to use
  | positiveIon | (string='Na+') the type of positive ion to add. Allowed values are 'Cs+', 'K+', 'Li+', 'Na+', and 'Rb+'
  | negativeIon | (string='Cl-') the type of negative ion to add. Allowed values are 'Cl-', 'Br-', 'F-', and 'I-'. Be aware that not all force fields support all ion types.
  | ionicStrength | (concentration=0*molar) the total concentration of ions (both positive and negative) to add. This does not include ions that are added to neutralize the system.

def convertWater | ( |  | self,
|  |  | model = `'tip3p'` |
| ) |  |  |

Convert all water molecules to a different water model.

Parameters:

  | model | (string='tip3p') the water model to convert to. Supported values are 'tip3p', 'spce', 'tip4pew', and 'tip5p'.

Deprecated:
  Use addExtraParticles() instead. It performs the same function but in a more general way.

def delete | ( |  | self,
|  |  | toDelete |
| ) |  |  |

Delete chains, residues, atoms, and bonds from the model.

You can specify objects to delete at any granularity: atoms, residues, or chains. Passing in an Atom object causes that Atom to be deleted. Passing in a Residue object causes that Residue and all Atoms it contains to be deleted. Passing in a Chain object causes that Chain and all Residues and Atoms it contains to be deleted.

In all cases, when an Atom is deleted, any bonds it participates in are also deleted. You also can specify a bond (as a tuple of Atom objects) to delete just that bond without deleting the Atoms it connects.

Parameters:

  | toDelete | (list) a list of Atoms, Residues, Chains, and bonds (specified as tuples of Atoms) to delete

def deleteWater | ( |  | self | ) |

Delete all water molecules from the model.

def getPositions | ( |  | self | ) |

Get the atomic positions.

def getTopology | ( |  | self | ) |

Get the Topology of the model.

def loadHydrogenDefinitions | ( |  | file | ) |

Load an XML file containing definitions of hydrogens that should be added by addHydrogens().

The built in hydrogens.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 addHydrogens().

## Member Data Documentation

positions

The list of atom positions.

topology

The Topology describing the structure of the system.

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

- modeller.py