Gromacs  2025-dev-20240516-46ce888
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
pbc_aiuc_sycl.h File Reference
#include "gromacs/gpu_utils/gputraits_sycl.h"
#include "gromacs/pbcutil/pbc_aiuc.h"
+ Include dependency graph for pbc_aiuc_sycl.h:
+ This graph shows which files directly or indirectly include this file:

Description

Basic routines to handle periodic boundary conditions with SYCL.

Author
Andrey Alekseenko al42a.nosp@m.nd@g.nosp@m.mail..nosp@m.com
Artem Zhmurov zhmur.nosp@m.ov@g.nosp@m.mail..nosp@m.com

Functions

static constexpr int xyzToShiftIndex (int x, int y, int z)
 
template<bool returnShift>
int pbcDxAiucSycl (const PbcAiuc &pbcAiuc, const sycl::float4 &r1, const sycl::float4 &r2, Float3 &dr)
 Computes the vector between two points taking PBC into account. More...
 
static void pbcDxAiucSycl (const PbcAiuc &pbcAiuc, const rvec &r1, const rvec &r2, rvec dr)
 Computes the vector between two points taking PBC into account. More...
 

Function Documentation

template<bool returnShift>
int pbcDxAiucSycl ( const PbcAiuc pbcAiuc,
const sycl::float4 &  r1,
const sycl::float4 &  r2,
Float3 dr 
)

Computes the vector between two points taking PBC into account.

Computes the vector dr between points r2 and r1, taking into account the periodic boundary conditions, described in pbcAiuc object. Note that this routine always does the PBC arithmetic for all directions, multiplying the displacements by zeroes if the corresponding direction is not periodic. For triclinic boxes only distances up to half the smallest box diagonal element are guaranteed to be the shortest. This means that distances from 0.5/sqrt(2) times a box vector length (e.g. for a rhombic dodecahedron) can use a more distant periodic image.

Todo:
This routine uses CUDA float4 types for input coordinates and returns in rvec data-type. Other than that, it does essentially the same thing as the version below, as well as SIMD and CPU versions. This routine is used in GPU listed forces module. To avoid code duplication, these implementations should be unified. See Issue #2863: https://gitlab.com/gromacs/gromacs/-/issues/2863
Parameters
[in]pbcAiucPBC object.
[in]r1Coordinates of the first point.
[in]r2Coordinates of the second point.
[out]drResulting distance.
static void pbcDxAiucSycl ( const PbcAiuc pbcAiuc,
const rvec r1,
const rvec r2,
rvec  dr 
)
static

Computes the vector between two points taking PBC into account.

Computes the vector dr between points r2 and r1, taking into account the periodic boundary conditions, described in pbcAiuc object. Note that this routine always does the PBC arithmetic for all directions, multiplying the displacements by zeroes if the corresponding direction is not periodic. For triclinic boxes only distances up to half the smallest box diagonal element are guaranteed to be the shortest. This means that distances from 0.5/sqrt(2) times a box vector length (e.g. for a rhombic dodecahedron) can use a more distant periodic image.

Todo:
This routine operates on rvec types and uses PbcAiuc to define periodic box, but essentially does the same thing as SIMD and GPU version. These will have to be unified in future to avoid code duplication. See Issue #2863: https://gitlab.com/gromacs/gromacs/-/issues/2863
Parameters
[in]pbcAiucPBC object.
[in]r1Coordinates of the first point.
[in]r2Coordinates of the second point.
[out]drResulting distance.