From: Peter Freddolino (
Date: Mon Jan 26 2009 - 06:09:46 CST

Hi Gurunath,

from the looks of the script you mention, by default it is only designed
to draw the distance map, not return the values. However, you should be
able to modify it to end after the distance-generation portion:

    foreach atom1 $coords id1 [$sel list] {
        foreach atom2 $coords id2 $list2 {
            set dist($id1,$id2) [veclength [vecsub $atom2 $atom1]]
            set dist($id2,$id1) $dist($id1,$id2)
            set max [mymax $max $dist($id1,$id2)]
        lvarpop list2
        lvarpop coords

    return $dist

And then delete everything later in the script. You should then be able
to do something like

set mydists [ca_distance $sel]

And then access the ca distance between residues i and j as


PS. It isn't necessary to email a question to the list 3 times...

> Hello,
> this is a question regarding the script to obtain the Calpha-Calpha
> distance of a selection which is available in vmd script library.
> My question is : After you obatin the distance map after running the
> script .. how do you extract the data from distance map?
> i.e how do you get the values of the Calpha-Calpha distance from the
> distance map for every cell?
> thanking you.
> Yours sincerely,
> Gurunath