htmd.builder.charmm module#

htmd.builder.charmm.build(mol, topo=None, prefix='structure', outdir='./build', caps=None, ionize=True, saltconc=0, saltanion=None, saltcation=None, disulfide=None, regenerate=['angles', 'dihedrals'], patches=None, noregen=None, aliasresidues=None, psfgen=None, execute=True, _clean=True)#

Build a system for CHARMM.

Uses psfgen to build a system for CHARMM. Additionally allows for ionization and adding disulfide bridges.

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

  • topo (list | None) – A list of topology files (.rtf or CHARMM .str stream files). Stream files are passed to psfgen’s topology command; psfgen parses the RTF portion and ignores the PARAMETER sections. Use charmm.listFiles to get a list of available topology/stream files. If None, uses defaultTopo.

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

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

  • caps (dict | None) – A dictionary with keys as segids and values as lists of strings describing the caps of that segment. e.g. caps['P'] = ['first ACE', 'last CT3'] or caps['P'] = ['first none', 'last none']. If None, ACE and CT3 caps are applied to proteins and none to the rest.

  • 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. Use CHARMM ion atom names (e.g. 'CLA').

  • saltcation (str | None) – The cation type. Use CHARMM ion atom names (e.g. 'SOD', 'MG', 'POT', 'CES', 'CAL', 'ZN2').

  • 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.

  • regenerate (list | None) – Angle/dihedral regeneration control. Pass None to disable, or a list of 'angles' and/or 'dihedrals' to enable selectively.

  • patches (list | str | None) – Additional psfgen patches to apply.

  • noregen (list | None) – A list of patch names that must not have angles/dihedrals regenerated. If None, uses ['FHEM', 'PHEM', 'PLOH', 'PLO2', 'PLIG', 'PSUL'].

  • aliasresidues (dict | None) – A dictionary of {old_name: new_name} residue name aliases.

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

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

Returns:

molbuilt – The built system as a Molecule object.

Return type:

Molecule

Examples

>>> from htmd.ui import *
>>> mol = Molecule("3PTB")
>>> mol.filter("not resname BEN")
>>> molbuilt = charmm.build(mol, outdir='/tmp/build', ionize=False)
Bond between A: [serial 185 resid 42 resname CYS chain A segid 0]
             B: [serial 298 resid 58 resname CYS chain A segid 0]...
>>> # More complex example
>>> topos = ['top/top_all36_prot.rtf', './BEN.rtf', 'top/top_water_ions.rtf']
>>> disu = [['segid P and resid 157', 'segid P and resid 13'], ['segid K and resid 1', 'segid K and resid 25']]
>>> ar = {'SAPI24': 'SP24'}  # Alias large resnames to a short-hand version
>>> molbuilt = charmm.build(mol, topo=topos, outdir='/tmp/build', saltconc=0.15, disulfide=disu, aliasresidues=ar)
htmd.builder.charmm.defaultTopo()#

Returns the default topology/stream files used by charmm.build.

htmd.builder.charmm.htmdCharmmHome()#

Returns the location of the CHARMM files distributed with HTMD

htmd.builder.charmm.listFiles()#

Lists all available Charmm topology, parameter and stream files.

charmm.build only consumes topology/stream files, but parameter files are listed too since the user typically needs to copy them (or equivalent stream files) into their simulation directory to run MD afterwards.

Examples

>>> from htmd.builder import charmm
>>> charmm.listFiles()
---- Topologies files list...
htmd.builder.charmm.search(key, name)#

Search CHARMM files for entries containing a given definition.

Parameters:
  • key (str) – The keyword to search for (e.g. 'RESI', 'ATOM').

  • name (str) – The name associated with the keyword (e.g. a residue or atom name).

Return type:

None

Examples

>>> charmm.search(key='RESI', name='CHL1')