From: Brian Radak (
Date: Wed Dec 14 2016 - 15:49:03 CST

This is probably a well-known "gotcha", but I'm suitably new to VMD
scripting that I don't know what the standard solution is.

I have a simple script to measure several dihedral angles and print the
output to a file. For example, I want to look at a specific torsion in a
HIS ring, so I wrote the following:

set heSel [atomselect top "protein and resid 1 and name CG CD2 NE2 HE2"]
set hes [measure dihed [$heSel get index] frame all]

and then wrote the contents of the "hes" list to file - but the results
don't match what I get from the GUI because atomselect automatically sorts
the indices and thus changes the dihedral that I thought I was selecting.
In this case (15 20 18 19) becomes (15 18 19 20).

I expect that there is a very good reason for this behavior (or at least
one that ends with "it's a lot easier to implement this way") - is there a
solution to this that is better than just selecting all four atoms
separately? Writing single atom atomselections seems like a bit of a chore,
but at least it will always work as expected.


Brian Radak
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
9700 South Cass Avenue, Bldg. 240
Argonne, IL 60439-4854
(630) 252-8643