From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Nov 22 2004 - 21:16:10 CST

Hi,
  The "label list" commands will only list labels that have explicitly
been added. If you want to save the label values to a file, you can
use the "label graph" command to query the value(s) or write them to a file.
While this isn't really what you're looking for, you can see how
VMD processes the various labels in the script I've included below, which
is a snippet from VMD's built-in save_state code:

#
# Save all atom labels
#
proc save_labels { file } {
  set atomlist [label list Atoms]
  set bondlist [label list Bonds]
  set anglelist [label list Angles]
  set dihedrallist [label list Dihedrals]

  foreach atom $atomlist {
    lassign $atom atom1 value show
    lassign $atom1 mol index
    puts $file "label textsize [label textsize]"

    puts $file "label add Atoms ${mol}/${index}"
    if { [string compare $show show] } {
      # don't show this label. Do this by simply repeating the add command
      puts $file "label add Atoms ${mol}/${index}"
    }
  }

  foreach bond $bondlist {
    lassign $bond atom1 atom2 value show
    lassign $atom1 mol1 index1
    lassign $atom2 mol2 index2
    puts $file "label add Bonds ${mol1}/${index1} ${mol2}/${index2}"
    if { [string compare $show show] } {
      # don't show this label. Do this by simply repeating the add command
      puts $file "label add Bonds ${mol1}/${index1} ${mol2}/${index2}"
    }
  }

  foreach angle $anglelist {
    lassign $angle atom1 atom2 atom3 value show
    lassign $atom1 mol1 index1
    lassign $atom2 mol2 index2
    lassign $atom3 mol3 index3
    puts $file "label add Angles ${mol1}/${index1} ${mol2}/${index2} ${mol3}/${i
ndex3}"
    if { [string compare $show show] } {
      # don't show this label. Do this by simply repeating the add command
      puts $file "label add Angles ${mol1}/${index1} ${mol2}/${index2} ${mol3}/$
{index3}"
    }
  }

  foreach dihedral $dihedrallist {
    lassign $dihedral atom1 atom2 atom3 atom4 value show
    lassign $atom1 mol1 index1
    lassign $atom2 mol2 index2
    lassign $atom3 mol3 index3
    lassign $atom4 mol4 index4
    puts $file "label add Dihedrals ${mol1}/${index1} ${mol2}/${index2} ${mol3}/${index3} ${mol4}/${index4}"
    if { [string compare $show show] } {
      # don't show this label. Do this by simply repeating the add command
      puts $file "label add Dihedrals ${mol1}/${index1} ${mol2}/${index2} ${mol3}/${index3} ${mol4}/${index4}"
    }
  }
}

On Mon, Nov 22, 2004 at 07:43:28PM -0500, Ekta Khurana wrote:
> Hello all,
> I want to save values of different torsions in a file using VMD. As
> doing that for individual torsions with the pulldown menu labels
> command is cumbersome, I want to write a TCL script. When I use
> label command in TkCon window, it does not work properly. Like-
> "label list Atoms" would sometimes list them and sometimes not. And
> "lable list Dihedrals" never does. Could someone tell me why this
> might be happening?
> Thanks in advance,
> Ekta

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