Fix random typos
[alexxy/gromacs.git] / src / gromacs / mdlib / calc_verletbuf.h
index 58c0ab860a37071ee3a8f3ae7b25173165e08398..59b6be9ef338dde3f84421c3fe1fd3eb2d96ca1e 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017 by the GROMACS development team.
+ * Copyright (c) 2018,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.
 struct gmx_mtop_t;
 struct t_inputrec;
 
+namespace gmx
+{
+template<typename>
+class ArrayRef;
+class RangePartitioning;
+} // namespace gmx
+
+namespace Nbnxm
+{
+enum class KernelType;
+} // namespace Nbnxm
+
+
 struct VerletbufListSetup
 {
-    int  cluster_size_i;  /* Cluster pair-list i-cluster size atom count */
-    int  cluster_size_j;  /* Cluster pair-list j-cluster size atom count */
+    int cluster_size_i; /* Cluster pair-list i-cluster size atom count */
+    int cluster_size_j; /* Cluster pair-list j-cluster size atom count */
 };
 
 
@@ -62,7 +76,7 @@ static const real verlet_buffer_ratio_NVE_T0     = 0.10;
 
 /* Returns the pair-list setup for the given nbnxn kernel type.
  */
-VerletbufListSetup verletbufGetListSetup(int nbnxnKernelType);
+VerletbufListSetup verletbufGetListSetup(Nbnxm::KernelType nbnxnKernelType);
 
 /* Enum for choosing the list type for verletbufGetSafeListSetup() */
 enum class ListSetupType
@@ -78,33 +92,48 @@ enum class ListSetupType
  */
 VerletbufListSetup verletbufGetSafeListSetup(ListSetupType listType);
 
-/* Calculate the non-bonded pair-list buffer size for the Verlet list
+/* Returns the non-bonded pair-list radius including computed buffer
+ *
+ * Calculate the non-bonded pair-list buffer size for the Verlet list
  * based on the particle masses, temperature, LJ types, charges
  * and constraints as well as the non-bonded force behavior at the cut-off.
  * The pair list update frequency and the list lifetime, which is nstlist-1
  * for normal pair-list buffering, are passed separately, as in some cases
  * we want an estimate for different values than the ones set in the inputrec.
- * If reference_temperature < 0, the maximum coupling temperature will be used.
+ * If referenceTemperature < 0, the maximum coupling temperature will be used.
  * The target is a maximum average energy jump per atom of
- * ir->verletbuf_tol*nstlist*ir->delta_t over the lifetime of the list.
- * Returns the number of non-linear virtual sites. For these it's difficult
- * to determine their contribution to the drift exaclty, so we approximate.
- * Returns the pair-list cut-off.
+ * inputrec.verletbuf_tol*nstlist*inputrec.delta_t over the lifetime of the list.
+ *
+ * \note For non-linear virtual sites it can be problematic to determine their
+ *       contribution to the drift exaclty, so we approximate.
+ *
+ * \param[in] mtop          The system topology
+ * \param[in] boxVolume     The volume of the unit cell
+ * \param[in] inputrec      The input record
+ * \param[in] nstlist       The pair list update frequency in steps (is not taken from \p inputrec)
+ * \param[in] listLifetime  The lifetime of the pair-list, usually nstlist-1, but could be different
+ *                          for dynamic pruning
+ * \param[in] referenceTemperature  The reference temperature for the ensemble
+ * \param[in] listSetup     The pair-list setup
+ * \returns The computed pair-list radius including buffer
  */
-void calc_verlet_buffer_size(const gmx_mtop_t *mtop, real boxvol,
-                             const t_inputrec *ir,
-                             int               nstlist,
-                             int               list_lifetime,
-                             real reference_temperature,
-                             const VerletbufListSetup *list_setup,
-                             int *n_nonlin_vsite,
-                             real *rlist);
+real calcVerletBufferSize(const gmx_mtop_t&         mtop,
+                          real                      boxVolume,
+                          const t_inputrec&         inputrec,
+                          int                       nstlist,
+                          int                       listLifetime,
+                          real                      referenceTemperature,
+                          const VerletbufListSetup& listSetup);
+
+/* Convenience type */
+using PartitioningPerMoltype = gmx::ArrayRef<const gmx::RangePartitioning>;
 
 /* Determines the mininum cell size based on atom displacement
  *
  * The value returned is the minimum size for which the chance that
- * an atom crosses to non nearest-neighbor cells is <= chanceRequested
- * within ir.nstlist steps.
+ * an atom or update group crosses to non nearest-neighbor cells
+ * is <= chanceRequested within ir.nstlist steps.
+ * Update groups are used when !updateGrouping.empty().
  * Without T-coupling, SD or BD, we can not estimate atom displacements
  * and fall back to the, crude, estimate of using the pairlist buffer size.
  *
@@ -114,9 +143,10 @@ void calc_verlet_buffer_size(const gmx_mtop_t *mtop, real boxvol,
  *
  * Note: This size increases (very slowly) with system size.
  */
-real minCellSizeForAtomDisplacement(const gmx_mtop_t &mtop,
-                                    const t_inputrec &ir,
-                                    real              chanceRequested);
+real minCellSizeForAtomDisplacement(const gmx_mtop_t&      mtop,
+                                    const t_inputrec&      ir,
+                                    PartitioningPerMoltype updateGrouping,
+                                    real                   chanceRequested);
 
 /* Struct for unique atom type for calculating the energy drift.
  * The atom displacement depends on mass and constraints.
@@ -141,9 +171,6 @@ struct atom_nonbonded_kinetic_prop_t
  *
  * Only exposed here for testing purposes.
  */
-void constrained_atom_sigma2(real                                 kT_fac,
-                             const atom_nonbonded_kinetic_prop_t *prop,
-                             real                                *sigma2_2d,
-                             real                                *sigma2_3d);
+void constrained_atom_sigma2(real kT_fac, const atom_nonbonded_kinetic_prop_t* prop, real* sigma2_2d, real* sigma2_3d);
 
 #endif