Gromacs  2027.0-dev-20261009-dd255a67
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Enumerations | Functions
gmx::anonymous_namespace{update.cpp} Namespace Reference

Enumerations

enum  SDUpdate : int { ForcesOnly, FrictionAndNoiseOnly, Combined, Count }
 Sets the SD update type.
 

Functions

void simdLoadRvecs (const RVec *r, int index, UpdateSimdReal *r0, UpdateSimdReal *r1, UpdateSimdReal *r2)
 Load (aligned) the contents of GMX_SIMD_REAL_WIDTH RVec elements sequentially into 3 SIMD registers. More...
 
void simdStoreRvecs (RVec *r, int index, UpdateSimdReal r0, UpdateSimdReal r1, UpdateSimdReal r2)
 Store (aligned) 3 SIMD registers sequentially to GMX_SIMD_REAL_WIDTH RVec elements. More...
 
template<StoreUpdatedVelocities storeUpdatedVelocities, NumTempScaleValues numTempScaleValues, typename VelocityType >
std::enable_if_t
< std::is_same_v< VelocityType,
RVec >||std::is_same_v
< VelocityType, const RVec >
, void > 
updateMDLeapfrogSimpleSimd (int start, int nrend, real dt, ArrayRef< const real > invMass, ArrayRef< const t_grp_tcstat > tcstat, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, VelocityType *gmx_restrict v, const RVec *gmx_restrict f)
 Integrate using leap-frog with single group T-scaling and SIMD. More...
 
template<AccelerationType accelerationType>
void updateMDLeapfrogGeneral (int start, int nrend, bool doNoseHoover, real dt, real dtPressureCouple, ArrayRef< const unsigned short > cTC, ArrayRef< const unsigned short > cAcceleration, const RVec *gmx_restrict acceleration, const matrix boxDeformation, ArrayRef< const RVec > invMassPerDim, const gmx_ekindata_t *ekind, const matrix box, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, RVec *gmx_restrict v, const RVec *gmx_restrict f, const double *gmx_restrict nh_vxi, const int nsttcouple, const Matrix3x3 &parrinelloRahmanM)
 Integrate using leap-frog with support for everything. More...
 
void do_update_md (int start, int nrend, real dt, int64_t step, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, RVec *gmx_restrict v, const RVec *gmx_restrict f, const TemperatureCoupling etc, const PressureCoupling epc, const int nsttcouple, const int nstpcouple, ArrayRef< const unsigned short > cTC, const AccelerationType simulationAccelerationType, ArrayRef< const unsigned short > cAcceleration, ArrayRef< const RVec > acceleration, const matrix boxDeformation, ArrayRef< const real > gmx_unused invmass, ArrayRef< const RVec > invMassPerDim, const gmx_ekindata_t *ekind, const matrix box, const double *gmx_restrict nh_vxi, const Matrix3x3 &parrinelloRahmanM, bool gmx_unused havePartiallyFrozenAtoms)
 Handles the Leap-frog MD x and v integration.
 
void doUpdateMDDoNotUpdateVelocities (int start, int nrend, real dt, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, const RVec *gmx_restrict v, const RVec *gmx_restrict f, bool gmx_unused havePartiallyFrozenAtoms, ArrayRef< const real > gmx_unused invmass, ArrayRef< const RVec > invMassPerDim, const gmx_ekindata_t &ekind)
 Handles the Leap-frog MD x and v integration.
 
void do_update_vv_vel (int start, int nrend, real dt, ArrayRef< const ivec > nFreeze, ArrayRef< const unsigned short > cAcceleration, const RVec *gmx_restrict acceleration, ArrayRef< const real > invmass, ArrayRef< const ParticleType > ptype, ArrayRef< const unsigned short > cFREEZE, RVec *gmx_restrict v, const RVec *gmx_restrict f, gmx_bool bExtended, real veta, real alpha)
 
void do_update_vv_pos (int start, int nrend, real dt, ArrayRef< const ivec > nFreeze, ArrayRef< const ParticleType > ptype, ArrayRef< const unsigned short > cFREEZE, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, const RVec *gmx_restrict v, gmx_bool bExtended, real veta)
 
