#include "gromacs/domdec/domdec.h"
#include "gromacs/domdec/domdec_network.h"
#include "gromacs/domdec/domdec_struct.h"
+#include "gromacs/domdec/nsgrid.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/vec.h"
-#include "gromacs/mdlib/nsgrid.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/pbcutil/pbc.h"
{
calc_pos_av_stddev(x, av, stddev, mpiCommunicator);
- /* GRID_STDDEV_FAC * stddev
+ /* c_gridStdDevFactor * stddev
* gives a uniform load for a rectangular block of cg's.
* For a sphere it is not a bad approximation for 4x1x1 up to 4x2x2.
*/
for (int d = ddbox->nboundeddim; d < DIM; d++)
{
- const real b0 = av[d] - GRID_STDDEV_FAC * stddev[d];
- const real b1 = av[d] + GRID_STDDEV_FAC * stddev[d];
+ const real b0 = av[d] - c_gridStdDevFactor * stddev[d];
+ const real b1 = av[d] + c_gridStdDevFactor * stddev[d];
if (debug)
{
fprintf(debug, "Setting global DD grid boundaries to %f - %f\n", b0, b1);
#include "gromacs/math/vec.h"
#include "gromacs/utility/fatalerror.h"
+/*! \brief The extent of the neighborsearch grid is a bit larger than sqrt(3)
+ * to account for less dense regions at the edges of the system.
+ */
+constexpr real c_stdDevFactor = 2.0;
+
/***********************************
* Grid Routines
***********************************/
* For a sphere stddev is r/sqrt(5): 99.2% falls within the width.
* For a Gaussian distribution 98% fall within the width.
*/
- *bound0 = av - NSGRID_STDDEV_FAC * stddev;
- *bound1 = av + NSGRID_STDDEV_FAC * stddev;
+ *bound0 = av - c_stdDevFactor * stddev;
+ *bound1 = av + c_stdDevFactor * stddev;
- *bdens0 = av - GRID_STDDEV_FAC * stddev;
- *bdens1 = av + GRID_STDDEV_FAC * stddev;
+ *bdens0 = av - c_gridStdDevFactor * stddev;
+ *bdens1 = av + c_gridStdDevFactor * stddev;
}
static void dd_box_bounds_to_ns_bounds(real box0, real box_size, real* gr0, real* gr1)
/* Redetermine av and stddev from the DD box boundaries */
av = box0 + 0.5 * box_size;
- stddev = 0.5 * box_size / GRID_STDDEV_FAC;
+ stddev = 0.5 * box_size / c_gridStdDevFactor;
- *gr0 = av - NSGRID_STDDEV_FAC * stddev;
- *gr1 = av + NSGRID_STDDEV_FAC * stddev;
+ *gr0 = av - c_stdDevFactor * stddev;
+ *gr1 = av + c_stdDevFactor * stddev;
}
void get_nsgrid_boundaries(int nboundeddim,
#ifndef GMX_MDLIB_NSGRID_H
#define GMX_MDLIB_NSGRID_H
-#include <cstdio>
-
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/real.h"
struct gmx_domdec_t;
-struct gmx_domdec_zones_t;
struct gmx_ddbox_t;
-struct t_forcerec;
/*! \brief Used when estimating the interaction density.
*
- * GRID_STDDEV_FAC * stddev estimates the interaction density. The
+ * c_gridStdDevFactor * stddev estimates the interaction density. The
* value sqrt(3) == 1.73205080757 gives a uniform load for a
* rectangular 3D block of charge groups. For a sphere, it is not a
* bad approximation for 4x1x1 up to 4x2x2.
* \todo It would be nicer to use sqrt(3) here, when all code that
* includes this file is in C++, which will let us cope with the
* std::sqrt<T> on Windows. */
-static const real GRID_STDDEV_FAC = 1.73205080757;
-
-/*! \brief The extent of the neighborsearch grid is a bit larger than sqrt(3)
- * to account for less dense regions at the edges of the system.
- */
-static const real NSGRID_STDDEV_FAC = 2.0;
-
-#define NSGRID_SIGNAL_MOVED_FAC 4
-/* A cell index of NSGRID_SIGNAL_MOVED_FAC*ncells signals
- * that a charge group moved to another DD domain.
- */
+constexpr real c_gridStdDevFactor = 1.73205080757;
void get_nsgrid_boundaries(int nboundeddim,
matrix box,
#include "gromacs/domdec/ga2la.h"
#include "gromacs/domdec/localatomsetmanager.h"
#include "gromacs/domdec/mdsetup.h"
+#include "gromacs/domdec/nsgrid.h"
#include "gromacs/ewald/pme_pp.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/mdlib/forcerec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/mdatoms.h"
-#include "gromacs/mdlib/nsgrid.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/forcerec.h"
wallcycle_sub_stop(wcycle, ewcsDD_REDIST);
}
- // TODO: Integrate this code in the nbnxm module
get_nsgrid_boundaries(ddbox.nboundeddim,
state_local->box,
dd,
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
-#include "gromacs/mdlib/nsgrid.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/mdtypes/state.h"