Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / selection / sm_simple.cpp
index d30003082a872a14211c746c8ddb77aa45038aa5..de1a6fc650d4a5e3890397d3f13296da2f5d41b8 100644 (file)
@@ -1,52 +1,55 @@
 /*
+ * This file is part of the GROMACS molecular simulation package.
  *
- *                This source code is part of
+ * Copyright (c) 2009,2010,2011,2012,2013,2014, 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.
  *
- *                 G   R   O   M   A   C   S
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
  *
- *          GROningen MAchine for Chemical Simulations
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2009, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
  *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
  *
  * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
+ * the research papers on the package. Check out http://www.gromacs.org.
  */
 /*! \internal \file
  * \brief
  * Implements simple keyword selection methods.
  *
- * \author Teemu Murtola <teemu.murtola@cbr.su.se>
+ * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_selection
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
 
 #include <cctype>
 
 #include "gromacs/legacyheaders/macros.h"
-
 #include "gromacs/selection/position.h"
-#include "gromacs/selection/selmethod.h"
+#include "gromacs/topology/topology.h"
 #include "gromacs/utility/exceptions.h"
 
+#include "selmethod.h"
+
 /** Evaluates the \p all selection keyword. */
 static void
 evaluate_all(t_topology *top, t_trxframe *fr, t_pbc *pbc,
@@ -67,7 +70,17 @@ evaluate_resnr(t_topology *top, t_trxframe *fr, t_pbc *pbc,
 static void
 evaluate_resindex(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
-/** Checks whether molecule information is present in the topology. */
+/*! \brief
+ * Checks whether molecule information is present in the topology.
+ *
+ * \param[in] top  Topology structure.
+ * \param     npar Not used.
+ * \param     param Not used.
+ * \param     data Not used.
+ * \returns   0 if molecule info is present in the topology, -1 otherwise.
+ *
+ * If molecule information is not found, also prints an error message.
+ */
 static void
 check_molecules(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
 /** Evaluates the \p molindex selection keyword. */
@@ -82,7 +95,17 @@ evaluate_atomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
 static void
 evaluate_pdbatomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                      gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
-/** Checks whether atom types are present in the topology. */
+/*! \brief
+ * Checks whether atom types are present in the topology.
+ *
+ * \param[in] top  Topology structure.
+ * \param     npar Not used.
+ * \param     param Not used.
+ * \param     data Not used.
+ * \returns   0 if atom types are present in the topology, -1 otherwise.
+ *
+ * If the atom types are not found, also prints an error message.
+ */
 static void
 check_atomtype(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
 /** Evaluates the \p atomtype selection keyword. */
@@ -105,7 +128,17 @@ evaluate_mass(t_topology *top, t_trxframe *fr, t_pbc *pbc,
 static void
 evaluate_charge(t_topology *top, t_trxframe *fr, t_pbc *pbc,
                 gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data);
-/** Checks whether PDB info is present in the topology. */
+/*! \brief
+ * Checks whether PDB info is present in the topology.
+ *
+ * \param[in] top  Topology structure.
+ * \param     npar Not used.
+ * \param     param Not used.
+ * \param     data Not used.
+ * \returns   0 if PDB info is present in the topology, -1 otherwise.
+ *
+ * If PDB info is not found, also prints an error message.
+ */
 static void
 check_pdbinfo(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
 /** Evaluates the \p altloc selection keyword. */
@@ -158,7 +191,7 @@ static const char *help_atomname[] = {
     "keywords."
 };
 
-/** \internal Selection method data for \p all selection keyword. */
+/** Selection method data for \p all selection keyword. */
 gmx_ana_selmethod_t sm_all = {
     "all", GROUP_VALUE, 0,
     0, NULL,
@@ -172,7 +205,7 @@ gmx_ana_selmethod_t sm_all = {
     NULL,
 };
 
-/** \internal Selection method data for \p none selection keyword. */
+/** Selection method data for \p none selection keyword. */
 gmx_ana_selmethod_t sm_none = {
     "none", GROUP_VALUE, 0,
     0, NULL,
@@ -186,7 +219,7 @@ gmx_ana_selmethod_t sm_none = {
     NULL,
 };
 
-/** \internal Selection method data for \p atomnr selection keyword. */
+/** Selection method data for \p atomnr selection keyword. */
 gmx_ana_selmethod_t sm_atomnr = {
     "atomnr", INT_VALUE, 0,
     0, NULL,
@@ -200,7 +233,7 @@ gmx_ana_selmethod_t sm_atomnr = {
     NULL,
 };
 
-/** \internal Selection method data for \p resnr selection keyword. */
+/** Selection method data for \p resnr selection keyword. */
 gmx_ana_selmethod_t sm_resnr = {
     "resnr", INT_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -214,7 +247,7 @@ gmx_ana_selmethod_t sm_resnr = {
     NULL,
 };
 
-/** \internal Selection method data for \p resindex selection keyword. */
+/** Selection method data for \p resindex selection keyword. */
 gmx_ana_selmethod_t sm_resindex = {
     "resindex", INT_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -228,7 +261,7 @@ gmx_ana_selmethod_t sm_resindex = {
     NULL,
 };
 
-/** \internal Selection method data for \p molindex selection keyword. */
+/** Selection method data for \p molindex selection keyword. */
 gmx_ana_selmethod_t sm_molindex = {
     "molindex", INT_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -242,7 +275,7 @@ gmx_ana_selmethod_t sm_molindex = {
     NULL,
 };
 
-/** \internal Selection method data for \p atomname selection keyword. */
+/** Selection method data for \p atomname selection keyword. */
 gmx_ana_selmethod_t sm_atomname = {
     "atomname", STR_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -257,7 +290,7 @@ gmx_ana_selmethod_t sm_atomname = {
     {NULL, asize(help_atomname), help_atomname}
 };
 
-/** \internal Selection method data for \p pdbatomname selection keyword. */
+/** Selection method data for \p pdbatomname selection keyword. */
 gmx_ana_selmethod_t sm_pdbatomname = {
     "pdbatomname", STR_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -272,7 +305,7 @@ gmx_ana_selmethod_t sm_pdbatomname = {
     {NULL, asize(help_atomname), help_atomname}
 };
 
-/** \internal Selection method data for \p atomtype selection keyword. */
+/** Selection method data for \p atomtype selection keyword. */
 gmx_ana_selmethod_t sm_atomtype = {
     "atomtype", STR_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -286,7 +319,7 @@ gmx_ana_selmethod_t sm_atomtype = {
     NULL,
 };
 
-/** \internal Selection method data for \p resname selection keyword. */
+/** Selection method data for \p resname selection keyword. */
 gmx_ana_selmethod_t sm_resname = {
     "resname", STR_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -300,7 +333,7 @@ gmx_ana_selmethod_t sm_resname = {
     NULL,
 };
 
-/** \internal Selection method data for \p chain selection keyword. */
+/** Selection method data for \p chain selection keyword. */
 gmx_ana_selmethod_t sm_insertcode = {
     "insertcode", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL,
     0, NULL,
@@ -314,7 +347,7 @@ gmx_ana_selmethod_t sm_insertcode = {
     NULL,
 };
 
-/** \internal Selection method data for \p chain selection keyword. */
+/** Selection method data for \p chain selection keyword. */
 gmx_ana_selmethod_t sm_chain = {
     "chain", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL,
     0, NULL,
@@ -328,7 +361,7 @@ gmx_ana_selmethod_t sm_chain = {
     NULL,
 };
 
-/** \internal Selection method data for \p mass selection keyword. */
+/** Selection method data for \p mass selection keyword. */
 gmx_ana_selmethod_t sm_mass = {
     "mass", REAL_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -342,7 +375,7 @@ gmx_ana_selmethod_t sm_mass = {
     NULL,
 };
 
-/** \internal Selection method data for \p charge selection keyword. */
+/** Selection method data for \p charge selection keyword. */
 gmx_ana_selmethod_t sm_charge = {
     "charge", REAL_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -356,7 +389,7 @@ gmx_ana_selmethod_t sm_charge = {
     NULL,
 };
 
-/** \internal Selection method data for \p chain selection keyword. */
+/** Selection method data for \p chain selection keyword. */
 gmx_ana_selmethod_t sm_altloc = {
     "altloc", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL,
     0, NULL,
@@ -370,7 +403,7 @@ gmx_ana_selmethod_t sm_altloc = {
     NULL,
 };
 
-/** \internal Selection method data for \p occupancy selection keyword. */
+/** Selection method data for \p occupancy selection keyword. */
 gmx_ana_selmethod_t sm_occupancy = {
     "occupancy", REAL_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -384,7 +417,7 @@ gmx_ana_selmethod_t sm_occupancy = {
     NULL,
 };
 
-/** \internal Selection method data for \p betafactor selection keyword. */
+/** Selection method data for \p betafactor selection keyword. */
 gmx_ana_selmethod_t sm_betafactor = {
     "betafactor", REAL_VALUE, SMETH_REQTOP,
     0, NULL,
@@ -398,45 +431,45 @@ gmx_ana_selmethod_t sm_betafactor = {
     NULL,
 };
 
-/** \internal Selection method data for \p x selection keyword. */
+/** Selection method data for \p x selection keyword. */
 gmx_ana_selmethod_t sm_x = {
     "x", REAL_VALUE, SMETH_DYNAMIC,
     0, NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
     &evaluate_x,
 };
 
-/** \internal Selection method data for \p y selection keyword. */
+/** Selection method data for \p y selection keyword. */
 gmx_ana_selmethod_t sm_y = {
     "y", REAL_VALUE, SMETH_DYNAMIC,
     0, NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
     &evaluate_y,
 };
 
-/** \internal Selection method data for \p z selection keyword. */
+/** Selection method data for \p z selection keyword. */
 gmx_ana_selmethod_t sm_z = {
     "z", REAL_VALUE, SMETH_DYNAMIC,
     0, NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
-     NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
     &evaluate_z,
 };
 
@@ -447,8 +480,8 @@ gmx_ana_selmethod_t sm_z = {
  * Copies \p g to \p out->u.g.
  */
 static void
-evaluate_all(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-             gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_all(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
+             gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     gmx_ana_index_copy(out->u.g, g, false);
 }
@@ -460,8 +493,8 @@ evaluate_all(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns an empty \p out->u.g.
  */
 static void
-evaluate_none(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-              gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_none(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
+              gmx_ana_index_t * /* g */, gmx_ana_selvalue_t *out, void * /* data */)
 {
     out->u.g->isize = 0;
 }
@@ -473,8 +506,8 @@ evaluate_none(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the indices for each atom in \p out->u.i.
  */
 static void
-evaluate_atomnr(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_atomnr(t_topology * /* top */, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -492,8 +525,8 @@ evaluate_atomnr(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the residue numbers for each atom in \p out->u.i.
  */
 static void
-evaluate_resnr(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-               gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_resnr(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+               gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
     int  resind;
@@ -501,7 +534,7 @@ evaluate_resnr(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     out->nr = g->isize;
     for (i = 0; i < g->isize; ++i)
     {
-        resind = top->atoms.atom[g->index[i]].resind;
+        resind      = top->atoms.atom[g->index[i]].resind;
         out->u.i[i] = top->atoms.resinfo[resind].nr;
     }
 }
@@ -513,8 +546,8 @@ evaluate_resnr(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the residue indices for each atom in \p out->u.i.
  */
 static void
-evaluate_resindex(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_resindex(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -525,17 +558,8 @@ evaluate_resindex(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     }
 }
 
-/*!
- * \param[in] top  Topology structure.
- * \param     npar Not used.
- * \param     param Not used.
- * \param     data Not used.
- * \returns   0 if molecule info is present in the topology, -1 otherwise.
- *
- * If molecule information is not found, also prints an error message.
- */
 static void
-check_molecules(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+check_molecules(t_topology *top, int /* npar */, gmx_ana_selparam_t * /* param */, void * /* data */)
 {
     bool bOk;
 
@@ -553,15 +577,18 @@ check_molecules(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data
  * Returns the molecule indices for each atom in \p out->u.i.
  */
 static void
-evaluate_molindex(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_molindex(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i, j;
 
     out->nr = g->isize;
     for (i = j = 0; i < g->isize; ++i)
     {
-        while (top->mols.index[j + 1] <= g->index[i]) ++j;
+        while (top->mols.index[j + 1] <= g->index[i])
+        {
+            ++j;
+        }
         out->u.i[i] = j + 1;
     }
 }
@@ -573,8 +600,8 @@ evaluate_molindex(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the atom name for each atom in \p out->u.s.
  */
 static void
-evaluate_atomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_atomname(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -592,8 +619,8 @@ evaluate_atomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the PDB atom name for each atom in \p out->u.s.
  */
 static void
-evaluate_pdbatomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                     gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_pdbatomname(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                     gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -609,17 +636,8 @@ evaluate_pdbatomname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     }
 }
 
-/*!
- * \param[in] top  Topology structure.
- * \param     npar Not used.
- * \param     param Not used.
- * \param     data Not used.
- * \returns   0 if atom types are present in the topology, -1 otherwise.
- *
- * If the atom types are not found, also prints an error message.
- */
 static void
-check_atomtype(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+check_atomtype(t_topology *top, int /* npar */, gmx_ana_selparam_t * /* param */, void * /* data */)
 {
     bool bOk;
 
@@ -638,8 +656,8 @@ check_atomtype(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
  * Segfaults if atom types are not found in the topology.
  */
 static void
-evaluate_atomtype(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_atomtype(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                  gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -657,8 +675,8 @@ evaluate_atomtype(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the residue name for each atom in \p out->u.s.
  */
 static void
-evaluate_resname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                 gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_resname(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                 gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
     int  resind;
@@ -666,7 +684,7 @@ evaluate_resname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     out->nr = g->isize;
     for (i = 0; i < g->isize; ++i)
     {
-        resind = top->atoms.atom[g->index[i]].resind;
+        resind      = top->atoms.atom[g->index[i]].resind;
         out->u.s[i] = *top->atoms.resinfo[resind].name;
     }
 }
@@ -678,8 +696,8 @@ evaluate_resname(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the insertion code for each atom in \p out->u.s.
  */
 static void
-evaluate_insertcode(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                    gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_insertcode(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                    gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
     int  resind;
@@ -687,7 +705,7 @@ evaluate_insertcode(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     out->nr = g->isize;
     for (i = 0; i < g->isize; ++i)
     {
-        resind = top->atoms.atom[g->index[i]].resind;
+        resind         = top->atoms.atom[g->index[i]].resind;
         out->u.s[i][0] = top->atoms.resinfo[resind].ic;
     }
 }
@@ -699,8 +717,8 @@ evaluate_insertcode(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the chain for each atom in \p out->u.s.
  */
 static void
-evaluate_chain(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-               gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_chain(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+               gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
     int  resind;
@@ -708,7 +726,7 @@ evaluate_chain(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     out->nr = g->isize;
     for (i = 0; i < g->isize; ++i)
     {
-        resind = top->atoms.atom[g->index[i]].resind;
+        resind         = top->atoms.atom[g->index[i]].resind;
         out->u.s[i][0] = top->atoms.resinfo[resind].chainid;
     }
 }
@@ -720,8 +738,8 @@ evaluate_chain(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the mass for each atom in \p out->u.r.
  */
 static void
-evaluate_mass(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-              gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_mass(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+              gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -739,8 +757,8 @@ evaluate_mass(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the charge for each atom in \p out->u.r.
  */
 static void
-evaluate_charge(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_charge(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -751,17 +769,8 @@ evaluate_charge(t_topology *top, t_trxframe *fr, t_pbc *pbc,
     }
 }
 
-/*!
- * \param[in] top  Topology structure.
- * \param     npar Not used.
- * \param     param Not used.
- * \param     data Not used.
- * \returns   0 if PDB info is present in the topology, -1 otherwise.
- *
- * If PDB info is not found, also prints an error message.
- */
 static void
-check_pdbinfo(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
+check_pdbinfo(t_topology *top, int /* npar */, gmx_ana_selparam_t * /* param */, void * /* data */)
 {
     bool bOk;
 
@@ -779,8 +788,8 @@ check_pdbinfo(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data)
  * Returns the alternate location identifier for each atom in \p out->u.s.
  */
 static void
-evaluate_altloc(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_altloc(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -799,8 +808,8 @@ evaluate_altloc(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Segfaults if PDB info is not found in the topology.
  */
 static void
-evaluate_occupancy(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_occupancy(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                   gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -819,8 +828,8 @@ evaluate_occupancy(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Segfaults if PDB info is not found in the topology.
  */
 static void
-evaluate_betafactor(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-                    gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void *data)
+evaluate_betafactor(t_topology *top, t_trxframe * /* fr */, t_pbc * /* pbc */,
+                    gmx_ana_index_t *g, gmx_ana_selvalue_t *out, void * /* data */)
 {
     int  i;
 
@@ -834,8 +843,6 @@ evaluate_betafactor(t_topology *top, t_trxframe *fr, t_pbc *pbc,
 /*! \brief
  * Internal utility function for position keyword evaluation.
  *
- * \param[in]  fr   Current frame.
- * \param[in]  g    Index group for which the coordinates should be evaluated.
  * \param[out] out  Output array.
  * \param[in]  pos  Position data to use instead of atomic coordinates
  *   (can be NULL).
@@ -845,30 +852,19 @@ evaluate_betafactor(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * evaluate_z() to do the actual evaluation.
  */
 static void
-evaluate_coord(t_trxframe *fr, gmx_ana_index_t *g, real out[],
-               gmx_ana_pos_t *pos, int d)
+evaluate_coord(real out[], gmx_ana_pos_t *pos, int d)
 {
-    int  b, i;
-    real v;
-
-    if (pos)
+    for (int b = 0; b < pos->count(); ++b)
     {
-        for (b = 0; b < pos->nr; ++b)
+        const real v = pos->x[b][d];
+        for (int i = pos->m.mapb.index[b]; i < pos->m.mapb.index[b+1]; ++i)
         {
-            v = pos->x[b][d];
-            for (i = pos->m.mapb.index[b]; i < pos->m.mapb.index[b+1]; ++i)
-            {
-                out[i] = v;
-            }
-        }
-    }
-    else
-    {
-        for (i = 0; i < g->isize; ++i)
-        {
-            out[i] = fr->x[g->index[i]][d];
+            out[i] = v;
         }
     }
+    // TODO: Make this more efficient by directly extracting the coordinates
+    // from the frame coordinates for atomic positions instead of going through
+    // a position calculation.
 }
 
 /*!
@@ -878,11 +874,11 @@ evaluate_coord(t_trxframe *fr, gmx_ana_index_t *g, real out[],
  * Returns the \p x coordinate for each atom in \p out->u.r.
  */
 static void
-evaluate_x(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-           gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data)
+evaluate_x(t_topology * /*top*/, t_trxframe * /*fr*/, t_pbc * /*pbc*/,
+           gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void * /*data*/)
 {
-    out->nr = pos->g->isize;
-    evaluate_coord(fr, pos->g, out->u.r, pos, XX);
+    out->nr = pos->m.mapb.nra;
+    evaluate_coord(out->u.r, pos, XX);
 }
 
 /*!
@@ -892,11 +888,11 @@ evaluate_x(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the \p y coordinate for each atom in \p out->u.r.
  */
 static void
-evaluate_y(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-           gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data)
+evaluate_y(t_topology * /*top*/, t_trxframe * /*fr*/, t_pbc * /*pbc*/,
+           gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void * /*data*/)
 {
-    out->nr = pos->g->isize;
-    evaluate_coord(fr, pos->g, out->u.r, pos, YY);
+    out->nr = pos->m.mapb.nra;
+    evaluate_coord(out->u.r, pos, YY);
 }
 
 /*!
@@ -906,9 +902,9 @@ evaluate_y(t_topology *top, t_trxframe *fr, t_pbc *pbc,
  * Returns the \p z coordinate for each atom in \p out->u.r.
  */
 static void
-evaluate_z(t_topology *top, t_trxframe *fr, t_pbc *pbc,
-           gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void *data)
+evaluate_z(t_topology * /*top*/, t_trxframe * /*fr*/, t_pbc * /*pbc*/,
+           gmx_ana_pos_t *pos, gmx_ana_selvalue_t *out, void * /*data*/)
 {
-    out->nr = pos->g->isize;
-    evaluate_coord(fr, pos->g, out->u.r, pos, ZZ);
+    out->nr = pos->m.mapb.nra;
+    evaluate_coord(out->u.r, pos, ZZ);
 }