Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
lincs.cpp File Reference
#include "gmxpre.h"
#include "lincs.h"
#include "config.h"
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include "gromacs/domdec/domdec.h"
#include "gromacs/domdec/domdec_struct.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/paddedvector.h"
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdrunutility/multisim.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/mdatom.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/topology/block.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/utility/alignedallocator.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/bitmask.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxomp.h"
#include "gromacs/utility/pleasecite.h"
+ Include dependency graph for lincs.cpp:

Description

Defines LINCS 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

Classes

struct  gmx::AtomPair
 Indices of the two atoms involved in a single constraint. More...
 
struct  gmx::Task
 Unit of work within LINCS. More...
 
class  gmx::Lincs
 Data for LINCS algorithm. More...
 
struct  gmx::LincsDeviations
 Status information about how well LINCS satisified the constraints in this domain. More...
 

Functions

ArrayRef< realgmx::lincs_rmsdData (Lincs *lincsd)
 Return the data for determining constraint RMS relative deviations.
 
real gmx::lincs_rmsd (const Lincs *lincsd)
 Return the RMSD of the constraint.
 
static void gmx::lincs_matrix_expand (const Lincs &lincsd, const Task &li_task, gmx::ArrayRef< const real > blcc, gmx::ArrayRef< real > rhs1, gmx::ArrayRef< real > rhs2, gmx::ArrayRef< real > sol)
 Do a set of nrec LINCS matrix multiplications. More...
 
static void gmx::lincs_update_atoms_noind (int ncons, gmx::ArrayRef< const AtomPair > atoms, real preFactor, gmx::ArrayRef< const real > fac, gmx::ArrayRef< const gmx::RVec > r, const real *invmass, rvec *x)
 Update atomic coordinates when an index is not required.
 
static void gmx::lincs_update_atoms_ind (gmx::ArrayRef< const int > ind, gmx::ArrayRef< const AtomPair > atoms, real preFactor, gmx::ArrayRef< const real > fac, gmx::ArrayRef< const gmx::RVec > r, const real *invmass, rvec *x)
 Update atomic coordinates when an index is required.
 
static void gmx::lincs_update_atoms (Lincs *li, int th, real preFactor, gmx::ArrayRef< const real > fac, gmx::ArrayRef< const gmx::RVec > r, const real *invmass, rvec *x)
 Update coordinates for atoms.
 
template<int align>
static void gmx_simdcall gmx::gatherLoadUTransposeTSANSafe (const real *base, const std::int32_t *offset, SimdReal *v0, SimdReal *v1, SimdReal *v2)
 Helper function so that we can run TSAN with SIMD support (where implemented).
 
static void gmx_simdcall gmx::calc_dr_x_f_simd (int b0, int b1, gmx::ArrayRef< const AtomPair > atoms, const rvec *__restrict x, const rvec *__restrict f, const real *__restrict blc, const real *pbc_simd, rvec *__restrict r, real *__restrict rhs, real *__restrict sol)
 Calculate the constraint distance vectors r to project on from x. More...
 
static void gmx::do_lincsp (const rvec *x, rvec *f, rvec *fp, t_pbc *pbc, Lincs *lincsd, int th, real *invmass, ConstraintVariable econq, bool bCalcDHDL, bool bCalcVir, tensor rmdf)
 LINCS projection, works on derivatives of the coordinates.
 
static void gmx_simdcall gmx::calc_dr_x_xp_simd (int b0, int b1, gmx::ArrayRef< const AtomPair > atoms, const rvec *__restrict x, const rvec *__restrict xp, const real *__restrict bllen, const real *__restrict blc, const real *pbc_simd, rvec *__restrict r, real *__restrict rhs, real *__restrict sol)
 Calculate the constraint distance vectors r to project on from x. More...
 
static void gmx::calc_dist_iter (int b0, int b1, gmx::ArrayRef< const AtomPair > atoms, const rvec *__restrict xp, const real *__restrict bllen, const real *__restrict blc, const t_pbc *pbc, real wfac, real *__restrict rhs, real *__restrict sol, bool *bWarn)
 Determine the distances and right-hand side for the next iteration.
 
