This is another patch in the cleaning efforts of sim_util.
It finally removes sim_util.h
The idea is to only have functions relevant to the force
schedules there so that it becomes easy to move it into
its own module with minimal merging pains.
Related: #2574
Change-Id: Ib0c2dbc21bd31ee272888d3fa25a3c0ce65b5478
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/perf_est.h"
#include "gromacs/mdlib/qmmm.h"
-#include "gromacs/mdlib/sim_util.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdrunutility/mdmodules.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdlib/ns.h"
#include "gromacs/mdlib/qmmm.h"
#include "gromacs/mdlib/rf_util.h"
-#include "gromacs/mdlib/sim_util.h"
#include "gromacs/mdlib/wall.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/fcdata.h"
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/force.h"
#include "gromacs/mdlib/force_flags.h"
+#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/mdatoms.h"
-#include "gromacs/mdlib/sim_util.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/enerdata.h"
if (inputrec->cutoff_scheme == ecutsVERLET)
{
auto xRef = state->x.arrayRefWithPadding().paddedArrayRef();
- put_atoms_in_box_omp(fr->ePBC, state->box, xRef.subArray(0, md->homenr));
+ put_atoms_in_box_omp(fr->ePBC, state->box, xRef.subArray(0, md->homenr), gmx_omp_nthreads_get(emntDefault));
}
else
{
*/
#include "gmxpre.h"
-#include "sim_util.h"
-
#include "config.h"
#include <cmath>
if (bCalcCGCM)
{
- put_atoms_in_box_omp(fr->ePBC, box, x.unpaddedArrayRef().subArray(0, homenr));
+ put_atoms_in_box_omp(fr->ePBC, box, x.unpaddedArrayRef().subArray(0, homenr), gmx_omp_nthreads_get(emntDefault));
inc_nrnb(nrnb, eNR_SHIFTX, homenr);
}
else if (EI_ENERGY_MINIMIZATION(inputrec->eI) && graph)
*/
ddBalanceRegionHandler.openBeforeForceComputationCpu(DdAllowBalanceRegionReopen::no);
}
-
-void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x)
-{
- int t, nth;
- nth = gmx_omp_nthreads_get(emntDefault);
-
-#pragma omp parallel for num_threads(nth) schedule(static)
- for (t = 0; t < nth; t++)
- {
- try
- {
- size_t natoms = x.size();
- size_t offset = (natoms*t )/nth;
- size_t len = (natoms*(t + 1))/nth - offset;
- put_atoms_in_box(ePBC, box, x.subArray(offset, len));
- }
- GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
- }
-}
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, 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.
- *
- * 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.
- *
- * 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.
- *
- * 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 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 research papers on the package. Check out http://www.gromacs.org.
- */
-#ifndef GMX_MDLIB_SIM_UTIL_H
-#define GMX_MDLIB_SIM_UTIL_H
-
-#include "gromacs/math/vectypes.h"
-#include "gromacs/utility/arrayref.h"
-
-/*! \brief Parallellizes put_atoms_in_box()
- *
- * This wrapper function around put_atoms_in_box() with the ugly manual
- * workload splitting is needed to avoid silently introducing multithreading
- * in tools.
- * \param[in] ePBC The pbc type
- * \param[in] box The simulation box
- * \param[inout] x The coordinates of the atoms
- */
-void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x);
-
-#endif
#include "gromacs/mdlib/resethandler.h"
#include "gromacs/mdlib/shellfc.h"
#include "gromacs/mdlib/sighandler.h"
-#include "gromacs/mdlib/sim_util.h"
#include "gromacs/mdlib/simulationsignal.h"
#include "gromacs/mdlib/stat.h"
#include "gromacs/mdlib/stophandler.h"
#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdlib/ns.h"
-#include "gromacs/mdlib/sim_util.h"
#include "gromacs/mdlib/tgroup.h"
#include "gromacs/mdlib/update.h"
#include "gromacs/mdlib/vsite.h"
}
}
+void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth)
+{
+ int t;
+
+#pragma omp parallel for num_threads(nth) schedule(static)
+ for (t = 0; t < nth; t++)
+ {
+ try
+ {
+ size_t natoms = x.size();
+ size_t offset = (natoms*t )/nth;
+ size_t len = (natoms*(t + 1))/nth - offset;
+ put_atoms_in_box(ePBC, box, x.subArray(offset, len));
+ }
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+ }
+}
+
void put_atoms_in_triclinic_unitcell(int ecenter, const matrix box,
gmx::ArrayRef<gmx::RVec> x)
{
* These routines puts ONE or ALL atoms in the box, not caring
* about charge groups!
* Also works for triclinic cells.
- * \param[in] ePBC The pbc type
- * \param[in] box The simulation box
+ * \param[in] ePBC The pbc type
+ * \param[in] box The simulation box
* \param[in,out] x The coordinates of the atoms
*/
void put_atoms_in_box(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x);
+/*! \brief Parallellizes put_atoms_in_box()
+ *
+ * This wrapper function around put_atoms_in_box() with the ugly manual
+ * workload splitting is needed to avoid silently introducing multithreading
+ * in tools.
+ * \param[in] ePBC The pbc type
+ * \param[in] box The simulation box
+ * \param[in,out] x The coordinates of the atoms
+ * \param[in] nth number of threads to be used in the given module
+ */
+void put_atoms_in_box_omp(int ePBC, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_unused int nth);
+
/*! \brief Put atoms inside triclinic box
*
* This puts ALL atoms in the triclinic unit cell, centered around the
#include "gromacs/gmxlib/network.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/groupcoord.h"
-#include "gromacs/mdlib/sim_util.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"