Gromacs  2026.0-dev-20241204-d69d709
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
position_restraints.cpp File Reference
#include "gmxpre.h"
#include "position_restraints.h"
#include <cassert>
#include <cmath>
#include <array>
#include <filesystem>
#include <vector>
#include "gromacs/math/functions.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdtypes/enerdata.h"
#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+ Include dependency graph for position_restraints.cpp:

Description

This file defines low-level functions necessary for computing energies and forces for position restraints.

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

Functions

void anonymous_namespace{position_restraints.cpp}::posres_dx (const rvec x, const rvec pos0A, const rvec pos0B, const gmx::RVec &centerOfMassAScaled, const gmx::RVec &centerOfMassBScaled, real lambda, const t_pbc &pbc, RefCoordScaling refcoord_scaling, int npbcdim, rvec dx, rvec rdist, rvec dpdl)
 returns dx, rdist, and dpdl for functions posres() and fbposres()
 
real anonymous_namespace{position_restraints.cpp}::do_fbposres_cylinder (int fbdim, rvec fm, rvec dx, real rfb, real kk, gmx_bool bInvert)
 Computes forces and potential for flat-bottom cylindrical restraints. Returns the flat-bottom potential.
 
real anonymous_namespace{position_restraints.cpp}::fbposres (int nbonds, const t_iatom forceatoms[], const t_iparams forceparams[], const rvec x[], rvec4 *forces, gmx::RVec *virial, const t_pbc &pbc, RefCoordScaling refcoord_scaling, PbcType pbcType, const gmx::ArrayRef< const gmx::RVec > centersOfMass, const gmx::ArrayRef< const unsigned short > refScaleComIndices, gmx::ArrayRef< gmx::RVec > centersOfMassScaled)
 Compute energies and forces for flat-bottomed position restraints. More...
 
template<bool computeForce>
real anonymous_namespace{position_restraints.cpp}::posres (int nbonds, const t_iatom forceatoms[], const t_iparams forceparams[], const rvec x[], rvec4 *forces, gmx::RVec *virial, const struct t_pbc &pbc, real lambda, real *dvdlambda, RefCoordScaling refcoord_scaling, const gmx::ArrayRef< const gmx::RVec > centersOfMassA, const gmx::ArrayRef< const gmx::RVec > centersOfMassB, const gmx::ArrayRef< const unsigned short > refScaleComIndices, gmx::ArrayRef< gmx::RVec > centersOfMassAScaled, gmx::ArrayRef< gmx::RVec > centersOfMassBScaled)
 Compute energies and forces, when requested, for position restraints. More...
 
real posres_wrapper (gmx::ArrayRef< const int > iatoms, gmx::ArrayRef< const t_iparams > iparamsPosres, const t_pbc &pbc, const rvec *x, gmx::ArrayRef< const real > lambda, const t_forcerec *fr, const gmx::ArrayRef< const unsigned short > refScaleComIndices, gmx::ArrayRef< gmx::RVec > centersOfMassScaledBuffer, gmx::ArrayRef< gmx::RVec > centersOfMassBScaledBuffer, gmx::ArrayRef< rvec4 > forces, gmx::RVec *virial, real *dvdl)
 Helper function that wraps calls to posres. More...
 
void posres_wrapper_lambda (struct gmx_wallcycle *wcycle, const InteractionDefinitions &idef, const t_pbc &pbc, const rvec x[], gmx_enerdata_t *enerd, gmx::ArrayRef< const real > lambda, const t_forcerec *fr, const gmx::ArrayRef< const unsigned short > refScaleComIndices, gmx::ArrayRef< gmx::RVec > centersOfMassScaledBuffer, gmx::ArrayRef< gmx::RVec > centersOfMassBScaledBuffer)
 Helper function that wraps calls to posres for free-energy pertubation.
 
real fbposres_wrapper (gmx::ArrayRef< const int > iatoms, gmx::ArrayRef< const t_iparams > iparamsFBPosres, const t_pbc &pbc, const rvec *x, const t_forcerec *fr, const gmx::ArrayRef< const unsigned short > refScaleComIndices, gmx::ArrayRef< gmx::RVec > centersOfMassScaledBuffer, gmx::ArrayRef< rvec4 > forces, gmx::RVec *virial)
 Helper function that wraps calls to fbposres for free-energy perturbation. More...
 

Function Documentation

real fbposres_wrapper ( gmx::ArrayRef< const int >  iatoms,
gmx::ArrayRef< const t_iparams iparamsFBPosres,
const t_pbc pbc,
const rvec x,
const t_forcerec *  fr,
const gmx::ArrayRef< const unsigned short >  refScaleComIndices,
gmx::ArrayRef< gmx::RVec centersOfMassScaledBuffer,
gmx::ArrayRef< rvec4 >  forces,
gmx::RVec virial 
)

Helper function that wraps calls to fbposres for free-energy perturbation.

Returns
the potential
real posres_wrapper ( gmx::ArrayRef< const int >  iatoms,
gmx::ArrayRef< const t_iparams iparamsPosres,
const t_pbc pbc,
const rvec x,
gmx::ArrayRef< const real lambda,
const t_forcerec *  fr,
const gmx::ArrayRef< const unsigned short >  refScaleComIndices,
gmx::ArrayRef< gmx::RVec centersOfMassScaledBuffer,
gmx::ArrayRef< gmx::RVec centersOfMassBScaledBuffer,
gmx::ArrayRef< rvec4 >  forces,
gmx::RVec virial,
real dvdl 
)

Helper function that wraps calls to posres.

Returns
the potential