From: Maxim Belkin (mbelkin_at_ks.uiuc.edu)
Date: Sat Aug 16 2014 - 02:48:51 CDT

Here is a recipe that you can use to cook up the labels to your liking:

###
set labelsToCook [llength [label list Atoms]]

for {set label 0} {$label < $labelsToCook} {incr label} {
  label textformat Atoms $label {%i}
}
###

Maxim

On Aug 15, 2014, at 4:46 PM, Andrew DeYoung <adeyoung_at_andrew.cmu.edu> wrote:

> Hi,
>
> In an archived message on this mailing list (
> http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/9356.html ), there is
> a recipe by John Stone for labeling all atoms of a molecule:
>
> proc label_atoms { molid seltext } {
> set sel [atomselect $molid $seltext]
> set atomlist [$sel list]
> foreach {atom} $atomlist {
> set atomlabel [format "%d/%d" $molid $atom]
> label add Atoms $atomlabel
> }
> $sel delete
> }
>
> which John Stone explains can be called with:
>
> set molid [molinfo top]
> label_atoms $molid "name CA"
>
> When I use this recipe, the labels appear to be the residue and atom names.
> How can I modify the above recipe so that the atom indices (e.g., 0, 1, 2,
> ..) -- which, according to "Selections" in the "Graphical Representations"
> window, are referred to by "index" -- are displayed instead?
>
> Thank you very much for your time!
>
> Andrew DeYoung
> Carnegie Mellon University