moleculekit.vmdviewer module#
- class moleculekit.vmdviewer.VMD(vmd=None, host=None, dispdev='win')#
Bases:
objectA handle to a VMD molecular viewer subprocess.
Each instance launches a VMD process and communicates with it by sending tcl commands through the
send()method. The constructor is not meant to be called directly; obtain a handle through theviewer()orgetCurrentViewer()functions instead.- Parameters:
vmd (
str|None) – Path to the VMD executable. If None the bundled VMD wrapper for the current platform is located automatically.host (
str|None) – Hostname passed to VMD with the--hostargument. If None no host is specified.dispdev (
str) – The graphical display device to use, passed to VMD with the--dispdevargument (e.g.'win'or'text').
- close()#
Close the viewer by sending the VMD
exitcommand.
- completed()#
Check if the viewer has been closed
- Returns:
comp – Returns True if the VMD viewer has closed
- Return type:
- copy()#
Return a copy of the viewer handle.
- Returns:
copy – Viewer handles are not copyable, so None is returned.
- Return type:
- movie_reps()#
Add default settings and representations for creating movies with Tachyon in VMD.
Clears the existing representations of the top molecule and sets up depth cueing, shadows, ambient occlusion, depth of field and a white background, together with VDW representations for the protein and the non-protein heavy atoms.
- 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 imagerenderer (
str) – Which renderer to useresolution (
tuple|None) – X,Y resolution of the output image i.e. (1920, 1080). Only used with the renderer=’tachyon’ option.aasamples (
int|None) – Number of anti-aliasing samples. Only used with the renderer=’tachyon’ option.skylight (
float|None) – Add a skylight. Only used with the renderer=’tachyon’ option.tachyon (
str|None) – Path to tachyon renderer executable. Only used with the renderer=’tachyon’ option.convert (
bool|None) – Attempts to convert the image to the datatype of the outfile extensiontrim (
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) – 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 tealsel (
str) – Atom selection string for the ligand mode. See more herecolor (
int) – Color for the ligand. Use color numbers of VMD
- moleculekit.vmdviewer.getCurrentViewer(dispdev='win')#
Get the handle to the current molecular viewer
- Parameters:
dispdev (
str) – 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:
VMDobject
- moleculekit.vmdviewer.viewer(dispdev='win')#
Start a new molecular viewer
- Parameters:
dispdev (
str) – 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 a new viewer
- Return type:
VMDobject