Gromacs  2025-dev-20240614-602a366
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes
gmx::ThreadForceBuffer< ForceBufferElementType > Class Template Reference

#include <gromacs/mdtypes/threaded_force_buffer.h>


template<typename ForceBufferElementType>
class gmx::ThreadForceBuffer< ForceBufferElementType >

Object that holds force and energies buffers plus a mask for a thread.

Template Parameters
ForceBufferElementTypeThe type for components of the normal force buffer: rvec or rvec4

Public Member Functions

 ThreadForceBuffer (int threadIndex, bool useEnergyTerms, int numEnergyGroups)
 Constructor. More...
void resizeBufferAndClearMask (int numAtoms)
 Resizes the buffer to numAtoms and clears the mask.
void addAtomToMask (const int atomIndex)
 Adds atom with index atomIndex for reduction.
void processMask ()
Index size () const
 Returns the size of the force buffer in number of atoms.
void clearForcesAndEnergies ()
 Clears all force and energy buffers.
ArrayRef< ForceBufferElementType > forceBuffer ()
 Returns an array reference to the force buffer which is aligned for SIMD access.
< ForceBufferElementType > 
forceBufferWithPadding ()
 Returns an array reference with padding to the force buffer which is aligned for SIMD access. More...
ArrayRef< RVecshiftForces ()
 Returns a view of the shift force buffer.
ArrayRef< realenergyTerms ()
 Returns a view of the energy terms, size F_NRE.
gmx_grppairener_t & groupPairEnergies ()
 Returns a reference to the energy group pair energies.
< FreeEnergyPerturbationCouplingType,
real > & 
dvdl ()
 Returns a reference to the dvdl terms.
ArrayRef< const gmx_bitmask_treductionMask () const
 Returns a const view to the reduction masks.

Static Public Attributes

static constexpr int s_numReductionBlockBits = 5
 The log2 of the reduction block size.
static constexpr int s_reductionBlockSize = (1 << s_numReductionBlockBits)
 Force buffer block size in atoms.

Constructor & Destructor Documentation

template<typename ForceBufferElementType >
gmx::ThreadForceBuffer< ForceBufferElementType >::ThreadForceBuffer ( int  threadIndex,
bool  useEnergyTerms,
int  numEnergyGroups 


[in]threadIndexThe index of the thread that will fill the buffers in this object
[in]useEnergyTermsWhether the list of energy terms will be used
[in]numEnergyGroupsThe number of non-bonded energy groups

Member Function Documentation

template<typename ForceBufferElementType>
ArrayRefWithPadding<ForceBufferElementType> gmx::ThreadForceBuffer< ForceBufferElementType >::forceBufferWithPadding ( )

Returns an array reference with padding to the force buffer which is aligned for SIMD access.

For RVec there is padding of one real for 4-wide SIMD access. For both RVec and rvec4 there is padding up to the block size for use in ThreadedForceBuffer.

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