From: Raman Preet Singh (
Date: Sat Oct 01 2022 - 11:40:20 CDT

Thanks Mariano for the reply and the suggestions.


Get Outlook for Android<;!!DZ3fjg!8uRt4raM5qSBpzCJ_DneQmQbDud79SWyqMX0eh7nldXgnXxHOSk1ZgAOClCutWa0PqKJMz2TxwcBSbR_wHahLNgpIg8n$ >
From: Spivak, Mariano Alejo <>
Sent: Saturday, October 1, 2022 8:34:04 PM
To: Raman Preet Singh <>
Cc: <>
Subject: Re: vmd-l: Label all atoms using script

Hi Raman,

As you pointed out, the number 4 refers to the molecule id. Check the VMD Main window where the loaded molecules are listed, there is an ID field, and also a T field. The T refers to the active molecule, also know as ’top’ molecule.
Whenever you load a new molecule in VMD, that becomes the top. You can get the ID of the top molecule by using: ‘molinfo top get id’
So in your script, you can replace the label add Atoms line with: ‘label add Atoms [molinfo top get id]/$I'


On Oct 1, 2022, at 8:55 AM, Raman Preet Singh <<>> wrote:

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.