Additional index group checks for selections
[alexxy/gromacs.git] / src / gromacs / selection / indexutil.cpp
index f921caeaac856565f63e953a9df31505d35d9589..3ed8c8783e99020e382325d528546265396e4c61 100644 (file)
@@ -440,6 +440,19 @@ gmx_ana_index_check_sorted(gmx_ana_index_t *g)
     return true;
 }
 
+bool
+gmx_ana_index_check_range(gmx_ana_index_t *g, int natoms)
+{
+    for (int i = 0; i < g->isize; ++i)
+    {
+        if (g->index[i] < 0 || g->index[i] >= natoms)
+        {
+            return false;
+        }
+    }
+    return true;
+}
+
 /********************************************************************
  * Set operations
  ********************************************************************/