Re: Is it a bug? TCL Script may Lead to Overflow

From: Jim Phillips (
Date: Mon Nov 09 2009 - 11:55:33 CST

Hi Fred,

Thanks for reporting this. Something about the raw attachments was
killing majordomo and chopping off the message when I tried to approve it.

The zeroMomentumAlt variable in SimParameters is only initialized if a
value is explicitly given for zeroMomentum. This is the code:

    opts.optionalB("main", "zeroMomentum", "constrain center of mass",
       &zeroMomentum, FALSE);
    opts.optionalB("zeroMomentum", "zeroMomentumAlt", "constrain center of
mass", &zeroMomentumAlt, FALSE);

The first string in each line is the dependency for the second string. I
am changing this to initialize everything that has a default, since there
have been several bugs related to this behavior in the past.

If you switch "zeroMomentum" to "main" in the zeroMomentumAlt declaration
you should see this behavior go away.

I can't find any fixed-length arrays in the code that handles tclBCScript.
Have you observed any functional errors? How did you find this?


On Sat, 7 Nov 2009, Fred (Rui FENG) wrote:

> Hi Axel,
> Maybe the attachments exceed the size limit? I compressed them and
> hope everyone could get it. Thanks.
> Regards,
> Fred
> On Sat, Nov 7, 2009 at 3:47 PM, Axel Kohlmeyer <> wrote:
>> On Sat, 2009-11-07 at 15:01 -0500, Fred (Rui FENG) wrote:
>>> Hi All,
>>> The modified Controller.C and apoa1.namd are attached. Please backup
>>> the original Controller.C and replace it with the new one. The change
>>> is only at the line 1073 to 1075. Thanks.
>> fred,
>> there are no attachments...
>> axel.
>>> Regards,
>>> Fred
>>> On Sat, Nov 7, 2009 at 4:09 AM, Fred (Rui FENG) <> wrote:
>>>> 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:
>>>> The variable "zeroMomentumAlt" is only set in SimParameters.C and
>>>> referenced by Sequencer.C.  Its value can be printed in Controller.C
>> --
>> 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:28 CST