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

Thanks Mariano for the reply and the suggestions.

Regards,
Raman

Get Outlook for Android<https://urldefense.com/v3/__https://aka.ms/AAb9ysg__;!!DZ3fjg!8uRt4raM5qSBpzCJ_DneQmQbDud79SWyqMX0eh7nldXgnXxHOSk1ZgAOClCutWa0PqKJMz2TxwcBSbR_wHahLNgpIg8n$ >
________________________________
From: Spivak, Mariano Alejo <mspivak_at_illinois.edu>
Sent: Saturday, October 1, 2022 8:34:04 PM
To: Raman Preet Singh <ramanpreetsingh_at_hotmail.com>
Cc: vmd-l_at_ks.uiuc.edu <vmd-l_at_ks.uiuc.edu>
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'

Best

On Oct 1, 2022, at 8:55 AM, Raman Preet Singh <ramanpreetsingh_at_hotmail.com<mailto:ramanpreetsingh_at_hotmail.com>> 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.

Regards,
Raman