Re: temperature calculations from velocities in NAMD?

From: Axel Kohlmeyer (
Date: Sat Nov 07 2009 - 16:55:13 CST

On Sat, 2009-11-07 at 17:31 -0500, Sebastian Stolzenberg wrote:

> > the iffy part is often to determine the exact number of DOFs.
> > without shake this is usually 3n-3.
> >
> 1.)
> Sweet, so please let me understand the logic of "n_DOF=3n-3":
> for the DOFs, we have
> 3 for overall translations
> 3 for overall rotations

> and 3n-6 for the fundamental oscillations

nope. we don't have those. we treat our system
as N individual point particles. the 3N-6 for
oscillations only holds for crystals/lattices/etc.
there you have the 3n DOFs minus translation and rotation.

> Since we only consider kinetic energies for the temperature, we do not
> count the fundamental oscillations twice.
> Then, n_DOF=3n-3 because we can ignore the 3 translation DOFs (change of
> reference frame).
> Why not also ignoring the 3 overall rotations to get 3n-6? Maybe it
> doesn't matter because
> 3n-3 ~ 3n ~ 3n-6, since 3n is large....

with PBC you are only invariant against translations of
your total system.

> 2.)
> Too bad though I am using shake. Fixed bonds reduce the DOFs, so how
> does NAMD calculate n_DOF then?

very simple: each "shaken" bond or angle is equivalent to
removing one DOF. so waters have 6 DOFs instead of 9. if
you go to more complex constraints it can become very complicated.
i don't know how much care NAMD takes for those. last time i
looked into these issues with more detail was with an ab
initio MD code, where this matters much more, than in typical
NAMD calculations.

> By the way, is there a nice TCL script/NAMD trick calculating T from the
> velocities, or would I need to dig into the source code to see how this
> is done and write some code myself?

the coding here is extremely simple, except for having to know
which bonds/angles are shaken (and not stirred) and particularly
how to handle the situation of computing the instantaneous temperature
if only part of a constraint (one atom of a constrained bond, one or
two atoms of a constrained angle and so on) is in the group of atoms
where you want to monitor the temperature.

as usual, the ultimate answer is the source code.


> Thank you very much,
> Sebastian

Dr. Axel Kohlmeyer 
Institute for Computational Molecular Science
College of Science and Technology
Temple University, Philadelphia PA, USA.

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