Processing math: 100%
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
influence_function.hpp File Reference
#include "config/config.hpp"
#include "p3m/common.hpp"
#include "p3m/for_each_3d.hpp"
#include "p3m/math.hpp"
#include <utils/Vector.hpp>
#include <utils/index.hpp>
#include <utils/math/int_pow.hpp>
#include <utils/math/sqr.hpp>
#include <cmath>
#include <cstddef>
#include <functional>
#include <numbers>
#include <utility>
#include <vector>
+ Include dependency graph for influence_function.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<std::size_t S, std::size_t m>
double G_opt (P3MParameters const &params, Utils::Vector3d const &k)
 Calculate the aliasing sums for the optimal influence function.
 
template<typename FloatType , std::size_t S, std::size_t m>
std::vector< FloatType > grid_influence_function (P3MParameters const &params, Utils::Vector3i const &n_start, Utils::Vector3i const &n_stop, Utils::Vector3d const &inv_box_l)
 Map influence function over a grid.
 

Function Documentation

◆ G_opt()

template<std::size_t S, std::size_t m>
double G_opt ( P3MParameters const &  params,
Utils::Vector3d const &  k 
)

Calculate the aliasing sums for the optimal influence function.

This implements Eq. 30 of [10], which can be used for monopole and dipole P3M by choosing the appropriate S factor.

\tilde{G}_{\text{opt}} ( k ) = \frac{\sum_{m \in \mathbb{Z}^{3}} [ [ \tilde{ \left ( D \right ) } ( k ) \cdot i k_{m} ]^{S} ( \hat{U} ( k_{m} ) )^{2} \hat{\phi} ( k_{m} ) ]}{[ \tilde{ \left ( D \right ) } ( k ) ]^{2 S} [ \sum_{m \in \mathbb{Z}^{3}} ( \hat{U} ( k_{m} ) )^{2} ]^{2}}

Eq 8.29 in Hockney:

G_{\text{opt}}(\mathbf{k}) = \frac{\hat{\mathbf{D}}\sum_n \hat{\mathbf{R}}^\ast \hat{U}^2}{|\hat{\mathbf{D}}|^2\sum_n \hat{U}^2\sum_{n'}^{'} \hat{U}^2}

The full equation is:

\begin{align*} G_{\text{opt}}(\vec{n}, S, \text{cao}) &= \displaystyle\frac{4\pi}{\sum_\vec{m} U^2} \sum_\vec{m}U^2 \displaystyle\frac{\left(\vec{k}\odot\vec{k}_m\right)^S} {|\vec{k}_m|^2} e^{-1/(2\alpha)^2|\vec{k}_m|^2} \\ U &= \operatorname{det}\left[I_3\cdot\operatorname{sinc}\left( \frac{\vec{k}_m\odot\vec{a}}{2\pi}\right)\right]^{\text{cao}} \\ \vec{k} &= \frac{2\pi}{\vec{N}\odot\vec{a}}\vec{s}[\vec{n}] \\ \vec{k}_m &= \frac{2\pi}{\vec{N}\odot\vec{a}} \left(\vec{s}[\vec{n}]+\vec{m}\odot\vec{N}\right) \end{align*}

with I_3 the 3x3 identity matrix, \vec{N} the global mesh size in k-space coordinates, \vec{a} the mesh size, \vec{m} the Brillouin zone coordinates, \odot the Hadamard product.

Template Parameters
SOrder of the differential operator (0 for potential, 1 for E-field)
mNumber of Brillouin zones that contribute to the aliasing sums
Parameters
paramsP3M parameters
kk-vector to evaluate the function for.
Returns
The optimal influence function for a specific k-vector.

Definition at line 91 of file influence_function.hpp.

References Utils::Vector< T, N >::broadcast(), for_each_3d(), Utils::Vector< T, N >::norm2(), params, Utils::product(), math::sinc(), and Utils::sqr().

◆ grid_influence_function()

template<typename FloatType , std::size_t S, std::size_t m>
std::vector< FloatType > grid_influence_function ( P3MParameters const &  params,
Utils::Vector3i const &  n_start,
Utils::Vector3i const &  n_stop,
Utils::Vector3d const &  inv_box_l 
)

Map influence function over a grid.

This evaluates the optimal influence function G_opt over a regular grid of k vectors, and returns the values as a vector.

Template Parameters
SOrder of the differential operator (0 for potential, 1 for E-field)
mNumber of Brillouin zones that contribute to the aliasing sums
Parameters
paramsP3M parameters.
n_startLower left corner of the grid in k-space.
n_stopUpper right corner of the grid in k-space.
inv_box_lInverse box length.
Returns
Values of G_opt at regular grid points.

Definition at line 151 of file influence_function.hpp.

References calc_p3m_mesh_shift(), Utils::COLUMN_MAJOR, for_each_3d(), Utils::get_linear_index(), params, and Utils::product().