From: 孙业平 (sunyeping_at_aliyun.com)
Date: Sat Aug 20 2016 - 13:06:37 CDT

Dear all,
I am making a movie for a MD trajectory in which I want to show the simulation time and simutaneously label several residues. For this purpose I Use the follow script:
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 red  
  set nsperframe 0.02  
  set nsoffset 20
  set time [format "%4.2f ns" [expr ($vmd_frame([molinfo top]) * $nsperframe) + $nsoffset]]
  draw text {40 40 32} "$time"

  set sel1 [atomselect top "segname P1 and resid 63 and name CA"]
  lassign [$sel1 get {x y z}] coord1
  draw text $coord1 "GLU63"

  draw color blue
  set sel2 [atomselect top "segname P1 and resid 66 and name CA"]
  lassign [$sel2 get {x y z}] coord2
  draw text $coord2 "LYS66"

  draw color green
  set sel3 [atomselect top "segname P3 and resid 2 and name CA"]
  lassign [$sel3 get {x y z}] coord3
  draw text $coord3 "ALA2"
 
  set sel4 [atomselect top "segname P3 and resid 3 and name CA"]
  lassign [$sel4 get {x y z}] coord4
  draw text $coord4 "VAL3"
}
This is no problem for the "time" showing. However, the atom labels flap rapidly and can not be visualized clearly. Because I have set the "Trajectory Smoothing Window Size" to 30, I think if I can not do a similar smoothing setting to these atom labels, I can get a satisfying effect. But I don't know how. Could anyone give me some help about this?
Thank you in advance!

Yeping Sun