# temperature from binary velocities file

From: Sebastian Stolzenberg (s.stolzenberg_at_gmail.com)
Date: Mon Dec 14 2009 - 14:59:42 CST

Dear All,

As a test for some further reasons down the road, I am trying to
reconstruct temperatures from a velocity binary file. Here is a script
calculating the temperature:

*************************
set mykin 0.0
set numatoms 0.0
set PDBVELFACTOR 20.45482706
set N_A 6.022142e23
set k_B 1.38065e-23
set NDOFs 578347

foreach mymass {1.00800001621 12.0109996796 14.0069999695 15.9989995956
22.9897994995 30.9740009308 32.0600013733 35.4500007629} {
set mysel [atomselect top "mass \$mymass"]
set numatoms [expr \$numatoms + [\$mysel num]]
foreach mycoord {x y z} { set v(\$mycoord) [\$mysel get \$mycoord] }

set v2sum(\$mymass) [expr [vecdot \$v(x) \$v(x)] + [vecdot \$v(y) \$v(y)]
+ [vecdot \$v(z) \$v(z)]]
set mykin [expr \$mykin + \$mymass*\$v2sum(\$mymass)]
}

puts [expr \$mykin / 1000 / \$N_A * \$PDBVELFACTOR * \$PDBVELFACTOR / 1e-20
* 1e-24 / \$NDOFs / \$k_B]

*************************

I obtained the value for \$NDOFs from the log file ("578347 DEGREES OF
FREEDOM").

Checking with the log file, I get the correct temperature value - only
that it is off by exactly 8 orders of magnitude!

What (orders of magnitude) am I missing in my conversion? Maybe a fresh
eye can help here? I am using NAMD 2.7

Thank you,
Best,
Sebastian

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:53:36 CST