Regarding Temperature calculation from velocity trajectory of NAMD-2.9

From: Shailesh Pandey (
Date: Thu Jul 10 2014 - 04:30:20 CDT

Dear NAMD users,

I have performed a MD simulation of a protein+ligand system with explicit
solvent and PBC with NPT ensemble.
Now as one of the tests of equilibration, I want to look at temperature
profile of Solvated system, protein+ligand, water, and center of mass of
complex. As discussed in

Gallo, M. T., Grant, B. J., Teodoro, M. L., Melton, J., Cieplak, P.,
Phillips, G. N., & Stec, B. (2009). Novel procedure for thermal
equilibration in molecular dynamics simulation. Molecular Simulation,
35(June 2014), 349–357. doi:10.1080/08927020802647272

And, we can calculate temperatures of different configurations if we have
corresponding velocity trajectory.

I am using following tcl code to calculate temperature after loading psf
file and velocity trajectory as molecule data

proc getTemp { frame } {
    set all [atomselect top all frame $frame]
    set eng {}; set esum 0;
    foreach m [$all get mass] v [$all get {x y z}] {
        set e [expr {0.5 * $m * [vecdot $v $v]}]
        lappend eng $e
        set esum [expr {$esum + $e}]
    set T [expr { $esum * 2.0 / (3.0 * [$all num] * 0.00198657) }]
    puts "frame: $frame ## Temp: $T"

I am following it from

It produces temperature in range of 220-230 for solvated system, but log
file shows temperature fluctuating around 310, as 310K was the simulation

I am unable to find where I am doing wrong?

Any help in this regard is appreciated.

Thank you.

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:22:35 CST