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- residue (
-
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: RuntimeErrorwhen required atom can not be found in residue- 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
- name (
-
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
- name (
-
RemoveInteractionsToPrev()¶ Removes all interactions associated to an atom of a previous residues. This gets indicated in the
BuildingBlockby an atom name prefixed by a -
-
RemoveInteractionsToNext()¶ Removes all interactions associated to an atom of a next residues. This gets indicated in the
BuildingBlockby 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.
- bond (
-
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.
- angle (
-
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.
- dihedral (
-
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.
- improper (
-
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.
- exclusion (
-
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.
- cmap (
-
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.
- constraint (
-
GetType(name)¶ Gets forcefield type from atom with given name
Parameters: name ( str) – Name of atom you want the type fromReturns: strRaises: RuntimeErrorwhen 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 fromReturns: floatRaises: RuntimeErrorwhen 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 fromReturns: floatRaises: RuntimeErrorwhen atom can not be found in BuildingBlock
-
GetAtoms()¶ Returns: listof all atom names
-
GetTypes()¶ Returns: listof all atom types
-
GetCharges()¶ Returns: listof all charges
-
GetMasses()¶ Returns: listof all masses
-
GetBonds()¶ Returns: listof all bonds
-
GetAngles()¶ Returns: listof all angles
-
GetDihedrals()¶ Returns: listof all dihedrals
-
GetImpropers()¶ Returns: listof all impropers
-
GetCMaps()¶ Returns: listof all cmaps
-
GetExclusions()¶ Returns: listof all exlusions
-
GetConstraints()¶ Returns: listof all constraints
-
Block Modifiers¶
-
class
BlockModifier¶ Basis class. Block modifiers are used to change building blocks or residues. See
GromacsBlockModifierfor a specific example.
-
class
GromacsBlockModifier¶ -
ApplyOnBuildingBlock(block)¶ Applies all defined rules on the given
BuildingBlockParameters: block ( BuildingBlock) – BuildingBlock to be modified
-
ApplyOnResidue(residue)¶ Applies all defined rules on the given
ResidueHandleParameters: 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 aResidueHandle.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
- name (
-
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
BuildingBlockgets modified by adding the new atom definitions and also the corresponding bonds describing the connectivity. In case ofResidueHandlethe 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
- number (
-
AddDeleteAtom(name)¶ Defines an atom that has to be removed. In case of the
BuildingBlockthis removes this particular atom plus all interactions connected to it, in case ofResidueHandle, the atom simply gets deleted.Parameters: name ( str) – Atom to be deleted
-
AddBond(bond)¶ Adds a bond, this only has effect on
BuildingBlock, not onResidueHandlewhen the corresponding Apply function gets calledParameters: bond ( Interaction) – Bond to be added
-
AddAngle(angle)¶ Adds an angle, this only has effect on
BuildingBlock, not onResidueHandlewhen the corresponding Apply function gets calledParameters: angle ( Interaction) – Angle to be added
-
AddDihedral(dihedral)¶ Adds a dihedral, this only has effect on
BuildingBlock, not onResidueHandlewhen the corresponding Apply function gets calledParameters: dihedral ( Interaction) – Dihedral to be added
-
AddImproper(improper)¶ Adds an improper, this only has effect on
BuildingBlock, not onResidueHandlewhen the corresponding Apply function gets calledParameters: improper ( Interaction) – Improper to be added
-
AddCMap(cmap)¶ Adds a cmap, this only has effect on
BuildingBlock, not onResidueHandlewhen the corresponding Apply function gets calledParameters: cmap ( Interaction) – CMap to be added
-
Hydrogen Constructors¶
-
class
HydrogenConstructor¶ Basis class. Hydrogen constructors are used to add hydrogens to residues.
-
class
GromacsHydrogenConstructor¶ The
GromacsHydrogenConstructoris 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
- number (
-
-
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
HeuristicHydrogenConstructortakes aBuildingBlockat initialization and builds heuristic rules to build hydrogens based on the connecticity defined in the given block.Parameters: block – BuildingBlockfrom 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
-