VMD User's Guide
VMD User's Guide
VMD User's Guide
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
proc vmd_draw_arrow {mol start end} {# an arrow is made of a cylinder and a coneset middle [vecadd $start [vecscale 0.9 [vecsub $end $start]]]graphics $mol cylinder $start $middle radius 0.15graphics $mol cone $middle $end radius 0.25}After entering this command into <strong>VMD</strong>, you can use a command such as draw arrow {0 0 0} {1 1 1}to draw an arrow. In addition to defining new commands, user-defined drawing commands canalso be used to override existing commands. For example, if you define vmd draw sphere, thendraw sphere {0 0 0} will call your sphere routine, not the one from graphics.Here’s a quick way to add your own label to an atom selection [§5.3]. This function take theselection text and the labels that atom (in the top molecule) with the given string. It returns withan error if more anything other than one atom is selected.proc label_atom {selection_string label_string} {set sel [atomselect top $selection_string]if {[$sel num] != 1} {error "label_atom: ’$selection_string’ must select 1 atom"}# get the coordinates of the atomlassign [$sel get {x y z}] coord# and draw the textdraw text $coord $label_string}8.3.8 exitQuit <strong>VMD</strong>.8.3.9 graphicsThe graphics command draws low-level graphics primitives. These primitives can be used to drawa box around a molecule, or an arrow between two atoms, or place a text label somewhere in space.The command syntax is graphics , where is a valid molecule id and is one of the commands listed below. To create a “blank” molecule, use the Tcl command mol new.See the draw [§ 8.3.7] command for a possibly more convenient interface. Also refer to the <strong>VMD</strong>script library 1 for some examples of user-defined graphics scripts.As graphical primitives are added to the list they are assigned a unique, increasing id. Thefirst object added is assigned 0, the second is assigned 1, etc. The commands which add an itemreturn its value.• point {x yz}: Draws a point at the given position.• line {x1 y1 z1} {x2 y2 z2} [width w] [style] :Draws either a solid or dashed line of the given width from the first point to the second. Bydefault, this is a solid line of width 1.1 http://www.ks.uiuc.edu/Research/vmd/script library98