Gromacs  2022.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Typedefs | Functions | Variables
#include "gmxpre.h"
#include "bonded.h"
#include "config.h"
#include <cassert>
#include <cmath>
#include <algorithm>
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/listed_forces/disre.h"
#include "gromacs/listed_forces/orires.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdtypes/fcdata.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pbcutil/pbc_simd.h"
#include "gromacs/simd/simd.h"
#include "gromacs/simd/simd_math.h"
#include "gromacs/simd/vector_operations.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/real.h"
#include "gromacs/utility/smalloc.h"
#include "listed_internal.h"
#include "restcbt.h"
+ Include dependency graph for bonded.cpp:

Description

This file defines low-level functions necessary for computing energies and forces for listed interactions.

Author
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Typedefs

using anonymous_namespace{bonded.cpp}::BondedFunction = real(*)(int nbonds, const t_iatom iatoms[], const t_iparams iparams[], const rvec x[], rvec4 f[], rvec fshift[], const t_pbc *pbc, real lambda, real *dvdlambda, gmx::ArrayRef< const real > charge, t_fcdata *fcd, t_disresdata *disresdata, t_oriresdata *oriresdata, int *ddgatindex)
 Type of CPU function to compute a bonded interaction.
 
using anonymous_namespace{bonded.cpp}::CmapForceStructure = std::array< real, 4 >
 

Functions

int anonymous_namespace{bonded.cpp}::pbc_rvec_sub (const t_pbc *pbc, const rvec xi, const rvec xj, rvec dx)
 Compute dx = xi - xj, modulo PBC if non-NULL. More...
 
void make_dp_periodic (real *dp)
 Make a dihedral fall in the range (-pi,pi)
 
template<BondedKernelFlavor flavor>
void anonymous_namespace{bonded.cpp}::spreadBondForces (const real bondForce, const rvec dx, const int ai, const int aj, rvec4 *f, int shiftIndex, rvec *fshift)
 Spreads and accumulates the bonded forces to the two atoms and adds the virial contribution when needed. More...
 
template<BondedKernelFlavor flavor>
real anonymous_namespace{bonded.cpp}::morse_bonds (int nbonds, const t_iatom forceatoms[], const t_iparams forceparams[], const rvec x[], rvec4 f[], rvec fshift[], const t_pbc *pbc, real lambda, real *dvdlambda, gmx::ArrayRef< const real >, t_fcdata gmx_unused *fcd, t_disresdata gmx_unused *disresdata, t_oriresdata gmx_unused *oriresdata, int gmx_unused *global_atom_index)
 Morse potential bond. More...
 
int anonymous_namespace{bonded.cpp}::cmap_setup_grid_index (int ip, int grid_spacing, int *ipm1, int *ipp1, int *ipp2)
 Mysterious undocumented function.
 
gmx::RVec anonymous_namespace{bonded.cpp}::processCmapForceComponent (const gmx::RVec a, const gmx::RVec b, const real df, const real gaa, const real fga, const real gbb, const real hgb, const int dim)
 
CmapForceStructure anonymous_namespace{bonded.cpp}::applyCmapForceComponent (const gmx::RVec forceComponent)
 
void anonymous_namespace{bonded.cpp}::accumulateCmapForces (const rvec x[], rvec4 f[], rvec fshift[], const t_pbc *pbc, const gmx::RVec r_ij, const gmx::RVec r_kj, const gmx::RVec r_kl, const gmx::RVec a, const gmx::RVec b, gmx::RVec h, const real ra2r, const real rb2r, const real rgr, const real rg, const int ai, const int aj, const int ak, const int al, const real df, const int t1, const int t2)
 
real cmap_dihs (int nbonds, const t_iatom forceatoms[], const t_iparams forceparams[], const gmx_cmap_t *cmap_grid, const rvec x[], rvec4 f[], rvec fshift[], const struct t_pbc *pbc, real gmx_unused lambda, real gmx_unused *dvdlambda, gmx::ArrayRef< const real >, t_fcdata gmx_unused *fcd, t_disresdata gmx_unused *disresdata, t_oriresdata gmx_unused *oriresdata, int gmx_unused *global_atom_index)
 Compute CMAP dihedral energies and forces.
 
real calculateSimpleBond (const int ftype, const int numForceatoms, const t_iatom forceatoms[], const t_iparams forceparams[], const rvec x[], rvec4 f[], rvec fshift[], const struct t_pbc *pbc, const real lambda, real *dvdlambda, gmx::ArrayRef< const real > charge, t_fcdata *fcd, t_disresdata *disresdata, t_oriresdata *oriresdata, int gmx_unused *global_atom_index, const BondedKernelFlavor bondedKernelFlavor)
 Calculates bonded interactions for simple bonded types. More...
 
int nrnbIndex (int ftype)
 Getter for finding the flop count for an ftype interaction.
 

Variables

const EnumerationArray
< BondedKernelFlavor,
std::string > 
c_bondedKernelFlavorStrings
 Helper strings for human-readable messages. More...
 
const int anonymous_namespace{bonded.cpp}::cmap_coeff_matrix []
 Mysterious CMAP coefficient matrix. More...
 

Function Documentation

real calculateSimpleBond ( int  ftype,
int  numForceatoms,
const t_iatom  forceatoms[],
const t_iparams  forceparams[],
const rvec  x[],
rvec4  f[],
rvec  fshift[],
const struct t_pbc pbc,
real  lambda,
real dvdlambda,
gmx::ArrayRef< const real charge,
t_fcdata *  fcd,
t_disresdata *  disresdata,
t_oriresdata oriresdata,
int gmx_unused global_atom_index,
BondedKernelFlavor  bondedKernelFlavor 
)

Calculates bonded interactions for simple bonded types.

Exits with an error when the bonded type is not simple All pointers should be non-null, except for pbc and g which can be nullptr.

Returns
the energy or 0 when bondedKernelFlavor did not request the energy.

Variable Documentation

const EnumerationArray<BondedKernelFlavor, std::string> c_bondedKernelFlavorStrings
Initial value:
= {
"forces, using SIMD when available",
"forces, not using SIMD",
"forces, virial, and energy (ie. not using SIMD)",
"forces and energy (ie. not using SIMD)"
}

Helper strings for human-readable messages.