Fix static group list indices in selection prompt
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 22 May 2014 03:20:47 +0000 (06:20 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 22 May 2014 07:15:57 +0000 (09:15 +0200)
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

src/gromacs/selection/indexutil.cpp

index 084577d365ca97fb3adacbec2a720a4327e17809..27b867a9a1436b943a10375ee83b4fca051d4f7a 100644 (file)
@@ -266,7 +266,7 @@ gmx_ana_indexgrps_print(FILE *fp, gmx_ana_indexgrps_t *g, int maxn)
 {
     for (int i = 0; i < g->nr; ++i)
     {
-        fprintf(fp, " Group %2d \"%s\" ", i + 1, g->names[i].c_str());
+        fprintf(fp, " Group %2d \"%s\" ", i, g->names[i].c_str());
         gmx_ana_index_dump(fp, &g->g[i], maxn);
     }
 }