template<SDUpdate updateType>
void doSDUpdateGeneral (const gmx_stochd_t &sd, int start, int nrend, real dt, ArrayRef< const ivec > nFreeze, ArrayRef< const real > invmass, ArrayRef< const ParticleType > ptype, ArrayRef< const unsigned short > cFREEZE, ArrayRef< const unsigned short > cTC, ArrayRef< const unsigned short > cAcceleration, const RVec *gmx_restrict acceleration, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, RVec *gmx_restrict v, const RVec *gmx_restrict f, int64_t step, int seed, const int *gatindex, real dtPressureCouple, const Matrix3x3 &parrinelloRahmanM)
 SD integrator update. More...
 
void do_update_sd (int start, int nrend, real dt, int64_t step, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, RVec *gmx_restrict v, const RVec *gmx_restrict f, ArrayRef< const ivec > nFreeze, ArrayRef< const real > invmass, ArrayRef< const ParticleType > ptype, ArrayRef< const unsigned short > cFREEZE, ArrayRef< const unsigned short > cTC, ArrayRef< const unsigned short > cAcceleration, ArrayRef< const RVec > acceleration, int seed, const gmx_domdec_t *dd, const gmx_stochd_t &sd, bool haveConstraints, const PressureCoupling pressureCoupling, const int nstpcouple, const Matrix3x3 &parrinelloRahmanM)
 
void do_update_bd (int start, int nrend, real dt, int64_t step, const RVec *gmx_restrict x, RVec *gmx_restrict xprime, RVec *gmx_restrict v, const RVec *gmx_restrict f, ArrayRef< const ivec > nFreeze, ArrayRef< const real > invmass, ArrayRef< const ParticleType > ptype, ArrayRef< const unsigned short > cFREEZE, ArrayRef< const unsigned short > cTC, real friction_coefficient, const real *rf, int seed, const int *gatindex)
 

Function Documentation

template<SDUpdate updateType>
void gmx::anonymous_namespace{update.cpp}::doSDUpdateGeneral ( const gmx_stochd_t &  sd,
int  start,
int  nrend,
real  dt,
ArrayRef< const ivec >  nFreeze,
ArrayRef< const real >  invmass,
ArrayRef< const ParticleType >  ptype,
ArrayRef< const unsigned short >  cFREEZE,
ArrayRef< const unsigned short >  cTC,
ArrayRef< const unsigned short >  cAcceleration,
const RVec *gmx_restrict  acceleration,
const RVec *gmx_restrict  x,
RVec *gmx_restrict  xprime,
RVec *gmx_restrict  v,
const RVec *gmx_restrict  f,
int64_t  step,
int  seed,
const int *  gatindex,
real  dtPressureCouple,
const Matrix3x3 &  parrinelloRahmanM 
)

SD integrator update.

Two phases are required in the general case of a constrained update, the first phase from the contribution of forces, before applying constraints, and then a second phase applying the friction and noise, and then further constraining. For details, see Goga2012.

Without constraints, the two phases can be combined, for efficiency.

Thus three instantiations of this templated function will be made, two with only one contribution, and one with both contributions.

To maximize the ability of the compiler to optimize, all the arrays of RVec should be annotated with gmx_restrict, so the compiler knows there is no aliasing, and for the same reason we do not use ArrayRef<RVec> for them.

void gmx::anonymous_namespace{update.cpp}::simdLoadRvecs ( const RVec *  r,
int  index,
UpdateSimdReal *  r0,
UpdateSimdReal *  r1,
UpdateSimdReal *  r2 
)
inline

Load (aligned) the contents of GMX_SIMD_REAL_WIDTH RVec elements sequentially into 3 SIMD registers.

The loaded output is: r0: { r[index][XX], r[index][YY], ... } r1: { ... } r2: { ..., r[index+GMX_SIMD_REAL_WIDTH-1][YY], r[index+GMX_SIMD_REAL_WIDTH-1][ZZ] }

