Bug #1538

limited length of dynamic selection arguments

Added by Grzegorz Wieczorek over 6 years ago. Updated over 6 years ago.

Target version:
Affected version - extra info:
Affected version:


The argument used for dynamic selection (in the -select option of several analysis commands of gmx) has a very limited maximum length. I run across this problem while trying to calculate many different distances with 'gmx distance' without prior preparation of the index file. Since the trajectories that I have are rather big (hundreds of milions of frames), I wanted to calculate what I needed with only one pass, and collect the results in one big xvg file. Please see the files attached for reproduction of the error. At first the error manifested itself by the message like:

  • Error in `gmx': realloc(): invalid next size: 0x0000000000fa57e0 ***

With files that I've attached here, I just get a segfault. However, if I remove only one from among the segments connected with 'plus' in the command line, it works flawlessly. I wonder, if the command will work for anybody. If it works, it is probably enough to add few other distances into the command line to see the error. I know that the selection can be done more sparsely (without 'resname SOL') in this example, but its just illustration of the limitation of argument length...
Gregorz Wieczorek

do (1.14 KB) do script to run to reproduce the error Grzegorz Wieczorek, 06/28/2014 10:58 PM
2tip5p.gro (734 Bytes) 2tip5p.gro the input gro Grzegorz Wieczorek, 06/28/2014 10:59 PM

Associated revisions

Revision 29a6c2ff (diff)
Added by Teemu Murtola over 6 years ago

Remove some hardcoded selection string buffers

This removes some arbitrary limitations on the length of the input
string. The error handling would still be in the need of a bigger
overhaul (all of these were in the error handling parts).

Fixes #1538, related to #655.

Change-Id: I1112b5ccae526cf3b8fd079bbabf8d7f61e52635


#1 Updated by Teemu Murtola over 6 years ago

  • Category changed from analysis tools to selections
  • Status changed from New to In Progress
  • Assignee set to Teemu Murtola
  • Target version set to 5.0

#2 Updated by Gerrit Code Review Bot over 6 years ago

Gerrit received a related patchset '1' for Issue #1538.
Uploader: Teemu Murtola ()
Change-Id: I1112b5ccae526cf3b8fd079bbabf8d7f61e52635
Gerrit URL:

#3 Updated by Teemu Murtola over 6 years ago

  • Status changed from In Progress to Fix uploaded

There were some places where the length of an individual selection (not the whole input string) was limited to 1024 characters. Fixed a few, which makes this case work.

#4 Updated by Erik Lindahl over 6 years ago

  • Status changed from Fix uploaded to Resolved

#5 Updated by Erik Lindahl over 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF