Gromacs  2020.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
pbc_aiuc.h File Reference
#include "gromacs/pbcutil/ishift.h"

Description

Structure and basic routines to handle periodic boundary conditions.

This file contains CPU

Todo:
CPU, GPU and SIMD routines essentially do the same operations on different data-types. Currently this leads to code duplication, which has to be resolved. For details, see Redmine task #2863 https://redmine.gromacs.org/issues/2863
Author
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Berk Hess hess@.nosp@m.kth..nosp@m.se
Artem Zhmurov zhmur.nosp@m.ov@g.nosp@m.mail..nosp@m.com

Classes

struct  PbcAiuc
 Compact and ordered version of the PBC matrix. More...
 

Functions

static void setPbcAiuc (int numPbcDim, const matrix box, PbcAiuc *pbcAiuc)
 Set the PBC data-structure. More...
 
static void pbcDxAiuc (const PbcAiuc &pbcAiuc, const rvec &r1, const rvec &r2, rvec dr)
 Computes the vector between two points taking PBC into account. More...
 

Function Documentation

static void pbcDxAiuc ( const PbcAiuc pbcAiuc,
const rvec &  r1,
const rvec &  r2,
rvec  dr 
)
inlinestatic

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 Redmine task #2863: https://redmine.gromacs.org/issues/2863
Parameters
[in]pbcAiucPBC object.
[in]r1Coordinates of the first point.
[in]r2Coordinates of the second point.
[out]drResulting distance.
static void setPbcAiuc ( int  numPbcDim,
const matrix  box,
PbcAiuc pbcAiuc 
)
inlinestatic

Set the PBC data-structure.

Parameters
[in]numPbcDimNumber of periodic dimensions: 0 - no periodicity. 1 - periodicity along X-axis. 2 - periodicity in XY plane. 3 - periodicity along all dimensions.
[in]boxMatrix, describing the periodic cell.
[out]pbcAiucPointer to PbcAiuc structure to be initialized.