ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
math Namespace Reference

Functions

DEVICE_QUALIFIER auto abs (double x)
 Return the absolute value of x.
 
DEVICE_QUALIFIER auto abs (float x)
 Return the absolute value of x.
 
template<typename T >
DEVICE_QUALIFIER auto sinc (T x)
 Calculate the function \( \mathrm{sinc}(x) = \sin(\pi x)/(\pi x) \).
 
template<int cao>
DEVICE_QUALIFIER auto analytic_cotangent_sum (int n, double mesh_i)
 One of the aliasing sums used to compute k-space errors.
 
auto get_analytic_cotangent_sum_kernel (int cao)
 

Function Documentation

◆ abs() [1/2]

DEVICE_QUALIFIER auto math::abs ( double  x)
inline

Return the absolute value of x.

Definition at line 37 of file math.hpp.

Referenced by sinc().

◆ abs() [2/2]

DEVICE_QUALIFIER auto math::abs ( float  x)
inline

Return the absolute value of x.

Definition at line 40 of file math.hpp.

◆ analytic_cotangent_sum()

template<int cao>
DEVICE_QUALIFIER auto math::analytic_cotangent_sum ( int  n,
double  mesh_i 
)

One of the aliasing sums used to compute k-space errors.

Fortunately the one which is most important (because it converges most slowly, since it is not damped exponentially) can be calculated analytically. The result (which depends on the order of the spline interpolation) can be written as an even trigonometric polynomial. The results are tabulated here (the employed formula is eq. 7-66 p. 233 in [22]).

Definition at line 93 of file math.hpp.

References Utils::sqr().

◆ get_analytic_cotangent_sum_kernel()

auto math::get_analytic_cotangent_sum_kernel ( int  cao)
inline

Definition at line 128 of file math.hpp.

Referenced by dp3m_k_space_error(), and p3m_k_space_error().

◆ sinc()

template<typename T >
DEVICE_QUALIFIER auto math::sinc ( x)

Calculate the function \( \mathrm{sinc}(x) = \sin(\pi x)/(\pi x) \).

(same convention as in [22]). In order to avoid divisions by 0, arguments whose modulus is smaller than \( \epsilon = 0.1 \) are evaluated by an 8th order Taylor expansion. Note that the difference between sinc(x) and this expansion is smaller than 0.235e-12, if x is smaller than \( \epsilon \). (The next term in the expansion is the 10th order contribution, i.e. \( \pi^{10} x^{10}/39916800 \approx 0.2346 \cdot x^{12} \)).

Definition at line 53 of file math.hpp.

References abs().

Referenced by Aliasing_sums_ik(), dp3m_tune_aliasing_sums(), G_opt(), G_opt_dipolar(), G_opt_dipolar_self_energy(), p3m_k_space_error_gpu_kernel_ik(), and p3m_tune_aliasing_sums().