Problem with Kinetic Energy of Atomselection

Date: Wed Jan 07 2015 - 00:53:38 CST

Hi,I am trying to obtain kinetic energy of an atomselection (updated every frame), but i keep getting same kinetic energy for all frames (whereas theĀ  NAMD plot shows rising kinetic energy from the log file).

Here is the tcl script ,
###### top is the coordinate dcd , 1 is the velocity dcd#Sum is kinetic energy
________________________________________-set outfil [open energy.dat w]
set nf [molinfo top get numframes]
set sel [atomselect top "all"]
# kinetic energy calculation loop
for { set i 0 } { $i <= $nf } { incr i } {
$sel frame $i
$sel update
set sum 0
set INDEX [$sel get index]

set velocitysel [atomselect 1 "index $INDEX"]

foreach m [$velocitysel get mass] v [$velocitysel get {x y z}] {
set sum [expr $sum +0.5 * $m * [vecdot $v $v]]

puts $outfil "$f \t $sum"

close $outfil

This archive was generated by hypermail 2.1.6 : Tue Dec 27 2016 - 23:20:47 CST