Gromacs  2024.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions
gmx::LincsGpu Class Reference

#include <gromacs/mdlib/lincs_gpu.h>

Description

Class with interfaces and data for GPU version of LINCS.

Public Member Functions

 LincsGpu (int numIterations, int expansionOrder, const DeviceContext &deviceContext, const DeviceStream &deviceStream)
 Constructor. More...
 
 ~LincsGpu ()
 Destructor.
 
void apply (const DeviceBuffer< Float3 > &d_x, DeviceBuffer< Float3 > d_xp, bool updateVelocities, DeviceBuffer< Float3 > d_v, real invdt, bool computeVirial, tensor virialScaled, const PbcAiuc &pbcAiuc)
 Apply LINCS. More...
 
void set (const InteractionDefinitions &idef, int numAtoms, ArrayRef< const real > invmass)
 Update data-structures (e.g. after NB search step). More...
 

Static Public Member Functions

static bool isNumCoupledConstraintsSupported (const gmx_mtop_t &mtop)
 Returns whether the maximum number of coupled constraints is supported by the GPU LINCS code. More...
 

Constructor & Destructor Documentation

gmx::LincsGpu::LincsGpu ( int  numIterations,
int  expansionOrder,
const DeviceContext &  deviceContext,
const DeviceStream deviceStream 
)

Constructor.

Parameters
[in]numIterationsNumber of iteration for the correction of the projection.
[in]expansionOrderOrder of the matrix inversion algorithm.
[in]deviceContextDevice context (dummy in CUDA).
[in]deviceStreamDevice command stream.

Member Function Documentation

void gmx::LincsGpu::apply ( const DeviceBuffer< Float3 > &  d_x,
DeviceBuffer< Float3 d_xp,
bool  updateVelocities,
DeviceBuffer< Float3 d_v,
real  invdt,
bool  computeVirial,
tensor  virialScaled,
const PbcAiuc pbcAiuc 
)

Apply LINCS.

Applies LINCS to coordinates and velocities, stored on GPU. The results are not automatically copied back to the CPU memory. Method uses this class data structures which should be updated when needed using set() method.

Parameters
[in]d_xCoordinates before timestep (in GPU memory)
[in,out]d_xpCoordinates after timestep (in GPU memory). The resulting constrained coordinates will be saved here.
[in]updateVelocitiesIf the velocities should be updated.
[in,out]d_vVelocities to update (in GPU memory, can be nullptr if not updated)
[in]invdtReciprocal timestep (to scale Lagrange multipliers when velocities are updated)
[in]computeVirialIf virial should be updated.
[in,out]virialScaledScaled virial tensor to be updated.
[in]pbcAiucPBC data.
bool gmx::LincsGpu::isNumCoupledConstraintsSupported ( const gmx_mtop_t &  mtop)
static

Returns whether the maximum number of coupled constraints is supported by the GPU LINCS code.

Parameters
[in]mtopThe molecular topology
void gmx::LincsGpu::set ( const InteractionDefinitions &  idef,
int  numAtoms,
ArrayRef< const real invmass 
)

Update data-structures (e.g. after NB search step).

Updates the constraints data and copies it to the GPU. Should be called if the particles were sorted, redistributed between domains, etc. This version uses common data formats so it can be called from anywhere in the code. Does not recycle the data preparation routines from the CPU version. Works only with simple case when all the constraints in idef are are handled by a single GPU. Triangles are not handled as special case.

Information about constraints is taken from: idef.il[F_CONSTR].iatoms — type (T) of constraint and two atom indexes (i1, i2) idef.iparams[T].constr.dA — target length for constraint of type T

Parameters
[in]idefLocal topology data to get information on constraints from.
[in]numAtomsNumber of atoms.
[in]invmassInverse masses of atoms.

The documentation for this class was generated from the following files: