This document is for OpenStructure version 1.6, the latest version is 2.9.0 !

Blocks

The most basic type of residue description is the BuildingBlock. It contains information on atom names and their corresponding types, charges and optionally also their masses. Interactions for all particles can also be defined even though they are optional, except the bonds giving information about the connectivity. You often need to manipulate building blocks or the residues they refer to in an automated manner. That’s where the BlockModifiers come in, with the GromacsBlockModifier as a specific implementation. As a special case there also exist HydrogenConstructors.

The BuildingBlock Class

class BuildingBlock
Match(residue[, match_connectivity=True])

Checks, whether the given residue matches the atom names in the BuildingBlock. The connectivity gets checked optionally.

Parameters:
  • residue (ResidueHandle) –
  • match_connectivity (bool) – If set to true, the function checks the bonds in the residue with the defined bonds in the BuildingBlock
Returns:

bool

Connect(residue, editor)

Connects atoms of residue based on the bond definitions of the BuildingBlock.

Parameters:
  • residue (ResidueHandle) – Residue to be connected
  • editor (XCSEditor) – Editor associated to the residue’s entity
Raises:

RuntimeError when required atom can not be found in residue

AddAtom(name, type, charge[, mass = None])
Parameters:
  • name (str) – Name of atom
  • type (str) – Its corresponding forcefield type
  • charge (float) – Its charge
  • mass (float) – Its mass
RemoveAtom(name)

Removes atom from BuildingBlock with all its associated values and interactions

Parameters:name (str) – Name of atom to be removed
ReplaceAtom(name, new_name, new_type, new_charge[, new_mass = None])

Replace given atom by resetting name, type, charge and mass. All interactions containing that atom get adapted as well

Parameters:
  • name (str) – Name of atom to be replaced
  • new_name (str) – New name of atom
  • new_type (str) – New type of atom
  • new_charge (float) – New charge of atom
  • new_mass (float) – New mass of atom
RemoveInteractionsToPrev()

Removes all interactions associated to an atom of a previous residues. This gets indicated in the BuildingBlock by an atom name prefixed by a -

RemoveInteractionsToNext()

Removes all interactions associated to an atom of a next residues. This gets indicated in the BuildingBlock by an atom name prefixed by a +

AddBond(bond[, replace_existing = False])
Parameters:
  • bond (Interaction) – Bond to be added
  • replace_existing (bool) – Whether potentially already existing bond for the same atoms should be replaced.
AddAngle(angle[, replace_existing = False])
Parameters:
  • angle (Interaction) – Angle to be added
  • replace_existing (bool) – Whether a potentially already existing angle for the same atoms should be replaced.
AddDihedral(dihedral[, replace_existing = False])
Parameters:
  • dihedral (Interaction) – Dihedral to be added
  • replace_existing (bool) – Whether potentially already existing dihedral for the same atoms should be replaced.
AddImproper(improper[, replace_existing = False])
Parameters:
  • improper (Interaction) – Improper to be added
  • replace_existing (bool) – Whether potentially already existing improper for the same atoms should be replaced.
AddExclusion(exclusion[, replace_existing = False])
Parameters:
  • exclusion (Interaction) – Exclusion to be added
  • replace_existing (bool) – Whether potentially already existing Exclusion for the same atoms should be replaced.
AddCMap(cmap[, replace_existing = False])
Parameters:
  • cmap (Interaction) – CMap to be added
  • replace_existing (bool) – Whether potentially already existing cmap for the same atoms should be replaced.
AddConstraint(constraint[, replace_existing = False])
Parameters:
  • constraint (Interaction) – Constraint to be added
  • replace_existing (bool) – Whether potentially already existing constraint for the same atoms should be replaced.
GetType(name)

Gets forcefield type from atom with given name

Parameters:name (str) – Name of atom you want the type from
Returns:str
Raises:RuntimeError when atom can not be found in BuildingBlock
GetCharge(name)

Gets charge from atom with given name

Parameters:name (str) – Name of atom you want the charge from
Returns:float
Raises:RuntimeError when atom can not be found in BuildingBlock
GetMass(name)

Gets mass from atom with given name

Parameters:name (str) – Name of atom you want the mass from
Returns:float
Raises:RuntimeError when atom can not be found in BuildingBlock
GetAtoms()
Returns:list of all atom names
GetTypes()
Returns:list of all atom types
GetCharges()
Returns:list of all charges
GetMasses()
Returns:list of all masses
GetBonds()
Returns:list of all bonds
GetAngles()
Returns:list of all angles
GetDihedrals()
Returns:list of all dihedrals
GetImpropers()
Returns:list of all impropers
GetCMaps()
Returns:list of all cmaps
GetExclusions()
Returns:list of all exlusions
GetConstraints()
Returns:list of all constraints

Block Modifiers

class BlockModifier

Basis class. Block modifiers are used to change building blocks or residues. See GromacsBlockModifier for a specific example.

