From: Mehdi Bagherpour (
Date: Thu Jun 11 2015 - 05:56:18 CDT

Dear vmd users,

I have written a code that compute distance between atoms (Thanks for
helping Dr.Axel Kohlmeyer for helping to write that).

I want to write output file like this:

First_atom_name second_atom_name distance
but when I run my script it gives:

*wrong # args: should be "set varName ?newValue?"*

my script is:

*set output [open "Distance.dat" w] *
*for {set x 0} {$x <= 10} {incr x} {*

*set sel1 [atomselect top "index $x"] *
*set sel2 [atomselect top "index 1"] *

*set nf [molinfo top get numframes] *

*set s1_name [$sel1 get name]*
*set s2_name [$sel2 get name]*

*for {set i 0} {$i < $nf} {incr i} { *
*$sel1 frame $i*
*$sel2 frame $i*

*set distance [veclength [vecsub [lindex [$sel1 get {x y z}] 0] [lindex
[$sel2 get {x y z}] 0] ]] *
*puts $output "$s1_name \t $s2_name \t $distance"*
*set *
*close $output*

I will be appreciate If you could help me to find the bug of my script.