Renamed bonded module as 'listed-forces'
authorMark Abraham <mark.j.abraham@gmail.com>
Sun, 14 Sep 2014 15:39:30 +0000 (17:39 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 23 Sep 2014 13:52:32 +0000 (15:52 +0200)
This name is more in line with all the functionality that might end up
in this module, because they all share the same implementation
property that there's a small list of atoms participating in each
individual interaction, and we don't treat them in the non-bonded or
PME code. Examples: bonded, 1-4, various restraints

Added basic Doxygen support for this module, which makes the existing
documentation visible and the new include sorting functional. Added
basic Doxygen for many functions, but not thirty-plus actual "compute
this kind of interaction" functions (to come later).

Fixed various higher-level code and documentation to refer more
accurately to listed interactions (e.g. GMX_FORCE_LISTED, ewcsLISTED).

Also removed an unecessary extern "C" for restcbt.h, and removed
unecessary include of genborn.h for bonded.h

Change-Id: If2271eab53a952058b0ed9ff92bd7a326c1797cd

24 files changed:
cmake/gmxGCC44O3BugWorkaround.cmake
docs/manual/install.tex
src/gromacs/CMakeLists.txt
src/gromacs/gmxana/anadih.c
src/gromacs/gmxana/gmx_dipoles.cpp
src/gromacs/gmxana/hxprops.c
src/gromacs/gmxana/nrama.c
src/gromacs/gmxlib/bonded-threading.cpp
src/gromacs/gmxlib/gmx_omp_nthreads.c
src/gromacs/gmxlib/ifunc.c
src/gromacs/gmxlib/nonbonded/nonbonded.c
src/gromacs/gmxpreprocess/x2top.c
src/gromacs/legacyheaders/types/force_flags.h
src/gromacs/listed-forces/CMakeLists.txt [moved from src/gromacs/bonded/CMakeLists.txt with 88% similarity]
src/gromacs/listed-forces/bonded.cpp [moved from src/gromacs/bonded/bonded.cpp with 98% similarity]
src/gromacs/listed-forces/bonded.h [moved from src/gromacs/bonded/bonded.h with 74% similarity]
src/gromacs/listed-forces/restcbt.cpp [moved from src/gromacs/bonded/restcbt.cpp with 98% similarity]
src/gromacs/listed-forces/restcbt.h [moved from src/gromacs/bonded/restcbt.h with 98% similarity]
src/gromacs/mdlib/domdec.cpp
src/gromacs/mdlib/force.c
src/gromacs/mdlib/genborn.c
src/gromacs/mdlib/sim_util.c
src/gromacs/timing/wallcycle.c
src/gromacs/timing/wallcycle.h

index 6c43ba2a951187a65a0acc64fc49fc96af1ae6ef..a71d88f99b476158900073b11a6a004b81ceb1ea 100644 (file)
@@ -32,7 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-# Due to a bug, gcc 4.4.x crashes when compiling bonded/bonded.cpp with -O3 and
+# Due to a bug, gcc 4.4.x crashes when compiling listed-forces/bonded.cpp with -O3 and
 # -fopenmp, but strangely it does not crash with -O2 + all additional options.
 # -O3 uses. Therefore, for the affected files, when compiling in release mode,
 # we override -O3 with -O2 and add the additional option.
index 5386ba59018cb1b93b37c9717383b172dc67e6c3..d80a987e1d871ed23dca256f27b25b1575bcbb5e 100644 (file)
@@ -260,7 +260,7 @@ you should consult your local documentation for details.
 \item   {\tt GMX_NO_NODECOMM}: do not use separate inter- and intra-node communicators.
 \item   {\tt GMX_NO_NONBONDED}: skip non-bonded calculations; can be used to estimate the possible
         performance gain from adding a GPU accelerator to the current hardware setup -- assuming that this is
-        fast enough to complete the non-bonded calculations while the CPU does bonded force and PME computation.
+        fast enough to complete the non-bonded calculations while the CPU does listed force and PME computation.
 \item   {\tt GMX_NO_PULLVIR}: when set, do not add virial contribution to COM pull forces.
 \item   {\tt GMX_NOCHARGEGROUPS}: disables multi-atom charge groups, {\ie} each atom 
         in all non-solvent molecules is assigned its own charge group.
index 912789403df6eeb2ca7239c0d6484427d8e22b3d..56022c0987ddfb7684e6a2066cc32ed9aa37fa01 100644 (file)
@@ -77,7 +77,7 @@ endif()
 add_subdirectory(gmxlib)
 add_subdirectory(mdlib)
 add_subdirectory(gmxpreprocess)
-add_subdirectory(bonded)
+add_subdirectory(listed-forces)
 add_subdirectory(commandline)
 add_subdirectory(fft)
 add_subdirectory(linearalgebra)
@@ -142,7 +142,7 @@ list(APPEND LIBGROMACS_SOURCES ${GENERATED_VERSION_FILE})
 # apply gcc 4.4.x bug workaround
 if(GMX_USE_GCC44_BUG_WORKAROUND)
    include(gmxGCC44O3BugWorkaround)
-   gmx_apply_gcc44_bug_workaround("bonded/bonded.cpp")
+   gmx_apply_gcc44_bug_workaround("listed-forces/bonded.cpp")
    gmx_apply_gcc44_bug_workaround("mdlib/force.c")
    gmx_apply_gcc44_bug_workaround("mdlib/constr.c")
 endif()
index c967c601c85b036aab9128d755a2531fc43dd813..cc2fef9873f8306ad5157621775426f327d047a2 100644 (file)
@@ -40,7 +40,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/trxio.h"
 #include "gromacs/fileio/xvgr.h"
@@ -48,6 +47,7 @@
 #include "gromacs/legacyheaders/macros.h"
 #include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
index b930a6115e98f83f47ed3ca845b2d8eb78bbbedc..b0f4c12451402e6cb237c5a409ac6c983336fb87 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <algorithm>
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/enxio.h"
 #include "gromacs/fileio/matio.h"
@@ -56,6 +55,7 @@
 #include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/legacyheaders/viewit.h"
 #include "gromacs/linearalgebra/nrjac.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/pbc.h"
index 57acd55c76bb653afecbbfb0d9a0261cb011b382..5b1f6c70743eed9e2f75ce7bdbaa2322f18406b1 100644 (file)
@@ -41,9 +41,9 @@
 #include <math.h>
 #include <string.h>
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/legacyheaders/macros.h"
 #include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/topology/index.h"
index 0c34aeeca73bf5f8e9c6378aba23abd37882087f..5c40c6755958a681e8150f16ce0e92d62251655b 100644 (file)
@@ -41,7 +41,7 @@
 #include <math.h>
 #include <stdlib.h>
 
-#include "gromacs/bonded/bonded.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/pbcutil/rmpbc.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
index 4a69359523b39e937b940e66403f7e21db9325e3..cf9ab16c10cf5a2846027d396c8c6fa2e6d38161 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <algorithm>
 
-#include "gromacs/bonded/bonded.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
index e9a415c403a9473a22cb230aba6119ffd0048d1c..8e61aa4b41708a8b9a2c0e110d6d668393222883 100644 (file)
@@ -73,7 +73,7 @@ static const char *modth_env_var[emntNR] =
 {
     "GMX_DEFAULT_NUM_THREADS should never be set",
     "GMX_DOMDEC_NUM_THREADS", "GMX_PAIRSEARCH_NUM_THREADS",
-    "GMX_NONBONDED_NUM_THREADS", "GMX_BONDED_NUM_THREADS",
+    "GMX_NONBONDED_NUM_THREADS", "GMX_LISTED_FORCES_NUM_THREADS",
     "GMX_PME_NUM_THREADS", "GMX_UPDATE_NUM_THREADS",
     "GMX_VSITE_NUM_THREADS",
     "GMX_LINCS_NUM_THREADS", "GMX_SETTLE_NUM_THREADS"
index 5a649c0bb02ef7e92317e1193a790b61578c6379..e7e42f66447e97fc1cf81582805fb4dc9f98b186 100644 (file)
 /* This file is completely threadsafe - keep it that way! */
 #include "gmxpre.h"
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/legacyheaders/disre.h"
 #include "gromacs/legacyheaders/genborn.h"
 #include "gromacs/legacyheaders/orires.h"
 #include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/listed-forces/bonded.h"
 
 #define  def_bonded(str, lstr, nra, nrpa, nrpb, ind, func) \
     {str, lstr, (nra), (nrpa), (nrpb), IF_BOND,                        (ind), (func)}
index 7bcf2a66b18337c9c75ffdaed7808e54970afdfe..c21e3201b28283e39faf42cb7707d573db1fdb4b 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "thread_mpi/threads.h"
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/gmxlib/nonbonded/nb_free_energy.h"
 #include "gromacs/gmxlib/nonbonded/nb_generic.h"
 #include "gromacs/gmxlib/nonbonded/nb_generic_adress.h"
@@ -58,6 +57,7 @@
 #include "gromacs/legacyheaders/ns.h"
 #include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/ishift.h"
index 1dacc45c63117bc74cd48636385de6eb25ed1a8e..b7b3f7235f4aba0dca9ebfbfbee9934190d3030b 100644 (file)
@@ -40,7 +40,6 @@
 
 #include <assert.h>
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/confio.h"
 #include "gromacs/fileio/gmxfio.h"
@@ -55,6 +54,7 @@
 #include "gromacs/legacyheaders/names.h"
 #include "gromacs/legacyheaders/readinp.h"
 #include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/utilities.h"
 #include "gromacs/math/vec.h"
index 51c9382fa5e20372bcff437752308c1402c71648..b8fd1743cbaa912f80f7bfd8875f5356e9361fc9 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2012, The GROMACS development team.
- * Copyright (c) 2012, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
@@ -54,8 +54,8 @@ extern "C" {
 #define GMX_FORCE_NS           (1<<2)
 /* Update long-range neighborlists */
 #define GMX_FORCE_LRNS         (1<<3)
-/* Calculate bonded energies/forces */
-#define GMX_FORCE_BONDED       (1<<4)
+/* Calculate listed energies/forces (e.g. bonds, restraints, 1-4, FEP non-bonded) */
+#define GMX_FORCE_LISTED       (1<<4)
 /* Store long-range forces in a separate array */
 #define GMX_FORCE_SEPLRF       (1<<5)
 /* Calculate non-bonded energies/forces */
@@ -72,7 +72,7 @@ extern "C" {
 #define GMX_FORCE_DO_LR        (1<<11)
 
 /* Normally one want all energy terms and forces */
-#define GMX_FORCE_ALLFORCES    (GMX_FORCE_BONDED | GMX_FORCE_NONBONDED | GMX_FORCE_FORCES)
+#define GMX_FORCE_ALLFORCES    (GMX_FORCE_LISTED | GMX_FORCE_NONBONDED | GMX_FORCE_FORCES)
 
 
 #ifdef __cplusplus
similarity index 88%
rename from src/gromacs/bonded/CMakeLists.txt
rename to src/gromacs/listed-forces/CMakeLists.txt
index 1542ee9c6e2daab00e48021c1ff351a69ef0b6ce..721f4fbde2cce5640315e379a5d2955f4982901f 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-file(GLOB BONDED_SOURCES *.cpp *.c)
-set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${BONDED_SOURCES} PARENT_SCOPE)
+file(GLOB LISTED_FORCES_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${LISTED_FORCES_SOURCES} PARENT_SCOPE)
 
-set(BONDED_PUBLIC_HEADERS
+set(LISTED_FORCES_PUBLIC_HEADERS
     bonded.h)
 
-gmx_install_headers(bonded ${BONDED_PUBLIC_HEADERS})
+gmx_install_headers(listed-forces ${LISTED_FORCES_PUBLIC_HEADERS})
 
 if (BUILD_TESTING)
 #    add_subdirectory(tests)
similarity index 98%
rename from src/gromacs/bonded/bonded.cpp
rename to src/gromacs/listed-forces/bonded.cpp
index 481c34ae8a75ca9e1a305112dbea8582e8b0e5fa..b1ded380a424d9dcc554099fae8883af00314e12 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+/*! \internal \file
+ *
+ * \brief This file defines functions necessary for mdrun and tools to
+ * compute energies and forces for bonded interactions.
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ *
+ * \ingroup module_listed-forces
+ */
 #include "gmxpre.h"
 
 #include "bonded.h"
@@ -46,7 +55,6 @@
 
 #include <algorithm>
 
-#include "gromacs/bonded/restcbt.h"
 #include "gromacs/legacyheaders/disre.h"
 #include "gromacs/legacyheaders/force.h"
 #include "gromacs/legacyheaders/macros.h"
@@ -67,7 +75,9 @@
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
-/* Find a better place for this? */
+#include "restcbt.h"
+
+/*! \brief Mysterious CMAP coefficient matrix */
 const int cmap_coeff_matrix[] = {
     1, 0, -3,  2, 0, 0,  0,  0, -3,  0,  9, -6,  2,  0, -6,  4,
     0, 0,  0,  0, 0, 0,  0,  0,  3,  0, -9,  6, -2,  0,  6, -4,
@@ -107,7 +117,9 @@ int glatnr(int *global_atom_index, int i)
     return atnr;
 }
 
-/* TODO This kind of code appears in many places. Consolidate it */
+/*! \brief Compute dx = xi - xj, modulo PBC if non-NULL
+ *
+ * \todo This kind of code appears in many places. Consolidate it */
 static int pbc_rvec_sub(const t_pbc *pbc, const rvec xi, const rvec xj, rvec dx)
 {
     if (pbc)
@@ -136,7 +148,7 @@ typedef struct {
     gmx_simd_real_t bxx;
 } pbc_simd_t;
 
-/* Set the SIMD pbc data from a normal t_pbc struct */
+/*! \brief Set the SIMD pbc data from a normal t_pbc struct */
 static void set_pbc_simd(const t_pbc *pbc, pbc_simd_t *pbc_simd)
 {
     rvec inv_bdiag;
@@ -176,7 +188,7 @@ static void set_pbc_simd(const t_pbc *pbc, pbc_simd_t *pbc_simd)
     }
 }
 
-/* Correct distance vector *dx,*dy,*dz for PBC using SIMD */
+/*! \brief Correct distance vector *dx,*dy,*dz for PBC using SIMD */
 static gmx_inline void
 pbc_dx_simd(gmx_simd_real_t *dx, gmx_simd_real_t *dy, gmx_simd_real_t *dz,
             const pbc_simd_t *pbc)
@@ -198,10 +210,9 @@ pbc_dx_simd(gmx_simd_real_t *dx, gmx_simd_real_t *dy, gmx_simd_real_t *dz,
 
 #endif /* GMX_SIMD_HAVE_REAL */
 
-/*
- * Morse potential bond by Frank Everdij
+/*! \brief Morse potential bond
  *
- * Three parameters needed:
+ * By Frank Everdij. Three parameters needed:
  *
  * b0 = equilibrium distance in nm
  * be = beta in nm^-1 (actually, it's nu_e*Sqrt(2*pi*pi*mu/D_e))
@@ -210,7 +221,6 @@ pbc_dx_simd(gmx_simd_real_t *dx, gmx_simd_real_t *dy, gmx_simd_real_t *dz,
  * Note: the potential is referenced to be +cb at infinite separation
  *       and zero at the equilibrium distance!
  */
-
 real morse_bonds(int nbonds,
                  const t_iatom forceatoms[], const t_iparams forceparams[],
                  const rvec x[], rvec f[], rvec fshift[],
@@ -285,6 +295,7 @@ real morse_bonds(int nbonds,
     return vtot;
 }
 
+//! \cond
 real cubic_bonds(int nbonds,
                  const t_iatom forceatoms[], const t_iparams forceparams[],
                  const rvec x[], rvec f[], rvec fshift[],
@@ -3140,7 +3151,11 @@ real rbdihs(int nbonds,
     return vtot;
 }
 
-int cmap_setup_grid_index(int ip, int grid_spacing, int *ipm1, int *ipp1, int *ipp2)
+//! \endcond
+
+/*! \brief Mysterious undocumented function */
+static int
+cmap_setup_grid_index(int ip, int grid_spacing, int *ipm1, int *ipp1, int *ipp2)
 {
     int im1, ip1, ip2;
 
@@ -3179,14 +3194,16 @@ int cmap_setup_grid_index(int ip, int grid_spacing, int *ipm1, int *ipp1, int *i
 
 }
 
-real cmap_dihs(int nbonds,
-               const t_iatom forceatoms[], const t_iparams forceparams[],
-               const gmx_cmap_t *cmap_grid,
-               const rvec x[], rvec f[], rvec fshift[],
-               const t_pbc *pbc, const t_graph *g,
-               real gmx_unused lambda, real gmx_unused *dvdlambda,
-               const t_mdatoms gmx_unused *md, t_fcdata gmx_unused *fcd,
-               int  gmx_unused *global_atom_index)
+/*! \brief Compute CMAP dihedral energies and forces */
+static real
+cmap_dihs(int nbonds,
+          const t_iatom forceatoms[], const t_iparams forceparams[],
+          const gmx_cmap_t *cmap_grid,
+          const rvec x[], rvec f[], rvec fshift[],
+          const t_pbc *pbc, const t_graph *g,
+          real gmx_unused lambda, real gmx_unused *dvdlambda,
+          const t_mdatoms gmx_unused *md, t_fcdata gmx_unused *fcd,
+          int  gmx_unused *global_atom_index)
 {
     int         i, j, k, n, idx;
     int         ai, aj, ak, al, am;
@@ -3576,7 +3593,7 @@ real cmap_dihs(int nbonds,
 }
 
 
-
+//! \cond
 /***********************************************************
  *
  *   G R O M O S  9 6   F U N C T I O N S
@@ -4143,9 +4160,10 @@ real tab_dihs(int nbonds,
     return vtot;
 }
 
-/* TODO This function could go away when idef is not a big bucket of
-   everything. */
-gmx_bool ftype_is_bonded_potential(int ftype)
+//! \endcond
+
+gmx_bool
+ftype_is_bonded_potential(int ftype)
 {
     return
         (interaction_function[ftype].flags & IF_BOND) &&
@@ -4153,6 +4171,7 @@ gmx_bool ftype_is_bonded_potential(int ftype)
         (ftype < F_GB12 || ftype > F_GB14);
 }
 
+/*! \brief Zero thread-local force-output buffers */
 static void zero_thread_forces(f_thread_t *f_t, int n,
                                int nblock, int blocksize)
 {
@@ -4200,15 +4219,16 @@ static void zero_thread_forces(f_thread_t *f_t, int n,
     }
 }
 
+/*! \brief The max thread number is arbitrary, we used a fixed number
+ * to avoid memory management.  Using more than 16 threads is probably
+ * never useful performance wise. */
+#define MAX_BONDED_THREADS 256
+
+/*! \brief Reduce thread-local force buffers */
 static void reduce_thread_force_buffer(int n, rvec *f,
                                        int nthreads, f_thread_t *f_t,
                                        int nblock, int block_size)
 {
-    /* The max thread number is arbitrary,
-     * we used a fixed number to avoid memory management.
-     * Using more than 16 threads is probably never useful performance wise.
-     */
-#define MAX_BONDED_THREADS 256
     int b;
 
     if (nthreads > MAX_BONDED_THREADS)
@@ -4253,6 +4273,7 @@ static void reduce_thread_force_buffer(int n, rvec *f,
     }
 }
 
+/*! \brief Reduce thread-local forces */
 static void reduce_thread_forces(int n, rvec *f, rvec *fshift,
                                  real *ener, gmx_grppairener_t *grpp, real *dvdl,
                                  int nthreads, f_thread_t *f_t,
@@ -4310,6 +4331,8 @@ static void reduce_thread_forces(int n, rvec *f, rvec *fshift,
     }
 }
 
+/*! \brief Calculate one element of the list of bonded interactions
+    for this thread */
 static real calc_one_bond(int thread,
                           int ftype, const t_idef *idef,
                           const rvec x[], rvec f[], rvec fshift[],
@@ -4409,7 +4432,7 @@ void calc_bonds(const gmx_multisim_t *ms,
                 const t_idef *idef,
                 const rvec x[], history_t *hist,
                 rvec f[], t_forcerec *fr,
-                const t_pbc *pbc, const t_graph *g,
+                const struct t_pbc *pbc, const struct t_graph *g,
                 gmx_enerdata_t *enerd, t_nrnb *nrnb,
                 real *lambda,
                 const t_mdatoms *md,
@@ -4541,7 +4564,7 @@ void calc_bonds(const gmx_multisim_t *ms,
 void calc_bonds_lambda(const t_idef *idef,
                        const rvec x[],
                        t_forcerec *fr,
-                       const t_pbc *pbc, const t_graph *g,
+                       const struct t_pbc *pbc, const struct t_graph *g,
                        gmx_grppairener_t *grpp, real *epot, t_nrnb *nrnb,
                        real *lambda,
                        const t_mdatoms *md,
similarity index 74%
rename from src/gromacs/bonded/bonded.h
rename to src/gromacs/listed-forces/bonded.h
index 0fdc81d9fcc7637d86c07aac40b2a5a2e558f252..b3acfd35135c58a00cfc6433fbd773bee7198b91 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+/*! \defgroup module_listed-forces Interactions between lists of particles
+ * \ingroup group_mdrun
+ *
+ * \brief Computes energies and forces for interactions between a
+ * small number of particles, e.g bonds.
+ *
+ * More functionality will move into this module shortly.
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ *
+ */
+
+/*! \file
+ *
+ * \brief
+ * This file contains function declarations necessary for mdrun and tools
+ * to compute energies and forces for bonded interactions.
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \inpublicapi
+ * \ingroup module_listed-forces
+ */
 
-#ifndef GMX_BONDED_BONDED_H
-#define GMX_BONDED_BONDED_H
+#ifndef GMX_LISTED_FORCES_BONDED_H
+#define GMX_LISTED_FORCES_BONDED_H
 
 #include <stdio.h>
 
-#include "gromacs/legacyheaders/genborn.h"
 #include "gromacs/legacyheaders/nrnb.h"
 #include "gromacs/legacyheaders/typedefs.h"
 
@@ -51,19 +72,23 @@ extern "C" {
 struct t_graph;
 struct t_pbc;
 
-int glatnr(int *global_atom_index, int i);
-/* Returns the global topology atom number belonging to local atom index i.
+/*! \brief Returns the global topology atom number belonging to local atom index i.
  * This function is intended for writing ascii output
  * and returns atom numbers starting at 1.
  * When global_atom_index=NULL returns i+1.
  */
+int glatnr(int *global_atom_index, int i);
 
-/*! \brief Return whether this is a potential calculated in
- * bonded.cpp, i.e. an interaction that actually calculates a
- * potential and works on multiple atoms (not e.g. a connection or a
- * position restraint). */
-gmx_bool ftype_is_bonded_potential(int ftype);
+/*! \brief Return whether this is an interaction that actually
+ * calculates a potential and works on multiple atoms (not e.g. a
+ * connection or a position restraint).
+ *
+ * \todo This function could go away when idef is not a big bucket of
+ * everything. */
+gmx_bool
+ftype_is_bonded_potential(int ftype);
 
+/*! \brief Calculates all bonded force interactions. */
 void calc_bonds(const gmx_multisim_t *ms,
                 const t_idef *idef,
                 const rvec x[], history_t *hist,
@@ -73,28 +98,10 @@ void calc_bonds(const gmx_multisim_t *ms,
                 const t_mdatoms *md,
                 t_fcdata *fcd, int *ddgatindex,
                 int force_flags);
-/*
- * The function calc_bonds() calculates all bonded force interactions.
- * The "bonds" are specified as follows:
- *   int nbonds
- *         the total number of bonded interactions.
- *   t_iatom *forceatoms
- *     specifies which atoms are involved in a bond of a certain
- *     type, see also struct t_idef.
- *   t_functype *functype
- *         defines for every bonded force type what type of function to
- *     use, see also struct t_idef.
- *   t_iparams *forceparams
- *         defines the parameters for every bond type, see also struct
- *     t_idef.
- *   real epot[NR_F]
- *     total potential energy split up over the function types.
- *   int *ddgatindex
- *     global atom number indices, should be NULL when not using DD.
- *   return value:
- *         the total potential energy (sum over epot).
- */
 
+/*! \brief As calc_bonds, but only determines the potential energy
+ * for the perturbed interactions.
+ * The shift forces in fr are not affected. */
 void calc_bonds_lambda(const t_idef *idef,
                        const rvec x[],
                        t_forcerec *fr,
@@ -103,48 +110,45 @@ void calc_bonds_lambda(const t_idef *idef,
                        real *lambda,
                        const t_mdatoms *md,
                        t_fcdata *fcd, int *global_atom_index);
-/* As calc_bonds, but only determines the potential energy
- * for the perturbed interactions.
- * The shift forces in fr are not affected.
- */
 
+/*! \brief Position restraints require a different pbc treatment from other bondeds */
 real posres(int nbonds,
             const t_iatom forceatoms[], const t_iparams forceparams[],
             const rvec x[], rvec f[], rvec vir_diag,
             struct t_pbc *pbc,
             real lambda, real *dvdlambda,
             int refcoord_scaling, int ePBC, rvec comA, rvec comB);
-/* Position restraints require a different pbc treatment from other bondeds */
 
+/*! \brief Flat-bottom posres. Same PBC treatment as in normal position restraints */
 real fbposres(int nbonds,
               const t_iatom forceatoms[], const t_iparams forceparams[],
               const rvec x[], rvec f[], rvec vir_diag,
               struct t_pbc *pbc, int refcoord_scaling, int ePBC, rvec com);
-/* Flat-bottom posres. Same PBC treatment as in normal position restraints */
 
+/*! \brief Calculate bond-angle. No PBC is taken into account (use mol-shift) */
 real bond_angle(const rvec xi, const rvec xj, const rvec xk,
                 const struct t_pbc *pbc,
                 rvec r_ij, rvec r_kj, real *costh,
                 int *t1, int *t2);  /* out */
-/* Calculate bond-angle. No PBC is taken into account (use mol-shift) */
 
+/*! \brief Calculate dihedral-angle. No PBC is taken into account (use mol-shift) */
 real dih_angle(const rvec xi, const rvec xj, const rvec xk, const rvec xl,
                const struct t_pbc *pbc,
                rvec r_ij, rvec r_kj, rvec r_kl, rvec m, rvec n, /* out */
                real *sign,
                int *t1, int *t2, int *t3);
-/* Calculate dihedral-angle. No PBC is taken into account (use mol-shift) */
 
+/*! \brief Do an update of the forces for dihedral potentials */
 void do_dih_fup(int i, int j, int k, int l, real ddphi,
                 rvec r_ij, rvec r_kj, rvec r_kl,
                 rvec m, rvec n, rvec f[], rvec fshift[],
                 const struct t_pbc *pbc, const struct t_graph *g,
                 const rvec *x, int t1, int t2, int t3);
-/* Do an update of the forces for dihedral potentials */
 
+/*! \brief Make a dihedral fall in the range (-pi,pi) */
 void make_dp_periodic(real *dp);
-/* make a dihedral fall in the range (-pi,pi) */
 
+//! \cond
 /*************************************************************************
  *
  *  Bonded force functions
@@ -157,7 +161,7 @@ t_ifunc pdihs, idihs, rbdihs;
 t_ifunc restrdihs, cbtdihs;
 t_ifunc tab_bonds, tab_angles, tab_dihs;
 t_ifunc polarize, anharm_polarize, water_pol, thole_pol, angres, angresz, dihres, unimplemented;
-
+//! \endcond
 
 #ifdef __cplusplus
 }
similarity index 98%
rename from src/gromacs/bonded/restcbt.cpp
rename to src/gromacs/listed-forces/restcbt.cpp
index 45b7e84c015586ac635f6b7e07f3d0244b8c23fd..795c8308a7a3d8d4caf4bf43af48da07ce6c2473 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+/*! \internal \file
+ *
+ * \brief
+ * This file contains function definitions necessary
+ * for computations of forces due to restricted angle, restricted dihedral and
+ * combined bending-torsion potentials.
+ *
+ * \author Nicolae Goga
+ *
+ * \ingroup module_listed-forces
+ */
 #include "gmxpre.h"
 
 #include "restcbt.h"
similarity index 98%
rename from src/gromacs/bonded/restcbt.h
rename to src/gromacs/listed-forces/restcbt.h
index 66a5f96fde7c6c743bace9d69262887af59908bd..0cb46da0f9c6b49761cc163422ff737171d61b85 100644 (file)
  * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-
-/*! \libinternal \file
+/*! \internal \file
  *
  *
  * \brief
  * This file contains function declarations necessary
    for computations of forces due to restricted angle, restricted dihedral and
    combined bending-torsion potentials.
-
  *
  * \author Nicolae Goga
  *
- * \inlibraryapi
+ * \ingroup module_listed-forces
  */
 
-#ifndef GMX_BONDED_RESTCBT_H
-#define GMX_BONDED_RESTCBT_H
+#ifndef GMX_LISTED_FORCES_RESTCBT_H
+#define GMX_LISTED_FORCES_RESTCBT_H
 
 #include "gromacs/legacyheaders/types/simple.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/topology/idef.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
 /*! \brief This function computes factors needed for restricted angle potentials.
  *
  * The restricted angle potential is used in coarse-grained simulations to avoid singularities
@@ -178,9 +171,4 @@ void compute_factors_cbtdihs(int type,  const t_iparams forceparams[],
                              rvec f_theta_post_aj, rvec f_theta_post_ak, rvec f_theta_post_al,
                              real * v);
 
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif
index 074193e49b589b56592c898ab724a46d35dcff54..13934d5fa68fd157027fac7fc3d4cb8b84662b6a 100644 (file)
@@ -48,7 +48,6 @@
 
 #include <algorithm>
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/fileio/gmxfio.h"
 #include "gromacs/fileio/pdbio.h"
 #include "gromacs/imd/imd.h"
@@ -70,6 +69,7 @@
 #include "gromacs/legacyheaders/pme.h"
 #include "gromacs/legacyheaders/shellfc.h"
 #include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/mdlib/nb_verlet.h"
 #include "gromacs/mdlib/nbnxn_search.h"
index a4b3f65ec1283c4204c77db6a45d06899812c6a0..f98b073fee59645acfddc2992220bea2377dd2a3 100644 (file)
@@ -44,7 +44,6 @@
 #include <math.h>
 #include <string.h>
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/legacyheaders/coulomb.h"
 #include "gromacs/legacyheaders/domdec.h"
 #include "gromacs/legacyheaders/gmx_omp_nthreads.h"
@@ -60,6 +59,7 @@
 #include "gromacs/legacyheaders/txtdump.h"
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/ishift.h"
 #include "gromacs/pbcutil/mshift.h"
@@ -298,10 +298,10 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
     /* MRS: Eventually, many need to include free energy contribution here! */
     if (ir->implicit_solvent)
     {
-        wallcycle_sub_start(wcycle, ewcsBONDED);
+        wallcycle_sub_start(wcycle, ewcsLISTED);
         calc_gb_forces(cr, md, born, top, x, f, fr, idef,
                        ir->gb_algorithm, ir->sa_algorithm, nrnb, &pbc, graph, enerd);
-        wallcycle_sub_stop(wcycle, ewcsBONDED);
+        wallcycle_sub_stop(wcycle, ewcsLISTED);
     }
 
 #ifdef GMX_MPI
@@ -341,9 +341,9 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
         pr_rvecs(debug, 0, "fshift after SR", fr->fshift, SHIFTS);
     }
 
-    /* Shift the coordinates. Must be done before bonded forces and PPPM,
+    /* Shift the coordinates. Must be done before listed forces and PPPM,
      * but is also necessary for SHAKE and update, therefore it can NOT
-     * go when no bonded forces have to be evaluated.
+     * go when no listed forces have to be evaluated.
      */
 
     /* Here sometimes we would not need to shift with NBFonly,
@@ -361,9 +361,9 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
             inc_nrnb(nrnb, eNR_SHIFTX, graph->nnodes);
         }
     }
-    /* Check whether we need to do bondeds or correct for exclusions */
+    /* Check whether we need to do listed interactions or correct for exclusions */
     if (fr->bMolPBC &&
-        ((flags & GMX_FORCE_BONDED)
+        ((flags & GMX_FORCE_LISTED)
          || EEL_RF(fr->eeltype) || EEL_FULL(fr->eeltype) || EVDW_PME(fr->vdwtype)))
     {
         /* Since all atoms are in the rectangular or triclinic unit-cell,
@@ -373,9 +373,9 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
     }
     debug_gmx();
 
-    if (flags & GMX_FORCE_BONDED)
+    if (flags & GMX_FORCE_LISTED)
     {
-        wallcycle_sub_start(wcycle, ewcsBONDED);
+        wallcycle_sub_start(wcycle, ewcsLISTED);
         calc_bonds(cr->ms,
                    idef, (const rvec *) x, hist, f, fr, &pbc, graph, enerd, nrnb, lambda, md, fcd,
                    DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL,
@@ -406,7 +406,7 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
         }
         debug_gmx();
 
-        wallcycle_sub_stop(wcycle, ewcsBONDED);
+        wallcycle_sub_stop(wcycle, ewcsLISTED);
     }
 
     where();
index c26de6a12701d0c728dd6ddf89865701c6efea14..7c31e0b7a575699d6162b3f72a8c1e81b319d867 100644 (file)
@@ -86,7 +86,7 @@ typedef struct gbtmpnbls {
     int         list_nalloc;
 } t_gbtmpnbls;
 
-/* This function is exactly the same as the one in bonded/bonded.cpp. The reason
+/* This function is exactly the same as the one in listed-forces/bonded.cpp. The reason
  * it is copied here is that the bonded gb-interactions are evaluated
  * not in calc_bonds, but rather in calc_gb_forces
  */
index 886f6acdd3b8e3b18f1d7b65e86d0a04409e24bd..e6686abd02d1ca3ea154f0670dafc479b2724554 100644 (file)
@@ -49,7 +49,6 @@
 #include <sys/time.h>
 #endif
 
-#include "gromacs/bonded/bonded.h"
 #include "gromacs/essentialdynamics/edsam.h"
 #include "gromacs/gmxlib/nonbonded/nb_free_energy.h"
 #include "gromacs/gmxlib/nonbonded/nb_kernel.h"
@@ -76,6 +75,7 @@
 #include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/legacyheaders/update.h"
 #include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/mdlib/nb_verlet.h"
@@ -1236,10 +1236,11 @@ void do_force_cutsVERLET(FILE *fplog, t_commrec *cr,
     }
 
     /* We calculate the non-bonded forces, when done on the CPU, here.
-     * We do this before calling do_force_lowlevel, as in there bondeds
-     * forces are calculated before PME, which does communication.
-     * With this order, non-bonded and bonded force calculation imbalance
-     * can be balanced out by the domain decomposition load balancing.
+     * We do this before calling do_force_lowlevel, because in that
+     * function, the listed forces are calculated before PME, which
+     * does communication.  With this order, non-bonded and listed
+     * force calculation imbalance can be balanced out by the domain
+     * decomposition load balancing.
      */
 
     if (!bUseOrEmulGPU)
@@ -1319,13 +1320,13 @@ void do_force_cutsVERLET(FILE *fplog, t_commrec *cr,
         update_QMMMrec(cr, fr, x, mdatoms, box, top);
     }
 
-    if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
+    if ((flags & GMX_FORCE_LISTED) && top->idef.il[F_POSRES].nr > 0)
     {
         posres_wrapper(flags, inputrec, nrnb, top, box, x,
                        enerd, lambda, fr);
     }
 
-    if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_FBPOSRES].nr > 0)
+    if ((flags & GMX_FORCE_LISTED) && top->idef.il[F_FBPOSRES].nr > 0)
     {
         fbposres_wrapper(inputrec, nrnb, top, box, x, enerd, fr);
     }
@@ -1868,13 +1869,13 @@ void do_force_cutsGROUP(FILE *fplog, t_commrec *cr,
         update_QMMMrec(cr, fr, x, mdatoms, box, top);
     }
 
-    if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
+    if ((flags & GMX_FORCE_LISTED) && top->idef.il[F_POSRES].nr > 0)
     {
         posres_wrapper(flags, inputrec, nrnb, top, box, x,
                        enerd, lambda, fr);
     }
 
-    if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_FBPOSRES].nr > 0)
+    if ((flags & GMX_FORCE_LISTED) && top->idef.il[F_FBPOSRES].nr > 0)
     {
         fbposres_wrapper(inputrec, nrnb, top, box, x, enerd, fr);
     }
index c6f468e3ed4bc0f89b584cd4b4769335b9c4b216..27eb275cd0e088e521f9d693ae731a6f188980c5 100644 (file)
@@ -110,7 +110,7 @@ static const char *wcsn[ewcsNR] =
     "DD redist.", "DD NS grid + sort", "DD setup comm.",
     "DD make top.", "DD make constr.", "DD top. other",
     "NS grid local", "NS grid non-loc.", "NS search local", "NS search non-loc.",
-    "Bonded F", "Nonbonded F", "Ewald F correction",
+    "Listed F", "Nonbonded F", "Ewald F correction",
     "NB X buffer ops.", "NB F buffer ops."
 };
 
index a03a0ade68cbfb70c1b231e710e1a71328e00889..104173598a16ab5270179208f1f58a793c8f9295 100644 (file)
@@ -66,7 +66,7 @@ enum {
     ewcsDD_MAKETOP, ewcsDD_MAKECONSTR, ewcsDD_TOPOTHER,
     ewcsNBS_GRID_LOCAL, ewcsNBS_GRID_NONLOCAL,
     ewcsNBS_SEARCH_LOCAL, ewcsNBS_SEARCH_NONLOCAL,
-    ewcsBONDED, ewcsNONBONDED, ewcsEWALD_CORRECTION,
+    ewcsLISTED, ewcsNONBONDED, ewcsEWALD_CORRECTION,
     ewcsNB_X_BUF_OPS, ewcsNB_F_BUF_OPS,
     ewcsNR
 };