From: Mehdi Bagherpour (mehdi.bpour_at_gmail.com)
Date: Wed Jun 10 2015 - 12:12:36 CDT

Dear vmd users,

I am trying to find distance between all atoms.
My system has 2000 atom with 25000 snapshot.
I have written an script that and for instant I want to calculate distance
of first 10 atom (index 0-9) from atom with index 2 for all snapshots.
When I run this script it takes me just distances for first snapshot.

 *set output [open "Distance.dat" w] *
*for {set x 0} {$x <= 9} {incr x} {*
*set sel1 [atomselect top "index $x"] *
*set sel2 [atomselect top "index 2"] *

*set nf [molinfo top get numframes] *

*for {set i 0} {$i < $nf} {incr i} { *

*set distance [veclength [vecsub [lindex [$sel1 get {x y z}] 0] [lindex
[$sel2 get {x y z}] 0] ]] *
*puts $output "$x $i $distance" *

*}*
*}*
*close $output *

output is like :

*0 0 7.053204709957979*
*0 1 7.053204709957979*
*0 2 7.053204709957979*
*0 3 7.053204709957979*
*.*

*..1 0 3.771492867602953 1 1 3.7714928676029531 2 3.7714928676029531 3
 3.771492867602953...I will be appreciate If you could help me to find the
bug of my script. *