From: Myunggi Yi (myunggi_at_gmail.com)
Date: Tue Dec 12 2006 - 19:12:35 CST

Hi vmd users,

Now I writing my own script to calculate two dimensional diffusion constant.
I've got an error message, "vecsub: non-numeric in first argument".
I have no idea about this error message.
The following is my code.

+++++++++++++++++++++++++++++++++++++++++
proc diffusion2 { sel f1 } {
    set fout [open $f1 w]
    set nf [molinfo [$sel molid] get numframes]

    for { set i 0 } { $i < $nf } { incr i } {
        $sel frame $i
        lappend cxy [$sel get {x y}]
    }

    set ds 0.0
    set lds 0.0
    puts $fout "0 0.0"

    for { set i 1 } { $i < [expr $nf + 1] } { incr i } {
        for { set j 0 } { $j < [expr $nf - $i] } { incr j } {
            set k [expr $j + $i]
            set ds [expr $ds + [veclength [vecsub [lindex $cxy $k] \
                [lindex $cxy $j] ]]]
        }
        puts $fout "$i [expr $ds/($nf-$i)]"
        set ds 0.0
    }
    close $fout
}
+++++++++++++++++++++++++++++++++++++++++++

Does anyone have any idea?
What is wrong with my script?