Gromacs  2026.0-dev-20241212-74b8831
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
constr.cpp File Reference
#include "gmxpre.h"
#include "constr.h"
#include <cassert>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <filesystem>
#include <string>
#include <utility>
#include "gromacs/domdec/domdec.h"
#include "gromacs/domdec/domdec_struct.h"
#include "gromacs/essentialdynamics/edsam.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/pdbio.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/math/arrayrefwithpadding.h"
#include "gromacs/math/paddedvector.h"
#include "gromacs/math/utilities.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/lincs.h"
#include "gromacs/mdlib/settle.h"
#include "gromacs/mdlib/shake.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pulling/pull.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/topology/forcefieldparameters.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/mtop_lookup.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
#include "gromacs/topology/topology_enums.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/pleasecite.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/txtdump.h"
+ Include dependency graph for constr.cpp:

Description

Defines the high-level constraint code.

Author
Berk Hess hess@.nosp@m.kth..nosp@m.se
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Functions

static void gmx::clear_constraint_quantity_nonlocal (const gmx_domdec_t &dd, ArrayRef< RVec > q)
 Clears constraint quantities for atoms in nonlocal region.
 
void gmx::too_many_constraint_warnings (ConstraintAlgorithm eConstrAlg, int warncount)
 Generate a fatal error because of too many LINCS/SETTLE warnings.
 
static void gmx::write_constr_pdb (const char *fn, const char *title, const gmx_mtop_t &mtop, int start, int homenr, const t_commrec *cr, ArrayRef< const RVec > x, const matrix box)
 Writes out coordinates.
 
static void gmx::dump_confs (FILE *log, int64_t step, const gmx_mtop_t &mtop, int start, int homenr, const t_commrec *cr, ArrayRef< const RVec > x, ArrayRef< const RVec > xprime, const matrix box)
 Writes out domain contents to help diagnose crashes.
 
FlexibleConstraintTreatment gmx::flexibleConstraintTreatment (bool haveDynamicsIntegrator)
 Returns the flexible constraint treatment depending on whether the integrator is dynamic.
 
static ListOfLists< int > gmx::makeAtomsToConstraintsList (int numAtoms, ArrayRef< const InteractionList > ilists, ArrayRef< const t_iparams > iparams, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns a block struct to go from atoms to constraints. More...
 
ListOfLists< int > gmx::make_at2con (int numAtoms, ArrayRef< const InteractionList > ilist, ArrayRef< const t_iparams > iparams, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns a ListOfLists object to go from atoms to constraints. More...
 
ListOfLists< int > gmx::make_at2con (const gmx_moltype_t &moltype, gmx::ArrayRef< const t_iparams > iparams, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns a ListOfLists object to go from atoms to constraints. More...
 
int gmx::countFlexibleConstraints (ArrayRef< const InteractionList > ilist, ArrayRef< const t_iparams > iparams)
 Return the number of flexible constraints in the ilist and iparams.
 
static std::vector< int > gmx::make_at2settle (int natoms, const InteractionList &ilist)
 Returns the index of the settle to which each atom belongs.
 
static std::vector
< ListOfLists< int > > 
gmx::makeAtomToConstraintMappings (const gmx_mtop_t &mtop, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Makes a per-moleculetype container of mappings from atom indices to constraint indices. More...
 
bool gmx::hasTriangleConstraints (const gmx_mtop_t &mtop, FlexibleConstraintTreatment flexibleConstraintTreatment)
 Returns True if there is at least one triangular constraint.
 
void gmx::do_constrain_first (FILE *log, gmx::Constraints *constr, const t_inputrec &inputrec, int numHomeAtoms, ArrayRefWithPadding< RVec > x, ArrayRefWithPadding< RVec > v, const matrix box, real lambda)
 Constrain the initial coordinates and velocities.
 
void gmx::constrain_velocities (gmx::Constraints *constr, bool computeRmsd, int64_t step, t_state *state, real *dhdlambda, bool computeVirial, tensor constraintsVirial)
 Constrain the velocities only. More...
 
void gmx::constrain_coordinates (gmx::Constraints *constr, bool computeRmsd, int64_t step, t_state *state, ArrayRefWithPadding< RVec > xp, real *dhdlambda, bool computeVirial, tensor constraintsVirial)
 Constrain the coordinates. More...