From: Lee-Ping Wang (leeping_at_stanford.edu)
Date: Tue Mar 04 2014 - 11:52:59 CST

Hi John,

Thanks for the reply! Here are some more details along with an example:

https://dl.dropboxusercontent.com/u/5381783/vmdscene.png

(1) Ideally I would like for the circle to show up in a ray-traced rendering, so a torus would probably be better than a line drawing. Currently it is only useful for interactive display. In the attached example, I am using colored circles and text to label atoms that have formal charge in a reactive MD simulation. (My script redraws the circle when there is a change in the viewing angle, so it is always in the plane of the image and looks like a circle.)

(2) I'm mainly hoping to get the five platonic solids, because it's cool to draw them as graphics in order to label things. Of course there are lots of cool 3D shapes out there but I think these would be great starting points.

(3) I think this would be awesome. One of the ways I use VMD is to visualize a reaction network where collections of compounds undergo transformations, and if I could mouse-over a reaction node, then I could have it display an image with the reaction barrier.

- Lee-Ping

----- Original Message -----
From: "John Stone" <johns_at_ks.uiuc.edu>
To: "Lee-Ping Wang" <leeping_at_stanford.edu>
Cc: vmd-l_at_ks.uiuc.edu
Sent: Monday, March 3, 2014 8:22:46 AM
Subject: Re: vmd-l: Drawing circles and tooltips.

Hi,
  I have a few short questions for you that will help me answer
your questions in the best way possible.

1) For the "circles" you want to draw, are they merely meant for
   interactive display, as line-drawn circles, or would you prefer
   something that would also show up in a ray traced rendering of
   the scene (e.g. Tachyon, POV-Ray, etc), in which case you'd really
   want a torus and not a circle.

2) What polyhedra are you really after? Are there specific shapes you want?
   Modern OpenGL has moved away from rendering methods that are based on
   immediate mode commands, and even display lists. Small polyhedra fall into
   a gray area between what could be done efficiently with OpenGL 1.x and
   the minimum geometry size that can be drawn with reasonable performance on
   modern hardware oriented towards OpenGL 3.x and 4.x. If you can tell me
   more about what you're doing, I can give a useful answer as to whether it
   is worth building in primitives for this in VMD or not.

3) There isn't a built-in way to do tooltips, and this would be problematic
   for large structures with millions of atoms, but there is a way that a
   user-written script can get callbacks as the mouse moves, and building
   upon this, one could do a tooltip style interface if the number of potential
   targets was moderate, and not all atoms.. :-)
   I will have to dig up the code for this, as it has been some time since
   I last looked at it, but there should be a way to do what you want using
   the VMD mouse event callbacks and a little post-processing of the
   returned coordinates, etc.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Fri, Feb 28, 2014 at 06:58:35AM -0800, Lee-Ping Wang wrote:
> Hi there,
>
>
>
> I'm interested in doing a few things with VMD and I'm wondering if it's
> possible.
>
>
>
> 1) Drawing circles. I have the following TCL snippet for drawing a
> circle but it's kind of slow. I could also use VMD spheres with
> angle-modulated transparency, but in this case I would prefer for it to
> simply be a circle.
>
>
>
> proc vmd_draw_circle {mol cnt ex ey {radius 1.0} {res 36} {thickness 5}} {
>
> # Draw a circle, given the center, two unit vectors, radius,
> resolution and thickness.
>
> set pi 3.1415926535897931
>
> for {set i 0} {$i < $res} {incr i} {
>
> set q0 [expr 2 * $pi * ($i-0.1) / $res]
>
> set r0 [vecadd [vecadd $cnt [vecscale $ex [expr $radius *
> cos($q0)]]] [vecscale $ey [expr $radius * sin($q0)]]]
>
> set q1 [expr 2 * $pi * ($i+1.1) / $res]
>
> set r1 [vecadd [vecadd $cnt [vecscale $ex [expr $radius *
> cos($q1)]]] [vecscale $ey [expr $radius * sin($q1)]]]
>
> graphics $mol line $r0 $r1 width $thickness
>
> }
>
> }
>
>
>
> 2) Drawing small polyhedra. My method is to create atoms at the
> positions of the vertices and use the "Polyhedra" representation.
> However, VMD complains that there are too many bonds and does not draw all
> of the polyhedral faces.
>
>
>
> 3) Tooltips. Is it possible to pop up an image if I mouse-over an
> atom or graphics object?
>
>
>
> Thanks,
>
>
>
> - Lee-Ping Wang

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/