Similarly, you can use the callback to generate a sphere when an atom is picked.
proc pick_sphere {args} { global vmd_pick_atom vmd_pick_mol # get the coordinates lassign [[atomselect $vmd_pick_mol "index $vmd_pick_atom"] \ get {x y z}] x y z # draw the sphere draw sphere "$x $y $z" radius 1 }and establish the trace:
trace variable vmd_pick_atom w pick_sphere
Whenever you click on an atom, a sphere will appear at the same location. Since the graphics and the molecule aren't the same graphics object, you may need to reset view to make them aligned.
To turn the trace off:
trace vdelete vmd_pick_atom w pick_sphere