Merge release-2021 into master
[alexxy/gromacs.git] / src / gromacs / selection / evaluate.cpp
index a182c4988bc348819921faa83bbce6a37ac68153..079f906cb9701b21d8c94381a1762c42f28a1fb9 100644 (file)
@@ -1,7 +1,9 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
+ * Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
+ * Copyright (c) 2019,2020,2021, 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.
@@ -417,6 +419,7 @@ SelectionEvaluator::SelectionEvaluator() {}
  * This is the only function that user code should call if they want to
  * evaluate a selection for a new frame.
  */
+// NOLINTNEXTLINE readability-convert-member-functions-to-static
 void SelectionEvaluator::evaluate(SelectionCollection* coll, t_trxframe* fr, t_pbc* pbc)
 {
     gmx_ana_selcollection_t* sc = &coll->impl_->sc_;
@@ -462,6 +465,7 @@ void SelectionEvaluator::evaluate(SelectionCollection* coll, t_trxframe* fr, t_p
  * \param[in,out] coll  The selection collection to evaluate.
  * \param[in]     nframes Total number of frames.
  */
+// NOLINTNEXTLINE readability-convert-member-functions-to-static
 void SelectionEvaluator::evaluateFinal(SelectionCollection* coll, int nframes)
 {
     gmx_ana_selcollection_t* sc = &coll->impl_->sc_;
@@ -518,6 +522,7 @@ void _gmx_sel_evaluate_static(gmx_sel_evaluate_t* /* data */,
 {
     if (sel->flags & SEL_UNSORTED)
     {
+        gmx_ana_index_reserve(sel->v.u.g, sel->u.cgrp.isize);
         // This only works if g contains all the atoms, but that is currently
         // the only supported case.
         gmx_ana_index_copy(sel->v.u.g, &sel->u.cgrp, false);
@@ -949,8 +954,7 @@ void _gmx_sel_evaluate_method(gmx_sel_evaluate_t*                     data,
                     expandValueForPositions(sel->v.u.r, &sel->v.nr, sel->u.expr.pos);
                     break;
                 default:
-                    GMX_RELEASE_ASSERT(false,
-                                       "Unimplemented value type for position update method");
+                    GMX_RELEASE_ASSERT(false, "Unimplemented value type for position update method");
             }
         }
     }