Parameters
[in]rReal to an RVec array, has to be aligned to SIMD register width
[in]indexIndex of the first RVec triplet of reals to load
[out]r0Pointer to first SIMD register
[out]r1Pointer to second SIMD register
[out]r2Pointer to third SIMD register
void gmx::anonymous_namespace{update.cpp}::simdStoreRvecs ( RVec *  r,
int  index,
UpdateSimdReal  r0,
UpdateSimdReal  r1,
UpdateSimdReal  r2 
)
inline

Store (aligned) 3 SIMD registers sequentially to GMX_SIMD_REAL_WIDTH RVec elements.

The stored output is: r[index] = { { r0[0], r0[1], ... } ... r[index+GMX_SIMD_REAL_WIDTH-1] = { ... , r2[GMX_SIMD_REAL_WIDTH-2], r2[GMX_SIMD_REAL_WIDTH-1] }

Parameters
[out]rPointer to an RVec array, has to be aligned to SIMD register width
[in]indexIndex of the first RVec triplet of reals to store to
[in]r0First SIMD register
[in]r1Second SIMD register
[in]r2Third SIMD register
template<AccelerationType accelerationType>
void gmx::anonymous_namespace{update.cpp}::updateMDLeapfrogGeneral ( int  start,
int  nrend,
bool  doNoseHoover,
real  dt,
real  dtPressureCouple,
ArrayRef< const unsigned short >  cTC,
ArrayRef< const unsigned short >  cAcceleration,
const RVec *gmx_restrict  acceleration,
const matrix  boxDeformation,
ArrayRef< const RVec >  invMassPerDim,
const gmx_ekindata_t *  ekind,
const matrix  box,
const RVec *gmx_restrict  x,
RVec *gmx_restrict  xprime,
RVec *gmx_restrict  v,
const RVec *gmx_restrict  f,
const double *gmx_restrict  nh_vxi,
const int  nsttcouple,
const Matrix3x3 &  parrinelloRahmanM 
)

Integrate using leap-frog with support for everything.

Template Parameters
accelerationTypeType of NEMD acceleration.
Parameters
[in]startIndex of first atom to update.
[in]nrendLast atom to update: nrend - 1.
[in]doNoseHooverIf to apply Nose-Hoover T-coupling.
[in]dtThe time step.
[in]dtPressureCoupleTime step for pressure coupling, is 0 when no pressure coupling should be applied at this step.
[in]cTCTemperature coupling group indices
[in]cAccelerationAcceleration group indices
[in]accelerationAcceleration per group.
[in]boxDeformationVelocity of box components in units of nm/ps
[in]invMassPerDimInverse mass per dimension
[in]ekindKinetic energy data.
[in]boxThe box dimensions.
[in]xInput coordinates.
[out]xprimeUpdated coordinates.
[in,out]vVelocities.
[in]fForces.
[in]nh_vxiNose-Hoover velocity scaling factors.
[in]nsttcoupleFrequency of the temperature coupling steps.
[in]parrinelloRahmanMParrinello-Rahman scaling matrix.
template<StoreUpdatedVelocities storeUpdatedVelocities, NumTempScaleValues numTempScaleValues, typename VelocityType >
std::enable_if_t<std::is_same_v<VelocityType, RVec> || std::is_same_v<VelocityType, const RVec>, void> gmx::anonymous_namespace{update.cpp}::updateMDLeapfrogSimpleSimd ( int  start,
int  nrend,
real  dt,
ArrayRef< const real >  invMass,
ArrayRef< const t_grp_tcstat >  tcstat,
const RVec *gmx_restrict  x,
RVec *gmx_restrict  xprime,
VelocityType *gmx_restrict  v,
const RVec *gmx_restrict  f 
)

Integrate using leap-frog with single group T-scaling and SIMD.

Template Parameters
storeUpdatedVelocitiesTells whether we should store the updated velocities
numTempScaleValuesThe number of different T-couple values
VelocityTypeEither RVec or const RVec according to whether we store velocities
Parameters
[in]startIndex of first atom to update
[in]nrendLast atom to update: nrend - 1
[in]dtThe time step
[in]invMass1/mass per atom
[in]tcstatTemperature coupling information
[in]xInput coordinates
[out]xprimeUpdated coordinates
[in,out]vVelocities, type either RVec* or const RVec*
[in]fForces