From: Raman Preet Singh (
Date: Sat Oct 01 2022 - 08:55:36 CDT

Dear All,

I am interested in labelling all the atoms in my molecule. The VMD GUI has that option but clicking on each of the hundreds of atoms is a nice time-killer.

I created a Tcl script for this

set sel [atomselect top "all"]
$sel get index
for {set i 0} {$i < $sel} {incr i} {
label add Atoms 4/$i
label textformat Atoms $i %a

This works well but has an issue that in the line “label add Atoms 4/$i”, the number (4 in this case) has to be increased after every molecule loading. I guess this is something related to VMD logging the molecule number loaded in a session. Is there a way that I can bypass this so that I do not need to update this number everytime I load a molecule? FYI, I got this number by turning on logging in console and then selecting an atom using the GUI.