htmd.vmdviewer module

class htmd.vmdviewer.VMD(vmd=None, host=None, dispdev='win')

Bases: object

Please do not directly call this class constructor. Use the viewer or getCurrentViewer function instead.

Parameters:
  • vmd (str) –
  • host (str) –
  • dispdev (str) –
completed()

Check if the viewer has been closed

Returns:comp – Returns True if the VMD viewer has closed
Return type:bool
copy()
loadMol(mol, name=None)

Load a Molecule object into VMD

Parameters:
  • mol (Molecule object) – The Molecule to load into VMD
  • name (str) – The name to give to the Molecule
render(outfile, renderer='TachyonInternal', resolution=None, aasamples=None, skylight=None, tachyon=None, convert=None, trim=False)

Renders the current VMD scene into a file.

Parameters:
  • outfile (str) – File to which to render image
  • renderer (('TachyonInternal', 'tachyon', 'snapshot')) – Which renderer to use
  • resolution (tuple) – X,Y resolution of the output image i.e. (1920, 1080). Only used with the renderer=’tachyon’ option.
  • aasamples (int) – Number of anti-aliasing samples. Only used with the renderer=’tachyon’ option.
  • skylight (float) – Add a skylight. Only used with the renderer=’tachyon’ option.
  • tachyon (str) – Path to tachyon renderer executable. Only used with the renderer=’tachyon’ option.
  • convert (bool) – Attempts to convert the image to the datatype of the outfile extension
  • trim (bool) – Trims the whitespace of the image
rep(mode, sel='resname MOL', color=0)

Modify representations for the top molecule in VMD

Parameters:
  • mode (str ('protein', 'ligand')) – If set to ‘protein’, it will show a single conformation of the protein with sequence coloring If set to ‘ligand’, it will show all ligands in the specified color and the protein in teal
  • sel (str) – Atom selection string for the ligand mode. See more here
  • color (int) – Color for the ligand. Use color numbers of VMD
send(command)

Send a tcl command to VMD

Parameters:command (str) – The tcl command which to send
htmd.vmdviewer.getCurrentViewer(dispdev='win')

Get the handle to the current molecular viewer

Parameters:dispdev (str, ('win', 'text', 'cave', 'caveforms', 'none')) – Specify the type of graphical display to use. The possible display devices include: win: a standard graphics display window. text: do not provide any graphics display window. cave: use the CAVE virtual environment for display, forms are disabled. caveforms: use the CAVE virtual environment for display and with forms enabled. This is useful with -display machine:0 for remote display of the forms when the CAVE uses the local screen.
Returns:viewer – Returns a handle to the current viewer
Return type:VMD object
htmd.vmdviewer.getVMDpath(vmd=None)
htmd.vmdviewer.viewer(dispdev='win')

Start a new molecular viewer

Returns:viewer – Returns a handle to a new viewer
Return type:VMD object