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

#include <gromacs/math/gausstransform.h>


Provide result of Gaussian function evaluation on a one-dimensional lattice.

This class owns the result of the operation and provides a view on it.

The distance between lattice points is one. Unit length is normalized by the lattice spacing, thus spreading width and range are given as multiples of lattice points distances.

This works well as approximation to piece-wise integration of a Gaussian on a lattice, when $\sigma > 1$. The maximal relative error to evaluating erf differences for $\sigma = 1$ is 0.01602.

Public Member Functions

 GaussianOn1DLattice (int numGridPointsForSpreadingHalfWidth, real sigma)
 Construct Gaussian spreader with spreading range and Gaussian width. More...
 GaussianOn1DLattice (const GaussianOn1DLattice &other)
 Copy constructor.
GaussianOn1DLatticeoperator= (const GaussianOn1DLattice &other)
 Copy assignment.
 GaussianOn1DLattice (GaussianOn1DLattice &&other) noexcept
 Move constructor.
GaussianOn1DLatticeoperator= (GaussianOn1DLattice &&other) noexcept
 Move assignment.
void spread (double amplitude, real latticeOffset)
 Spreads weight onto grid points in one dimension. More...
ArrayRef< const float > view ()
 Returns view on spread result.

Constructor & Destructor Documentation

gmx::GaussianOn1DLattice::GaussianOn1DLattice ( int  numGridPointsForSpreadingHalfWidth,
real  sigma 

Construct Gaussian spreader with spreading range and Gaussian width.

Spread weights are distributed over a non-periodic lattice of length 2*numGridPointsForSpreadingHalfWidth+1. The lattice comprises a center point and spreadDistance points to the left and to the right.

There is a maximum spreading width
[in]numGridPointsForSpreadingHalfWidthmaximum distance in number of gridpoints from 0
[in]sigmaGaussian width.

Member Function Documentation

void gmx::GaussianOn1DLattice::spread ( double  amplitude,
real  latticeOffset 

Spreads weight onto grid points in one dimension.

       .            :            |            :            .
       o            o            o            o            o

O - atom position o - lattice positions . : | spreading value at grid points.

Highest numerical accuracy is achieved when the spreading with offset to the nearest lattice coordinated < 0.5

Spreading on lattice coordinate $x_i$

\[ f(x_i) = \frac{\mathrm{amplitude}}{\sigma\sqrt{2\pi}}\exp(-\frac{\mathrm{offset}-x_i^2}{2 \sigma ^2}) \]

[in]amplitudeof the Gaussian spread.
[in]latticeOffsetThe distance to the nearest grid point in lattice coordinates.

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