Support more complex fixed position selections
[alexxy/gromacs.git] / src / gromacs / selection / indexutil.cpp
index c448bc2274153490ec2553ac8e0d5369a827b75c..2e85724ac4d8e43ee679f2e55269a643fb5c03eb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -801,8 +801,7 @@ next_group_index(int atomIndex, t_topology *top, e_index_t type, int *id)
  *   (depending on \p type) that is partially contained in the group.
  *   If \p type is not INDEX_RES or INDEX_MOL, this has no effect.
  *
- * \p m should have been initialized somehow (calloc() is enough) unless
- * \p type is INDEX_UNKNOWN.
+ * \p m should have been initialized somehow (calloc() is enough).
  * \p g should be sorted.
  */
 void
@@ -811,8 +810,9 @@ gmx_ana_index_make_block(t_blocka *t, t_topology *top, gmx_ana_index_t *g,
 {
     if (type == INDEX_UNKNOWN)
     {
+        sfree(t->a);
+        srenew(t->index, 2);
         t->nr           = 1;
-        snew(t->index, 2);
         t->nalloc_index = 2;
         t->index[0]     = 0;
         t->index[1]     = 0;