ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
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, int const KX, int const KY, int const KZ, 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 [9], which can be used for monopole and dipole P3M by choosing the appropriate S factor.

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 78 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,
int const  KX,
int const  KY,
int const  KZ,
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.
KXk-space x-axis index.
KYk-space y-axis index.
KZk-space z-axis index.
inv_box_lInverse box length.
Returns
Values of G_opt at regular grid points.

Definition at line 137 of file influence_function.hpp.

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