htmd.builder.charmm module#, topo=None, param=None, stream=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)#

Builds a system for CHARMM

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

  • mol (Molecule object) – The Molecule object containing the system

  • topo (list of str) – A list of topology rtf files. Use charmm.listFiles to get a list of available topology files. Default: [‘top/top_all36_prot.rtf’, ‘top/top_all36_lipid.rtf’, ‘top/top_water_ions.rtf’]

  • param (list of str) – A list of parameter prm files. Use charmm.listFiles to get a list of available parameter files. Default: [‘par/par_all36m_prot.prm’, ‘par/par_all36_lipid.prm’, ‘par/par_water_ions.prm’]

  • stream (list of str) – A list of stream str files containing topologies and parameters. Use charmm.listFiles to get a list of available stream files. Default: [‘str/prot/toppar_all36_prot_arg0.str’]

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

  • outdir (str) – The path to the output directory Default: ‘./build’

  • caps (dict) – A dictionary with keys segids and values lists of strings describing the caps of that segment. e.g. caps[‘P’] = [‘first ACE’, ‘last CT3’] or caps[‘P’] = [‘first none’, ‘last none’]. Default: will apply ACE and CT3 caps to proteins and none caps to the rest.

  • ionize (bool) – Enable or disable ionization

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

  • saltanion ({'CLA'}) – The anion type. Please use only CHARMM ion atom names.

  • saltcation ({'SOD', 'MG', 'POT', 'CES', 'CAL', 'ZN2'}) – The cation type. Please use only CHARMM ion atom names.

  • disulfide (list of pairs of atomselection strings) – If None it will guess disulfide bonds. Otherwise provide a list pairs of atomselection strings for each pair of residues forming the disulfide bridge.

  • regenerate (None or list of strings of: ['angles', 'dihedrals']) – Disable angle/dihedral regeneration with regenerate=None, or enable it with regenerate=[‘angles’, ‘diheldrals’] or just one of the two options with regenerate=[‘angles’] or regenerate=[‘diheldrals’].

  • patches (list of str) – Any further patches the user wants to apply

  • noregen (list of str) – A list of patches that must not be regenerated (angles and dihedrals) Default: [‘FHEM’, ‘PHEM’, ‘PLOH’, ‘PLO2’, ‘PLIG’, ‘PSUL’]

  • aliasresidues (dict of aliases) – A dictionary of key: value pairs of residue names we want to alias

  • psfgen (str) – Path to psfgen executable used to build for CHARMM

  • execute (bool) – Disable building. Will only write out the input script needed by psfgen. Does not include ionization.


molbuilt – The built system in a Molecule object

Return type:

Molecule object


>>> from htmd.ui import *
>>> mol = Molecule("3PTB")
>>> mol.filter("not resname BEN")
>>> molbuilt =, 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']
>>> params = ['par/par_all36m_prot.prm', './BEN.prm', 'par/par_water_ions.prm']
>>> 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 =, topo=topos, param=params, outdir='/tmp/build', saltconc=0.15, disulfide=disu, aliasresidues=ar)  
htmd.builder.charmm.combine(prmlist, outfile)#

Combines CHARMM parameter files Take a list of parameters files and combine them into a single file (useful for acemd)

  • prmlist (list) – List of parameter files to combine

  • outfile (str) – Output filename of combined parameter files


Returns the default parameters used by


Returns the default stream files used by


Returns the default topologies used by


Returns the location of the CHARMM files distributed with HTMD


Lists all available Charmm topologies and parameter files


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

Searches for CHARMM files containing a given definition.

  • key (str) – A key

  • name (str) – The corresponding name


>>>'RESI', name = 'CHL1')  
htmd.builder.charmm.split(filename, outdir)#

Splits a stream file into an rtf and prm file.


filename (str) – Stream file name