ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
#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>
Go to the source code of this file.
Functions | |
template<std::size_t S, std::size_t m> | |
double | G_opt (P3MParameters const ¶ms, 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 ¶ms, 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. | |
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.
S | Order of the differential operator (0 for potential, 1 for E-field) |
m | Number of Brillouin zones that contribute to the aliasing sums |
params | P3M parameters |
k | k-vector to evaluate the function for. |
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().
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.
S | Order of the differential operator (0 for potential, 1 for E-field) |
m | Number of Brillouin zones that contribute to the aliasing sums |
params | P3M parameters. |
n_start | Lower left corner of the grid in k-space. |
n_stop | Upper right corner of the grid in k-space. |
KX | k-space x-axis index. |
KY | k-space y-axis index. |
KZ | k-space z-axis index. |
inv_box_l | Inverse box length. |
Definition at line 137 of file influence_function.hpp.
References calc_p3m_mesh_shift(), for_each_3d(), params, and Utils::product().