htmd.builder.amber module#

htmd.builder.amber.build(mol, ff=None, topo=None, param=None, prefix='structure', outdir='./build', caps=None, ionize=True, saltconc=0, saltanion=None, saltcation=None, disulfide=None, teleap=None, teleapimports=None, execute=True, atomtypes=None, offlibraries=None, gbsa=False, igb=2, custombonds=None, remove=None)#

Build a system for AMBER.

Uses tleap to build a system for AMBER. Additionally allows for ionization and adding disulfide bridges.

Parameters:
  • mol (Molecule) – The Molecule object containing the system.

  • ff (list | None) – A list of leaprc forcefield files. Use amber.listFiles to get a list of available forcefield files. If None, uses amber.defaultFf.

  • topo (list | None) – A list of topology prepi/prep/in/cif files. CIF and MOL2 files are automatically converted to mol2 format. Use amber.listFiles to get a list of available topology files. If None, uses amber.defaultTopo. When passing residues parameterized with the parameterize tool, pass the .cif file.

  • param (list | None) – A list of parameter frcmod files. Use amber.listFiles to get a list of available parameter files. If None, uses amber.defaultParam.

  • prefix (str) – The prefix for the generated pdb and prmtop files.

  • outdir (str) – The path to the output directory.

  • caps (dict | None) – A dictionary specifying the caps. Accepts two formats. First format: keys are segids, values are lists of cap strings for that segment. e.g. caps['P'] = ['ACE', 'NME'] or caps['P'] = ['none', 'none']. If None, ACE and NME caps are applied to every protein segment. Second format: keys are atom selection strings for a residue, values are the cap name. e.g. caps = {"chain A and resid 5": "ACE", "chain A and resid 10": "NME"}.

  • ionize (bool) – Enable or disable ionization.

  • saltconc (float) – Salt concentration (in Molar) to add to the system after neutralization.

  • saltanion (str | None) – The anion type. Available: 'Cl-'. Also accepts 'CL', 'chloride', 'CLA'.

  • saltcation (str | None) – The cation type. Available: 'Na+', 'K+', 'Cs+', 'Mg2+', 'Ca2+', 'Zn2+'. Also accepts formats such as 'NA', 'sodium', 'SOD'.

  • disulfide (list | None) – If None, disulfide bonds are guessed automatically. Otherwise provide a list of pairs of atom selection strings for each pair of residues forming a disulfide bridge.

  • teleap (str | None) – Path to the teLeap executable. If None, located automatically from PATH.

  • teleapimports (list | None) – A list of directory paths to pass to teLeap via the -I flag. If None, determined from amber.defaultAmberHome and amber.htmdAmberHome.

  • execute (bool) – If True, run the full build. If False, only write the tleap input script without building. Ionization is skipped when False.

  • atomtypes (list | None) – Custom atom types as a list of ('type', 'element', 'hybrid') triplets, e.g. [('C1', 'C', 'sp2'), ('CI', 'C', 'sp3')]. See addAtomTypes in AmberTools docs.

  • offlibraries (list | str | None) – A path or list of paths to OFF library files. See loadOFF in AmberTools docs.

  • gbsa (bool) – Modify radii for the GBSA implicit water model.

  • igb (int) – GB model: 1 for mbondi, 2 and 5 for mbondi2, 7 for bondi, 8 for mbondi3. See section 4 of the AMBER manual on the Generalized Born/Surface Area model.

  • custombonds (list | None) – A list of pairs of atom selection strings specifying custom bonds to add.

  • remove (list | None) – A list of atom selection strings. Matching atoms or residues are removed from the system. Useful for removing atoms added during building.

Returns:

molbuilt – The built system as a Molecule object.

Return type:

Molecule

Examples

>>> from htmd.ui import *
>>> mol = Molecule("3PTB")
>>> molbuilt = amber.build(mol, outdir='/tmp/build')
>>> # More complex example
>>> disu = [['segid P and resid 157', 'segid P and resid 13'], ['segid K and resid 1', 'segid K and resid 25']]
>>> molbuilt = amber.build(mol, outdir='/tmp/build', saltconc=0.15, disulfide=disu)
htmd.builder.amber.defaultAmberHome(teleap=None)#

Return the default AMBERHOME directory.

Determined from the location of the teLeap binary, or the tleap_pyodide package directory when running in a pyodide environment.

Parameters:

teleap (str | None) – Path to the teLeap executable. If None, the executable is located automatically from PATH.

Returns:

amberhome – The AMBERHOME directory path.

Return type:

str

htmd.builder.amber.defaultFf()#

Returns the default leaprc forcefield files used by amber.build

htmd.builder.amber.defaultParam()#

Returns the default parameter frcmod files used by amber.build

htmd.builder.amber.defaultProteinCaps(mol)#

Neutral ACE/NME caps for every protein segment, as a builder default.

Returns {segid: [nterm, cterm]}. A terminus is capped only when its residue is one the force field can build a cap onto (canonical, protonation variant or modified); anything else - a non-canonical residue parameterized in its terminal form, or an existing ACE/NME/NHE - gets "none" and stays as it is. Segments shorter than 10 residues are omitted entirely.

Callers that want to override individual termini should merge their own choices over this dict rather than replacing it, so that break ends and uncappable termini keep being handled here. The available caps are ACE (N-terminal), NME and NHE (C-terminal), and "none" leaves the terminus charged.

htmd.builder.amber.defaultTopo()#

Returns the default topology prepi files used by amber.build

htmd.builder.amber.htmdAmberHome()#

Returns the location of the AMBER files distributed with HTMD

htmd.builder.amber.listFiles()#

Lists all AMBER forcefield files available in HTMD

Example

>>> from htmd.builder import amber
>>> amber.listFiles()
---- Forcefield files list: ... ----
leaprc.amberdyes
leaprc.conste
leaprc.constph
leaprc.DNA.bsc1
...