From: Mark Abraham Date: Sun, 14 Sep 2014 15:39:30 +0000 (+0200) Subject: Renamed bonded module as 'listed-forces' X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?p=alexxy%2Fgromacs.git;a=commitdiff_plain;h=adf34bb699c6173d16c5af33c182b011fe805d38 Renamed bonded module as 'listed-forces' 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 --- diff --git a/cmake/gmxGCC44O3BugWorkaround.cmake b/cmake/gmxGCC44O3BugWorkaround.cmake index 6c43ba2a95..a71d88f99b 100644 --- a/cmake/gmxGCC44O3BugWorkaround.cmake +++ b/cmake/gmxGCC44O3BugWorkaround.cmake @@ -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. diff --git a/docs/manual/install.tex b/docs/manual/install.tex index 5386ba5901..d80a987e1d 100644 --- a/docs/manual/install.tex +++ b/docs/manual/install.tex @@ -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. diff --git a/src/gromacs/CMakeLists.txt b/src/gromacs/CMakeLists.txt index 912789403d..56022c0987 100644 --- a/src/gromacs/CMakeLists.txt +++ b/src/gromacs/CMakeLists.txt @@ -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() diff --git a/src/gromacs/gmxana/anadih.c b/src/gromacs/gmxana/anadih.c index c967c601c8..cc2fef9873 100644 --- a/src/gromacs/gmxana/anadih.c +++ b/src/gromacs/gmxana/anadih.c @@ -40,7 +40,6 @@ #include #include -#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" diff --git a/src/gromacs/gmxana/gmx_dipoles.cpp b/src/gromacs/gmxana/gmx_dipoles.cpp index b930a6115e..b0f4c12451 100644 --- a/src/gromacs/gmxana/gmx_dipoles.cpp +++ b/src/gromacs/gmxana/gmx_dipoles.cpp @@ -41,7 +41,6 @@ #include -#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" diff --git a/src/gromacs/gmxana/hxprops.c b/src/gromacs/gmxana/hxprops.c index 57acd55c76..5b1f6c7074 100644 --- a/src/gromacs/gmxana/hxprops.c +++ b/src/gromacs/gmxana/hxprops.c @@ -41,9 +41,9 @@ #include #include -#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" diff --git a/src/gromacs/gmxana/nrama.c b/src/gromacs/gmxana/nrama.c index 0c34aeeca7..5c40c67559 100644 --- a/src/gromacs/gmxana/nrama.c +++ b/src/gromacs/gmxana/nrama.c @@ -41,7 +41,7 @@ #include #include -#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" diff --git a/src/gromacs/gmxlib/bonded-threading.cpp b/src/gromacs/gmxlib/bonded-threading.cpp index 4a69359523..cf9ab16c10 100644 --- a/src/gromacs/gmxlib/bonded-threading.cpp +++ b/src/gromacs/gmxlib/bonded-threading.cpp @@ -42,7 +42,7 @@ #include -#include "gromacs/bonded/bonded.h" +#include "gromacs/listed-forces/bonded.h" #include "gromacs/utility/fatalerror.h" #include "gromacs/utility/smalloc.h" diff --git a/src/gromacs/gmxlib/gmx_omp_nthreads.c b/src/gromacs/gmxlib/gmx_omp_nthreads.c index e9a415c403..8e61aa4b41 100644 --- a/src/gromacs/gmxlib/gmx_omp_nthreads.c +++ b/src/gromacs/gmxlib/gmx_omp_nthreads.c @@ -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" diff --git a/src/gromacs/gmxlib/ifunc.c b/src/gromacs/gmxlib/ifunc.c index 5a649c0bb0..e7e42f6644 100644 --- a/src/gromacs/gmxlib/ifunc.c +++ b/src/gromacs/gmxlib/ifunc.c @@ -37,11 +37,11 @@ /* 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)} diff --git a/src/gromacs/gmxlib/nonbonded/nonbonded.c b/src/gromacs/gmxlib/nonbonded/nonbonded.c index 7bcf2a66b1..c21e3201b2 100644 --- a/src/gromacs/gmxlib/nonbonded/nonbonded.c +++ b/src/gromacs/gmxlib/nonbonded/nonbonded.c @@ -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" diff --git a/src/gromacs/gmxpreprocess/x2top.c b/src/gromacs/gmxpreprocess/x2top.c index 1dacc45c63..b7b3f7235f 100644 --- a/src/gromacs/gmxpreprocess/x2top.c +++ b/src/gromacs/gmxpreprocess/x2top.c @@ -40,7 +40,6 @@ #include -#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" diff --git a/src/gromacs/legacyheaders/types/force_flags.h b/src/gromacs/legacyheaders/types/force_flags.h index 51c9382fa5..b8fd1743cb 100644 --- a/src/gromacs/legacyheaders/types/force_flags.h +++ b/src/gromacs/legacyheaders/types/force_flags.h @@ -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 diff --git a/src/gromacs/bonded/CMakeLists.txt b/src/gromacs/listed-forces/CMakeLists.txt similarity index 88% rename from src/gromacs/bonded/CMakeLists.txt rename to src/gromacs/listed-forces/CMakeLists.txt index 1542ee9c6e..721f4fbde2 100644 --- a/src/gromacs/bonded/CMakeLists.txt +++ b/src/gromacs/listed-forces/CMakeLists.txt @@ -32,13 +32,13 @@ # 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) diff --git a/src/gromacs/bonded/bonded.cpp b/src/gromacs/listed-forces/bonded.cpp similarity index 98% rename from src/gromacs/bonded/bonded.cpp rename to src/gromacs/listed-forces/bonded.cpp index 481c34ae8a..b1ded380a4 100644 --- a/src/gromacs/bonded/bonded.cpp +++ b/src/gromacs/listed-forces/bonded.cpp @@ -34,6 +34,15 @@ * 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 + * + * \ingroup module_listed-forces + */ #include "gmxpre.h" #include "bonded.h" @@ -46,7 +55,6 @@ #include -#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, diff --git a/src/gromacs/bonded/bonded.h b/src/gromacs/listed-forces/bonded.h similarity index 74% rename from src/gromacs/bonded/bonded.h rename to src/gromacs/listed-forces/bonded.h index 0fdc81d9fc..b3acfd3513 100644 --- a/src/gromacs/bonded/bonded.h +++ b/src/gromacs/listed-forces/bonded.h @@ -34,13 +34,34 @@ * 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 + * + */ + +/*! \file + * + * \brief + * This file contains function declarations necessary for mdrun and tools + * to compute energies and forces for bonded interactions. + * + * \author Mark Abraham + * \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 -#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 } diff --git a/src/gromacs/bonded/restcbt.cpp b/src/gromacs/listed-forces/restcbt.cpp similarity index 98% rename from src/gromacs/bonded/restcbt.cpp rename to src/gromacs/listed-forces/restcbt.cpp index 45b7e84c01..795c8308a7 100644 --- a/src/gromacs/bonded/restcbt.cpp +++ b/src/gromacs/listed-forces/restcbt.cpp @@ -32,6 +32,17 @@ * 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" diff --git a/src/gromacs/bonded/restcbt.h b/src/gromacs/listed-forces/restcbt.h similarity index 98% rename from src/gromacs/bonded/restcbt.h rename to src/gromacs/listed-forces/restcbt.h index 66a5f96fde..0cb46da0f9 100644 --- a/src/gromacs/bonded/restcbt.h +++ b/src/gromacs/listed-forces/restcbt.h @@ -33,33 +33,26 @@ * 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 diff --git a/src/gromacs/mdlib/domdec.cpp b/src/gromacs/mdlib/domdec.cpp index 074193e49b..13934d5fa6 100644 --- a/src/gromacs/mdlib/domdec.cpp +++ b/src/gromacs/mdlib/domdec.cpp @@ -48,7 +48,6 @@ #include -#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" diff --git a/src/gromacs/mdlib/force.c b/src/gromacs/mdlib/force.c index a4b3f65ec1..f98b073fee 100644 --- a/src/gromacs/mdlib/force.c +++ b/src/gromacs/mdlib/force.c @@ -44,7 +44,6 @@ #include #include -#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(); diff --git a/src/gromacs/mdlib/genborn.c b/src/gromacs/mdlib/genborn.c index c26de6a127..7c31e0b7a5 100644 --- a/src/gromacs/mdlib/genborn.c +++ b/src/gromacs/mdlib/genborn.c @@ -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 */ diff --git a/src/gromacs/mdlib/sim_util.c b/src/gromacs/mdlib/sim_util.c index 886f6acdd3..e6686abd02 100644 --- a/src/gromacs/mdlib/sim_util.c +++ b/src/gromacs/mdlib/sim_util.c @@ -49,7 +49,6 @@ #include #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); } diff --git a/src/gromacs/timing/wallcycle.c b/src/gromacs/timing/wallcycle.c index c6f468e3ed..27eb275cd0 100644 --- a/src/gromacs/timing/wallcycle.c +++ b/src/gromacs/timing/wallcycle.c @@ -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." }; diff --git a/src/gromacs/timing/wallcycle.h b/src/gromacs/timing/wallcycle.h index a03a0ade68..104173598a 100644 --- a/src/gromacs/timing/wallcycle.h +++ b/src/gromacs/timing/wallcycle.h @@ -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 };