From: preeda (preeda_at_hlab.iis.u-tokyo.ac.jp)
Date: Fri Apr 20 2007 - 10:04:09 CDT

Dear John and other VMD users,

Now I am trying to test using a trace function.
I just tried to test a example that written on VMD web
http://www.ks.uiuc.edu/Research/vmd/current/ug/node144.html

I saved the following script in a file "test.tcl" on VMD main folder

proc mol_weight {} {
      # use the picked atom's index and molecule id
      global vmd_pick_atom vmd_pick_mol
      set sel [atomselect $vmd_pick_mol "same residue as index
$vmd_pick_atom"]
      set mass 0
      foreach m [$sel get mass] {
            set mass [expr $mass + $m]
      }
      # get residue name and id
      set atom [atomselect $vmd_pick_mol "index $vmd_pick_atom"]
      lassign [$atom get {resname resid}] resname resid
      # print the result
      puts "Mass of $resname $resid = $mass"
}

proc mol_weight_trace_fctn {args} {
      mol_weight
}

trace variable vmd_pick_atom w mol_weight_trace_fctn

Then I typed "source test.tcl" in VMD TkConsole
There is no message like "Mass of *** *** = ***" appears when I pick an
atom in OpenGL Display window

So do u know what I did something wrong? I am sorry if this is a simple
problem.
Your help will be greatly appreciated.

Best Regards,

Preeda