From: Smith, Harper (smith.12510_at_buckeyemail.osu.edu)
Date: Wed Apr 03 2024 - 20:34:25 CDT

Hey Sam,

Assuming you have "gopython" at the end of your ~/.vmdrc, this simple script shows how to get the indices of an atomselection:
from vmd import atomsel
from vmd import evaltcl

evaltcl('menu main on')
prot = atomsel('protein')
indices = prot.index

print(f'Found indices {indices}!')
My favorite way to run python scripts in vmd is just e.g. "vmd -e script.py" (after changing your .vmdrc).

Harper
________________________________
From: owner-vmd-l_at_ks.uiuc.edu <owner-vmd-l_at_ks.uiuc.edu> on behalf of Sam Fredrick <sfredrick486_at_gmail.com>
Sent: Wednesday, April 3, 2024 8:47 PM
To: vmd-l_at_ks.uiuc.edu <vmd-l_at_ks.uiuc.edu>
Subject: vmd-l: Index extractor Python Code

Hello VMD Users! I am coding in python and need to write a python script that prints the indexes of the atoms selected. However, I am unable to find where the indexes are stored in the source code files! Any help or suggestion would be appreciated!

Hello VMD Users!

I am coding in python and need to write a python script that prints the indexes of the atoms selected. However, I am unable to find where the indexes are stored in the source code files! Any help or suggestion would be appreciated! Thank you!

Sincerely,
Sam F