Gromacs  2026.0-dev-20241204-d69d709
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
listed_forces.cpp File Reference
#include "gmxpre.h"
#include "listed_forces.h"
#include <algorithm>
#include <array>
#include <filesystem>
#include <iterator>
#include <numeric>
#include <string>
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/listed_forces/bonded.h"
#include "gromacs/listed_forces/disre.h"
#include "gromacs/listed_forces/orires.h"
#include "gromacs/listed_forces/pairs.h"
#include "gromacs/listed_forces/position_restraints.h"
#include "gromacs/math/arrayrefwithpadding.h"
#include "gromacs/mdlib/enerdata_utils.h"
#include "gromacs/mdlib/force.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/fcdata.h"
#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/mdtypes/threaded_force_buffer.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "listed_internal.h"
#include "manage_threading.h"
#include "utilities.h"
+ Include dependency graph for listed_forces.cpp:

Description

This file defines high-level functions for mdrun to compute 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

Functions

static void selectInteractions (InteractionDefinitions *idef, const InteractionDefinitions &idefSrc, const ListedForces::InteractionSelection &interactionSelection)
 Copies the selection interactions from idefSrc to idef.
 
bool anonymous_namespace{listed_forces.cpp}::isPairInteraction (int ftype)
 Return true if ftype is an explicit pair-listed LJ or COULOMB interaction type: bonded LJ (usually 1-4), or special listed non-bonded for FEP.
 
BondedKernelFlavor anonymous_namespace{listed_forces.cpp}::selectBondedKernelFlavor (const gmx::StepWorkload &stepWork, const bool useSimdKernels, const bool havePerturbedInteractions)
 Returns the bonded kernel flavor. More...
 
real anonymous_namespace{listed_forces.cpp}::calc_one_bond (int thread, int ftype, const InteractionDefinitions &idef, ArrayRef< const int > iatoms, const int numNonperturbedInteractions, const WorkDivision &workDivision, const rvec x[], rvec4 f[], rvec fshift[], const t_forcerec *fr, const t_pbc *pbc, gmx_grppairener_t *grpp, t_nrnb *nrnb, gmx::ArrayRef< const real > lambda, gmx::ArrayRef< real > dvdl, gmx::ArrayRef< const real > chargeA, gmx::ArrayRef< const real > chargeB, gmx::ArrayRef< const bool > atomIsPerturbed, gmx::ArrayRef< const unsigned short > cENER, const int numEnergyGroups, t_fcdata *fcd, const gmx::StepWorkload &stepWork, int *global_atom_index)
 Calculate one element of the list of bonded interactions for this thread.
 
static void calcPositionRestraintForces (const InteractionDefinitions &idef, bonded_threading_t *bt, const bool needToClearThreadForceBuffers, const rvec x[], const t_pbc &pbc, const t_forcerec *fr, const gmx::ArrayRef< const unsigned short > refScaleComIndices, gmx::ArrayRef< gmx::RVec > centersOfMassScaledBuffer, gmx::ArrayRef< gmx::RVec > centersOfMassBScaledBuffer, gmx::RVec *virial, gmx_enerdata_t *enerd, t_nrnb *nrnb, gmx::ArrayRef< const real > lambda, gmx::ArrayRef< real > dvdl)
 Computes the position restraint forces, uses OpenMP parallelization.
 
static void calcBondedForces (const InteractionDefinitions &idef, bonded_threading_t *bt, const bool needToClearThreadForceBuffers, const rvec x[], const t_forcerec *fr, const t_pbc *pbc_null, rvec *fshiftMainBuffer, gmx_enerdata_t *enerd, t_nrnb *nrnb, gmx::ArrayRef< const real > lambda, gmx::ArrayRef< real > dvdl, gmx::ArrayRef< const real > chargeA, gmx::ArrayRef< const real > chargeB, gmx::ArrayRef< const bool > atomIsPerturbed, gmx::ArrayRef< const unsigned short > cENER, const int numEnergyGroups, t_fcdata *fcd, const gmx::StepWorkload &stepWork, int *global_atom_index)
 Compute the bonded part of the listed forces, parallelized over threads.
 
void anonymous_namespace{listed_forces.cpp}::calc_listed (struct gmx_wallcycle *wcycle, const InteractionDefinitions &idef, bonded_threading_t *bt, const bool needToClearThreadForceBuffers, const rvec x[], gmx::ForceOutputs *forceOutputs, const t_forcerec *fr, const t_pbc *pbc, gmx_enerdata_t *enerd, t_nrnb *nrnb, gmx::ArrayRef< const real > lambda, gmx::ArrayRef< const real > chargeA, gmx::ArrayRef< const real > chargeB, gmx::ArrayRef< const bool > atomIsPerturbed, gmx::ArrayRef< const unsigned short > cENER, const int numEnergyGroups, t_fcdata *fcd, int *global_atom_index, const gmx::StepWorkload &stepWork)
 Calculates all listed force interactions.
 
void anonymous_namespace{listed_forces.cpp}::calc_listed_lambda (const InteractionDefinitions &idef, bonded_threading_t *bt, const rvec x[], const t_forcerec *fr, const struct t_pbc *pbc, gmx::ArrayRef< real > forceBufferLambda, gmx::ArrayRef< gmx::RVec > shiftForceBufferLambda, gmx_grppairener_t *grpp, gmx::ArrayRef< real > epot, gmx::ArrayRef< real > dvdl, t_nrnb *nrnb, gmx::ArrayRef< const real > lambda, gmx::ArrayRef< const real > chargeA, gmx::ArrayRef< const real > chargeB, gmx::ArrayRef< const bool > atomIsPerturbed, gmx::ArrayRef< const unsigned short > cENER, int nPerturbed, t_fcdata *fcd, int *global_atom_index)
 As calc_listed(), but only determines the potential energy for the perturbed interactions. More...