From: Ashar Malik (
Date: Tue Oct 31 2017 - 17:00:25 CDT


I usually use this:

set pdbs [glob *.pdb]

to select all pdb extension files in the current working directory.

Using a for loop like

foreach i $pdbs { ... }

should allow you to iterate over the list.

Secondly to load it into Vmd

mol delete all

will delete everything from Vmd

mol load pdb $i

should then load each pdb in an iterative manner.

After which you can do what you want.

Having said that you can't compute the distance between side chains ...
Distances are between 2 atoms. So you have to select one atom per side

If you choose one atom per side chain you can look into

measure bonds atom_list

As far as my work is concerned I usually compute distance from geometrical
centers which are not occupied by atoms and I have never come across a
single function that measures a "distance" directly from two points. So I
always get the x,y,z coordinates of the center and use the distance formula
to calculate it.

Hope this helps. If it doesn't write back and someone can perhaps offer
more help.


On Nov 1, 2017 10:32, "Windle,Stephen" <> wrote:

> VMD Users,
> Good afternoon. I am very new to the VMD software, and I am working on
> putting together a script for a specific purpose, but I am unsure how much
> of it can be done as a single script. Essentially, I want to measure the
> distances between all the side chains of a specific amino acid in a given
> protein (for example distances between all the valine side chains).
> However, I want to be able to load anywhere from 1000-10,000 molecules into
> VMD and have the script do this for each molecule consecutively, exporting
> them into individual files (I should be able to write a loop for this, I
> imagine). So far I'm able to load a molecule and isolate the side chains of
> a specific amino acid. So my two key questions are this: Can a loop be
> written to load every .pdb file in a given folder, and what are the console
> commands to measure the distance between each side chain once they've been
> isolated into a named selection. I have tried searching through the indexed
> messages but to no avail. If someone could point me in the right direction
> that would be greatly appreciated. Thank you!
> Regards,
> Steve Windle