htmd.builder.builder module#

exception htmd.builder.builder.BuildError(text, errors=())#

Bases: Exception

exception htmd.builder.builder.MissingAngleError(text, values=())#

Bases: _MissingErrorType

exception htmd.builder.builder.MissingAtomTypeError(text, values=())#

Bases: _MissingErrorType

exception htmd.builder.builder.MissingBondError(text, values=())#

Bases: _MissingErrorType

exception htmd.builder.builder.MissingParameterError(text, values=())#

Bases: _MissingErrorType

exception htmd.builder.builder.MissingResidueError(text, values=())#

Bases: _MissingErrorType

exception htmd.builder.builder.MissingTorsionError(text, values=())#

Bases: _MissingErrorType

exception htmd.builder.builder.MixedSegmentError#

Bases: Exception

exception htmd.builder.builder.ResidueInsertionError#

Bases: Exception

htmd.builder.builder.convertDisulfide(mol, disu)#
htmd.builder.builder.detectCisPeptideBonds(mol, respect_bonds=False)#
htmd.builder.builder.detectDisulfideBonds(mol, thresh=3)#

Automatically detects disulfide bonds in a molecule

Parameters:
  • mol (Molecule object) – The molecule for which to detect disulfide bonds

  • thresh (float) – The threshold under which two sulfurs are considered as bonded

Returns:

disubonds – A list of UniqueResidueID objects

Return type:

np.ndarray

htmd.builder.builder.embed(mol1, mol2, gap=1.3)#

Embeds one molecule into another removing overlaps.

Will remove residues of mol2 which have collisions with atoms of mol1.

Parameters:
  • mol1 (Molecule object) – The first Molecule object

  • mol2 (Molecule object) – The second Molecule object

  • gap (float) – Minimum space in A between atoms of the two molecules

Returns:

newmol – The resulting Molecule object

Return type:

Molecule object

Example

>>> all = embed(memb, prot)
htmd.builder.builder.minimalRotation(prot)#

Find the rotation around Z that minimizes the X and Y dimensions of the protein to best fit in a box.

Essentially PCA in 2D

htmd.builder.builder.removeAtomsInHull(mol1, mol2, hullsel, removesel)#

Calculates the convex hull of an atom selection in mol1 and removes atoms within that hull in mol2.

Parameters:
  • mol1 (Molecule object) – Molecule for which to calculate the convex hull

  • mol2 (Molecule object) – Molecule which contains the atoms which we check if they are within the hull

  • hullsel (str) – Atom selection string for atoms in mol1 from which to calculate the convex hull. See more here

  • removesel (str) – Atom selection string for atoms in mol2 from which to remove the ones which are within the hull. See more here

Returns:

  • newmol2 (Molecule) – mol2 but without any atoms located within the convex hull

  • numrem (int) – Number of fragments removed

htmd.builder.builder.removeHET(prot)#
htmd.builder.builder.removeLipidsInProtein(prot, memb, lipidsel='lipids')#

Calculates the convex hull of the protein. If a lipid lies inside the hull it gets removed.

This does not work well for lipids crossing out of the hull. If even one atom of the lipid is outside it will change the hull and will not get removed. I assume it will get removed by the clashes with the protein though.

htmd.builder.builder.tileMembrane(memb, xmin, ymin, xmax, ymax, buffer=1.5)#

Tile a membrane in the X and Y dimensions to reach a specific size.

Parameters:
  • memb (Molecule object) – The membrane to be tiled

  • xmin (float) – Minimum x coordinate

  • ymin (float) – Minimum y coordinate

  • xmax (float) – Maximum x coordinate

  • ymax (float) – Maximum y coordinate

  • buffer (float) – Buffer distance between tiles

Returns:

A big membrane Molecule

Return type:

megamemb