static void gmx_simdcall gmx::calc_dist_iter_simd (int b0, int b1, gmx::ArrayRef< const AtomPair > atoms, const rvec *__restrict x, const real *__restrict bllen, const real *__restrict blc, const real *pbc_simd, real wfac, real *__restrict rhs, real *__restrict sol, bool *bWarn)
 As calc_dist_iter(), but using SIMD intrinsics.
 
static void gmx::do_lincs (const rvec *x, rvec *xp, const matrix box, t_pbc *pbc, Lincs *lincsd, int th, const real *invmass, const t_commrec *cr, bool bCalcDHDL, real wangle, bool *bWarn, real invdt, rvec *__restrict v, bool bCalcVir, tensor vir_r_m_dr)
 Implements LINCS constraining.
 
static void gmx::set_lincs_matrix_task (Lincs *li, Task *li_task, const real *invmass, int *ncc_triangle, int *nCrossTaskTriangles)
 Sets the elements in the LINCS matrix for task task.
 
static void gmx::set_lincs_matrix (Lincs *li, real *invmass, real lambda)
 Sets the elements in the LINCS matrix.
 
static int gmx::count_triangle_constraints (const InteractionLists &ilist, const t_blocka &at2con)
 Finds all triangles of atoms that share constraints to a central atom.
 
static bool gmx::more_than_two_sequential_constraints (const InteractionLists &ilist, const t_blocka &at2con)
 Finds sequences of sequential constraints.
 
Lincsgmx::init_lincs (FILE *fplog, const gmx_mtop_t &mtop, int nflexcon_global, ArrayRef< const t_blocka > at2con, bool bPLINCS, int nIter, int nProjOrder)
 Initializes and returns the lincs data struct.
 
void gmx::done_lincs (Lincs *li)
 Destructs the lincs object when it is not nullptr.
 
static void gmx::lincs_thread_setup (Lincs *li, int natoms)
 Sets up the work division over the threads.
 
static void gmx::assign_constraint (Lincs *li, int constraint_index, int a1, int a2, real lenA, real lenB, const t_blocka *at2con)
 Assign a constraint.
 
static void gmx::check_assign_connected (Lincs *li, const t_iatom *iatom, const t_idef &idef, bool bDynamics, int a1, int a2, const t_blocka *at2con)
 Check if constraint with topology index constraint_index is connected to other constraints, and if so add those connected constraints to our task.
 
static void gmx::check_assign_triangle (Lincs *li, const t_iatom *iatom, const t_idef &idef, bool bDynamics, int constraint_index, int a1, int a2, const t_blocka *at2con)
 Check if constraint with topology index constraint_index is involved in a constraint triangle, and if so add the other two constraints in the triangle to our task.
 
static void gmx::set_matrix_indices (Lincs *li, const Task &li_task, const t_blocka *at2con, bool bSortMatrix)
 Sets matrix indices.
 
void gmx::set_lincs (const t_idef &idef, const t_mdatoms &md, bool bDynamics, const t_commrec *cr, Lincs *li)
 Initialize lincs stuff.
 
static void gmx::lincs_warning (gmx_domdec_t *dd, const rvec *x, rvec *xprime, t_pbc *pbc, int ncons, gmx::ArrayRef< const AtomPair > atoms, gmx::ArrayRef< const real > bllen, real wangle, int maxwarn, int *warncount)
 Issues a warning when LINCS constraints cannot be satisfied.
 
static LincsDeviations gmx::makeLincsDeviations (const Lincs &lincsd, const rvec *x, const t_pbc *pbc)
 Determine how well the constraints have been satisfied.
 
bool gmx::constrain_lincs (bool computeRmsd, const t_inputrec &ir, int64_t step, Lincs *lincsd, const t_mdatoms &md, const t_commrec *cr, const gmx_multisim_t *ms, const rvec *x, rvec *xprime, rvec *min_proj, const matrix box, t_pbc *pbc, real lambda, real *dvdlambda, real invdt, rvec *v, bool bCalcVir, tensor vir_r_m_dr, ConstraintVariable econq, t_nrnb *nrnb, int maxwarn, int *warncount)
 Applies LINCS constraints. More...
 

Variables

static const int gmx::simd_width = 4
 Define simd_width for memory allocation used for SIMD code.