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 connectededitor (
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 atomtype (
str
) – Its corresponding forcefield typecharge (
float
) – Its chargemass (
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 replacednew_name (
str
) – New name of atomnew_type (
str
) – New type of atomnew_charge (
float
) – New charge of atomnew_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 addedreplace_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 addedreplace_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 addedreplace_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 addedreplace_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 addedreplace_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 addedreplace_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 addedreplace_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 aResidueHandle
.- Parameters:
name (
str
) – Name of the atom to be changednew_name (
str
) – Its new namenew_type (
str
) – Its new typenew_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 ofResidueHandle
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 addedmethod (
int
) – Gromacs adding ruleatom_names (
list
) – Strings containing the new atom namesanchors (
list
) – Strings containing atom names used as anchortype (
str
) – The type the atoms will havecharge (
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 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 onResidueHandle
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 onResidueHandle
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 onResidueHandle
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 onResidueHandle
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 onResidueHandle
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 addedmethod (
int
) – Gromacs adding rulehydrogen_names (
list
) – Strings containing the hydrogen namesanchors (
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 aBuildingBlock
at initialization and builds heuristic rules to build hydrogens based on the connecticity defined in the given block.- Parameters:
block –
BuildingBlock
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