class GromacsBlockModifier
ApplyOnBuildingBlock(block)

Applies all defined rules on the given BuildingBlock

Parameters:block (BuildingBlock) – BuildingBlock to be modified
ApplyOnResidue(residue)

Applies all defined rules on the given ResidueHandle

Parameters:residue (ResidueHandle) – Residue to be modified
AddReplaceRule(name, new_name, new_type, new_charge)

Rule, that basically renames an atom and also resets its type and charge in a BuildingBlock. A simple renaming occurs in a ResidueHandle.

Parameters:
  • name (str) – Name of the atom to be changed
  • new_name (str) – Its new name
  • new_type (str) – Its new type
  • new_charge (float) – Its new charge
AddAddRule(number, method, atom_names, anchors, type, charge)

A rule to add new atoms the Gromacs way, see Gromacs Manual for the exact definition of the parameters. A BuildingBlock gets modified by adding the new atom definitions and also the corresponding bonds describing the connectivity. In case of ResidueHandle the new Atoms with connectivity get added with their positions as defined by the Gromacs adding rule.

Parameters:
  • number (int) – Number of atoms to be added
  • method (int) – Gromacs adding rule
  • atom_names (list) – Strings containing the new atom names
  • anchors (list) – Strings containing atom names used as anchor
  • type (str) – The type the atoms will have
  • charge (float) – The charge the atoms will have
AddDeleteAtom(name)

Defines an atom that has to be removed. In case of the BuildingBlock this removes this particular atom plus all interactions connected to it, in case of ResidueHandle, the atom simply gets deleted.

Parameters:name (str) – Atom to be deleted
AddBond(bond)

Adds a bond, this only has effect on BuildingBlock, not on ResidueHandle when the corresponding Apply function gets called

Parameters:bond (Interaction) – Bond to be added
AddAngle(angle)

Adds an angle, this only has effect on BuildingBlock, not on ResidueHandle when the corresponding Apply function gets called

Parameters:angle (Interaction) – Angle to be added
AddDihedral(dihedral)

Adds a dihedral, this only has effect on BuildingBlock, not on ResidueHandle when the corresponding Apply function gets called

Parameters:dihedral (Interaction) – Dihedral to be added
AddImproper(improper)

Adds an improper, this only has effect on BuildingBlock, not on ResidueHandle when the corresponding Apply function gets called

Parameters:improper (Interaction) – Improper to be added
AddCMap(cmap)

Adds a cmap, this only has effect on BuildingBlock, not on ResidueHandle when the corresponding Apply function gets called

Parameters:cmap (Interaction) – CMap to be added

Hydrogen Constructors

class HydrogenConstructor

Basis class. Hydrogen constructors are used to add hydrogens to residues.

class GromacsHydrogenConstructor

The GromacsHydrogenConstructor is the Gromacs way of adding hydrogens to a structure.

ApplyOnBuildingBlock(block)

Guess what it does: !!ABSOLUTELY NOTHING!! just there for consistency

Parameters:block (BuildingBlock) – Block that won’t be changed at all! Isn’t that awesome?
ApplyOnResidue(residue)

Constructs hydrogens based on the defined hydrogen addition rules

Parameters:residue (ResidueHandle) – Residue to be modified
AddHydrogenRule(number, method, hydrogen_names, anchors)

Adds a hydrogen building rule as defined in Gromacs Manual

Parameters:
  • number (int) – Number of hydrogens to be added
  • method (int) – Gromacs adding rule
  • hydrogen_names (list) – Strings containing the hydrogen names
  • anchors (list) – Strings containing atom names used as anchor
class HeuristicHydrogenConstructor(block)

As soon as we leave the well defined world of Gromacs residue definitions, we have to find new ways for constructing hydrogens. The HeuristicHydrogenConstructor takes a BuildingBlock at initialization and builds heuristic rules to build hydrogens based on the connecticity defined in the given block.

Parameters:blockBuildingBlock from which the connectivity information for hydrogen construction is extracted
ApplyOnBuildingBlock(block)

Guess what it does: !!ABSOLUTELY NOTHING!! Just there for consistency

Parameters:block (BlockModifier) – Block that won’t be changed at all! Isn’t that awesome?
ApplyOnResidue(residue)

Constructs hydrogen based on heuristic rules

Parameters:residue (ResidueHandle) – Residue to be modified

Search

Enter search terms or a module, class or function name.

Contents

Documentation is available for the following OpenStructure versions:

dev / 2.9.0 / 2.8 / 2.7 / 2.6 / 2.5 / 2.4 / 2.3.1 / 2.3 / 2.2 / 2.1 / 2.0 / 1.9 / 1.8 / 1.7.1 / 1.7 / (Currently viewing 1.6) / 1.5 / 1.4 / 1.3 / 1.2 / 1.11 / 1.10 / 1.1

This documentation is still under heavy development!
If something is missing or if you need the C++ API description in doxygen style, check our old documentation for further information.