From: Fred (Rui FENG) (fengruifree_at_gmail.com)
Date: Sat Nov 07 2009 - 03:09:28 CST
Hi All,
I found that if TCL script lines are more than a certain value (maybe
35 to 40) in the parameter file, some variables will overflow and
impact the variable (at least) called "zeroMomentumAlt". For example,
the code below is to add a gradient force. To reproduce this error,
just append the code below to the popular ApoA1 parameter file which
can be download here:
http://www.ks.uiuc.edu/Research/namd/utilities/apoa1/apoa1.namd
The variable "zeroMomentumAlt" is only set in SimParameters.C and
referenced by Sequencer.C. Its value can be printed in Controller.C.
For example, in receivePressure function you can write: iout <<
"zeroMomentumAlt = " << simParameters->zeroMomentumAlt << "\n" <<
endi;
You will find that the value will be changed from 0 (false) to a large
int number.
NAMD 2.7b1 and 2.6 have this problem. TCL version is the latest 8.5.7
(the 8.4.14 is also tried).
My computing and compiling environment: Blue Gene/L, 512/1024 nodes,
Co-processor/Virtual node mode.
My output:
Step = 1 zeroMomentumAlt = 1702109286 zeroMomentum = 0
Step = 2 zeroMomentumAlt = 1702109286 zeroMomentum = 0
Step = 3 zeroMomentumAlt = 1702109286 zeroMomentum = 0
Step = 4 zeroMomentumAlt = 1702109286 zeroMomentum = 0
Step = 5 zeroMomentumAlt = 1702109286 zeroMomentum = 0
.......................
But if you delete some "elseif" in the tcl script and only keep two or
three of them, the problem disappeared!
I guess when NAMD parses the TCL script which is more than a certain
value, some variables overflow and impact the memory that saves
"zeroMomentumAlt".
Could you help me to check it out? Thanks!
Regards,
Fred
=============== THE CODE ================
wrapall on
tclBC on
tclBCScript {
wrapmode cell
proc calcforces {step unique frc bndry bndrymax numwall} {
while {[nextatom]} {
set id [getid]
if {$id <= $numwall} {
dropatom
continue
}
set vec [getcoord]
foreach {x y z} $vec {break}
if { $step > 0 } {
if {$x > -50.0 && $x < -45.0} {
set f "1.000 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -45.0 && $x < -40.0} {
set f "0.999 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -40.0 && $x < -35.0} {
set f "0.998 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -35.0 && $x < -30.0} {
set f "0.997 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -30.0 && $x < -25.0} {
set f "0.996 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -25.0 && $x < -20.0} {
set f "0.995 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -20.0 && $x < -15.0} {
set f "0.994 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -15.0 && $x < -10.0} {
set f "0.993 0. 0."
addforce [vecscale $frc $f]
} elseif {$x >= -10.0 && $x < -5.0} {
set f "0.992 0. 0."
addforce [vecscale $frc $f]
} else {
set f "0.991 0. 0."
addforce [vecscale $frc $f]
}
}
}
}
}
tclBCArgs {0.01 -54.0 54.0 0}
=================END=================
This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:53:27 CST