Input line too long and glibc errors. Define output by LOOP possible?


Ideally, I’d like to learn an alternative way to do what I’m doing to avoid what feels like a sloppy approach. If no alternative exists, I am hoping for some insight into what is causing the problem and how to fix it.

I am using the 18Jan11 lammps version on Oak Ridge’s Eugene. I would like to partition a simulation length into very small regions in the z-direction, and output atom-specific computations for each regions. I make the regions and define the computations with the following commands:

run a loop to divide central length into many sections

variable b loop 313
label loopREG
variable BOTTOM equal 16+($b-1)*5
variable TOP equal 16+($b)*5
region b block INF INF INF INF {BOTTOM} ${TOP} units box
compute 1REG$b 1 temp/region $b
compute 2REG$b 2 temp/region $b
compute 3REG$b 3 temp/region $b
compute 4REG$b 4 temp/region $b
compute 5REG$b 5 temp/region $b
compute 6REG$b 6 temp/region $b
compute 7REG$b 7 temp/region $b
next b
jump test.cnt loopREG

which successfully partitions the distance between 16 and 1581 Angstroms into 313 regions of 5 Angstroms each. These lines also define the compute “xREGy” which computes the temperature for all atoms of type “x” located in region “y”.

The problem occurs when I define the thermo output to record instantaneous calculations of these temperatures. Ideally, I would prefer someway to define the thermo output as another LOOP and avoid writing out the “c_xREGy” for all 7 atom types in 313 regions.

Unfamiliar with an alternative, I have written them out explicitly. The input line is about 21,300 characters long for this case, which normally produces an “input too long” error. The original MAXLINE variable in /src/input.cpp was 2048. For smaller systems, I have been able to alter this parameter and successfully run this simulation for input lines longer than 2048. However, the same approach is not working for the 21,300 characters I need now.

If I maintain the same input line and build lammps with MAXLINE less than 21,300, I get an “input too long” error only. However, if I build lammps with MAXLINE large enough to accommodate the input line (greater than 21,300 in this case) I get a long error output which contain many repeated messages, for example:

*** glibc detected ***
memory corruptionmalloc():
0cac000-00cad000 rw-p 00021000 00:01 249 /lib/
00ed0000-00ed4000 r–p 000b0000 00:01 223 /lib/======= Memory map: ========
00e71000-00ed0000 —p 000a1000 00:01 223 /lib/

I assume this is some sort or memory allocation error, but I am not familiar with what changes are needed, how to make these changes, and if I have the ability to make them on Oak Ridge.

I should mention I would like the ability to generalize this solution for input lines even greater than 21,300. An ideal solution would be a LOOP approach to defining output if possible.

Thank you.

Why don't you look at fix ave/spatial, which lets you
bin in 1d, 2d, or 3d (and overlay a region). You can
define an atom-style variable and use fix ave/spatial
to compute and/or average that formula in each bin.