Bug #1506

Selecting groups does not work as expected

Added by Justin Lemkul almost 3 years ago. Updated almost 3 years ago.

Target version:
Affected version - extra info:
5.0 dev versions
Affected version:


Interactive selection of groups for analysis is somewhat confusing. For instance:

gmx gangle -f lastframe.xtc -s md_200_300.tpr -n angle_topleaflet.ndx -oav test.xvg -g1 vector -g2 z

gives the following:

Available static index groups:
 Group  1 "same_residue_as_name_P8_and_(z>_3.5)_0.000" (3328 atoms)
 Group  2 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C17" (64 atoms)
 Group  3 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C36_same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C17" (128 atoms)
 Group  4 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C50" (64 atoms)
 Group  5 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_CA2" (64 atoms)
 Group  6 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C36" (64 atoms)
 Group  7 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C50" (64 atoms)
 Group  8 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C36_same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C50" (128 atoms)
 Group  9 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C17_same_residue_as_name_P8_and_(z>_3.5)_0.000_&_CA2" (128 atoms)
 Group 10 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C50" (64 atoms)
 Group 11 "same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C50_same_residue_as_name_P8_and_(z>_3.5)_0.000_&_C36" (128 atoms)
Specify any number of selections for option 'group1'
(First analysis/vector selection):
(one per line, <enter> for status/groups, 'help' for help, Ctrl-D to end)
> 11
Cannot match 'group 11', because no such index group can be found.
invalid selection '11'

So it seems that the program expects zero-indexed selections, while the printed options are numbered from 1. This can be very problematic, because if the user supplies '1' as the selection, it actually analyzes group 2 (as indicated in the legend printed in the .xvg file.

Problem is reproducible in 5.0-rc1 and current master. I can provide example input files, if needed.

Associated revisions

Revision 1b890257 (diff)
Added by Teemu Murtola almost 3 years ago

Fix static group list indices in selection prompt

In 4.6, the list was zero-based, and this is what the selection parser
uses when resolving numeric group references, so it should still be.
Also the list shown by various functions in index.c is zero-based.
The printing code had been inadvertently changed to one-based in cleanup
of the handling of group names within the selection code.

Fixes #1506

Change-Id: I9a573b921802d2276e3bdb653359a961c90ff29a


#1 Updated by Teemu Murtola almost 3 years ago

  • Target version set to 5.0
  • Affected version - extra info set to 5.0 dev versions

Some cleanup of the code appears to have shifted the indices in the printed list.

#2 Updated by Gerrit Code Review Bot almost 3 years ago

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

#3 Updated by Teemu Murtola almost 3 years ago

  • Status changed from New to Fix uploaded

#4 Updated by Teemu Murtola almost 3 years ago

  • Status changed from Fix uploaded to Resolved
  • % Done changed from 0 to 100

#5 Updated by Erik Lindahl almost 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF