VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Sep 25 2014 - 09:34:30 CDT
- Next message: Thomas Sexton: "Labels for part of a trajectory"
- Previous message: Josh Vermaas: "Re: Atom Selection Rectangle"
- In reply to: Bin Liu: "draw geometrical objects on specific frames"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi,
The draw commands don't have a frame parameter as you have already noted.
In order to draw time varying geometry, you will need to write a per-frame
"callback" function that triggers drawing (and deletion) of the geometry
that you want to see on particular trajectory frames. Here is a trivial
example that draw different text on every frame, but you could easily
improve this and draw whatever geometry you like:
##
## Example script showing a way to add user-drawn geometry that updates
## as a trajectory is animated.
##
## To use this script:
## 1) load your trajectory
## 2) source frameupdate.vmd
## 3) enabletrace
## 4) do your thing :-)
## 5) disabletrace
proc enabletrace {} {
global vmd_frame;
trace variable vmd_frame([molinfo top]) w drawcounter
}
proc disabletrace {} {
global vmd_frame;
trace vdelete vmd_frame([molinfo top]) w drawcounter
}
proc drawcounter { name element op } {
global vmd_frame;
draw delete all
# puts "callback!"
draw color white
set psperframe 1.03
set time [format "%8.3f ps" [expr $vmd_frame([molinfo top]) * $psperframe]]
draw text {10 10 0} "$time"
}
On Mon, Sep 22, 2014 at 12:44:59PM -0400, Bin Liu wrote:
> Hi Everyone,
> I was trying to draw some geometrical objects like cones and cylinders on
> a trajectory. The trajectory has multiple frames. But the shapes of the
> geometrical objects are different on different frames.
> I tried commands like this, and it works.
> draw cylinder "27.3923 33.4984 69.2988" "27.1742 33.3549 77.2945" radius
> 0.2
> However when I want to specify the frame on which it will be drawn like
> this, vmd reports unknown option for cylinder
> draw cylinder "27.3923 33.4984 69.2988" "27.1742 33.3549 77.2945" radius
> 0.2 frame 234
> Is there a way to accomplish this? Thanks.
> Best Regards,
> Bin
-- 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/
- Next message: Thomas Sexton: "Labels for part of a trajectory"
- Previous message: Josh Vermaas: "Re: Atom Selection Rectangle"
- In reply to: Bin Liu: "draw geometrical objects on specific frames"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]