fixed segfault in graph code with coordinate subsets
authorBerk Hess <hess@kth.se>
Wed, 18 Apr 2012 11:23:42 +0000 (13:23 +0200)
committerBerk Hess <hess@kth.se>
Wed, 18 Apr 2012 11:23:42 +0000 (13:23 +0200)
The graph code checked for atom indices above the subset size,
but not for settle. The check for settle has been added.
Fixes #809

Change-Id: I67ddbd3dab5a34f57a29f54f4b07918a6d74c38c

src/gmxlib/mshift.c

index 5bb304f1945e2ac2a0924de6b79dfc2c1a37f465..091a4a5ab6d5a329e98a6b3b2a524b1dbdfe79dd 100644 (file)
@@ -98,7 +98,7 @@ static void mk_igraph(t_graph *g,int ftype,t_ilist *il,
     np = interaction_function[ftype].nratoms;
     
     if (ia[1] >= at_start && ia[1] < at_end) {
-      if (ia[np] >= at_end)
+      if (ia[np] >= at_end || (ftype == F_SETTLE && ia[1]+2 >= at_end))
        gmx_fatal(FARGS,
                  "Molecule in topology has atom numbers below and "
                  "above natoms (%d).\n"