# Re: Calculation of velocities

From: Eric Cyr (ericcyr_at_uiuc.edu)
Date: Fri Sep 03 2004 - 14:27:38 CDT

Blake Charlebois wrote:

>Are all three velocity components out by approximately the same factor at
>every timestep? How much does this factor vary?
>
The factor varies quite a bit, from 1/3 to 1/50th the size. Though the
velocities
I calculte are always smaller then the ones dumped to the restart file.

>Would you consider posting the relevant lines from your configuration file?
>
Here is the tcl script file I'm using for calc forces, sampleInt is set
in my configuration file
as well as the indexes for the atoms that are of interest and a handful
of other variables

proc calcforces {} {
# globals declared in the namd config file
global ind sampleInt

# local globals
global iter qNm1

# q^(n+1)
if {(\$iter-1) % \$sampleInt == 0} {
# the angle and positions
set qNp1 "\$p(\$ind(1)) \$p(\$ind(2)) \$p(\$ind(3)) \$p(\$ind(4))"

# using a centered difference and timestep of 1fs calculate the v^n
set velocity [vecscale 0.5 [vecsub \$qNp1 \$qNm1]]

print "Velocity([expr \$iter-1]) = \$velocity"
}

# the next step q^n
if {\$iter % \$sampleInt == 0} {
# make sure it is at least set!
if {\$qNm1==0} {
set qNm1 "\$p(\$ind(1)) \$p(\$ind(2)) \$p(\$ind(3)) \$p(\$ind(4))"
}

print "Position(\$iter) = \$p(\$ind(1)) \$p(\$ind(2)) \$p(\$ind(3))
\$p(\$ind(4))"
}

# q^(n-1)
if {\$iter+1 % \$sampleInt == 0} {
# save the old position
set qNm1 "\$p(\$ind(1)) \$p(\$ind(2)) \$p(\$ind(3)) \$p(\$ind(4))"
}

incr iter

return
}

Thanks
Eric

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:38:52 CST