ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
CoulombP3MImpl< FloatType, Architecture, FFTConfig > Struct Template Reference

#include <p3m.impl.hpp>

Inheritance diagram for CoulombP3MImpl< FloatType, Architecture, FFTConfig >:
Collaboration diagram for CoulombP3MImpl< FloatType, Architecture, FFTConfig >:

Public Types

using CoulombP3MStateClass

Public Member Functions

 ~CoulombP3MImpl () override=default
 CoulombP3MImpl (std::unique_ptr< CoulombP3MStateClass > &&p3m_state, TuningParameters tuning_params, double prefactor)
void init () override
void tune () override
void count_charged_particles () override
void count_charged_particles_elc (std::size_t n, double sum_q2, double square_sum_q) override
void adapt_epsilon_elc () override
bool is_tuned () const noexcept override
bool is_gpu () const noexcept override
bool is_double_precision () const noexcept override
void on_activation () override
double long_range_energy () override
void add_long_range_forces () override
Utils::Vector9d long_range_pressure () override
void charge_assign () override
void assign_charge (double q, Utils::Vector3d const &real_pos, bool skip_cache) override
void prepare_fft_mesh (bool reset_weights, bool zero_rs) override
Public Member Functions inherited from CoulombP3M
 CoulombP3M (P3MParameters const &p3m_params)
virtual ~CoulombP3M ()=default
void on_boxl_change ()
 Recalculate all box-length-dependent parameters.
void on_node_grid_change () const
void on_periodicity_change () const
void on_cell_structure_change ()
void sanity_checks () const
Utils::Vector3d pair_force (double q1q2, Utils::Vector3d const &d, double dist) const
 Calculate real-space contribution of p3m Coulomb pair forces.
double pair_energy (double q1q2, double dist) const
 Calculate real-space contribution of Coulomb pair energy.
Public Member Functions inherited from Coulomb::Actor< CoulombP3M >
void set_prefactor (double new_prefactor)
void sanity_checks_charge_neutrality () const
Public Member Functions inherited from System::Leaf< Actor< CoulombP3M > >
void bind_system (std::shared_ptr< System > const &system)
void detach_system (std::shared_ptr< System > const &system)

Public Attributes

CoulombP3MStateClass & p3m
 Coulomb P3M parameters.
Public Attributes inherited from CoulombP3M
P3MParameters const & p3m_params
Public Attributes inherited from Coulomb::Actor< CoulombP3M >
double prefactor
 Electrostatics prefactor.
double charge_neutrality_tolerance
 Relative tolerance for the charge excess during neutrality checks.

Protected Member Functions

double long_range_kernel (bool force_flag, bool energy_flag)
 Compute the k-space part of forces and energies.
void calc_influence_function_force () override
 Calculate the optimal influence function of [24].
void calc_influence_function_energy () override
 Calculate the influence function optimized for the energy and the self energy correction.
void scaleby_box_l () override
void init_cpu_kernels ()
void init_gpu_kernels ()
void add_long_range_forces_gpu ()
void request_gpu () const
Protected Member Functions inherited from CoulombP3M
void sanity_checks_boxl () const
 Checks for correctness of the k-space cutoff.
void sanity_checks_periodicity () const
void sanity_checks_cell_structure () const
Protected Member Functions inherited from System::Leaf< Actor< CoulombP3M > >
auto & get_system ()

Protected Attributes

std::shared_ptr< P3MGpuParams > m_gpu_data = nullptr
Protected Attributes inherited from System::Leaf< Actor< CoulombP3M > >
std::weak_ptr< System > m_system

Additional Inherited Members

Static Public Attributes inherited from Coulomb::Actor< CoulombP3M >
static auto constexpr charge_neutrality_tolerance_default

Detailed Description

template<typename FloatType, Arch Architecture, class FFTConfig>
struct CoulombP3MImpl< FloatType, Architecture, FFTConfig >

Definition at line 113 of file p3m.impl.hpp.

Member Typedef Documentation

◆ CoulombP3MStateClass

template<typename FloatType, Arch Architecture, class FFTConfig>
using CoulombP3MImpl< FloatType, Architecture, FFTConfig >::CoulombP3MStateClass
Initial value:
Base class for the electrostatics P3M algorithm.
Definition p3m.impl.hpp:64

Definition at line 116 of file p3m.impl.hpp.

Constructor & Destructor Documentation

◆ ~CoulombP3MImpl()

template<typename FloatType, Arch Architecture, class FFTConfig>
CoulombP3MImpl< FloatType, Architecture, FFTConfig >::~CoulombP3MImpl ( )
overridedefault

◆ CoulombP3MImpl()

template<typename FloatType, Arch Architecture, class FFTConfig>
CoulombP3MImpl< FloatType, Architecture, FFTConfig >::CoulombP3MImpl ( std::unique_ptr< CoulombP3MStateClass > && p3m_state,
TuningParameters tuning_params,
double prefactor )
inline

Member Function Documentation

◆ adapt_epsilon_elc()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::adapt_epsilon_elc ( )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 170 of file p3m.impl.hpp.

References p3m, and P3M_EPSILON_METALLIC.

◆ add_long_range_forces()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::add_long_range_forces ( )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 201 of file p3m.impl.hpp.

References add_long_range_forces_gpu(), CPU, CUDA, and long_range_kernel().

◆ add_long_range_forces_gpu()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::add_long_range_forces_gpu ( )
protected

◆ assign_charge()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::assign_charge ( double q,
Utils::Vector3d const & real_pos,
bool skip_cache )
overridevirtual

Implements CoulombP3M.

Definition at line 444 of file p3m.impl.definitions.hpp.

References Utils::integral_parameter(), and p3m.

◆ calc_influence_function_energy()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::calc_influence_function_energy ( )
overrideprotectedvirtual

Calculate the influence function optimized for the energy and the self energy correction.

Implements CoulombP3M.

Definition at line 182 of file p3m.impl.definitions.hpp.

References calc_influence_function_energy(), System::Leaf< Actor< CoulombP3M > >::get_system(), grid_influence_function(), influence_function_r2c(), p3m, and P3M_BRILLOUIN.

Referenced by calc_influence_function_energy(), and scaleby_box_l().

◆ calc_influence_function_force()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::calc_influence_function_force ( )
overrideprotectedvirtual

Calculate the optimal influence function of [24].

(optimised for force calculations)

Each node calculates only the values for its domain in k-space.

See also: [24] eq. 8-22 (p. 275). Note the somewhat different convention for the prefactors, which is described in [12] [13].

Implements CoulombP3M.

Definition at line 165 of file p3m.impl.definitions.hpp.

References calc_influence_function_force(), System::Leaf< Actor< CoulombP3M > >::get_system(), grid_influence_function(), influence_function_r2c(), p3m, and P3M_BRILLOUIN.

Referenced by calc_influence_function_force(), and scaleby_box_l().

◆ charge_assign()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::charge_assign ( )
overridevirtual

◆ count_charged_particles()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::count_charged_particles ( )
overridevirtual

◆ count_charged_particles_elc()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::count_charged_particles_elc ( std::size_t n,
double sum_q2,
double square_sum_q )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 164 of file p3m.impl.hpp.

References p3m.

◆ init()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::init ( )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 152 of file p3m.impl.hpp.

References CPU, CUDA, init_cpu_kernels(), and init_gpu_kernels().

Referenced by tune().

◆ init_cpu_kernels()

◆ init_gpu_kernels()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::init_gpu_kernels ( )
protected

◆ is_double_precision()

template<typename FloatType, Arch Architecture, class FFTConfig>
bool CoulombP3MImpl< FloatType, Architecture, FFTConfig >::is_double_precision ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements CoulombP3M.

Definition at line 178 of file p3m.impl.hpp.

◆ is_gpu()

template<typename FloatType, Arch Architecture, class FFTConfig>
bool CoulombP3MImpl< FloatType, Architecture, FFTConfig >::is_gpu ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements CoulombP3M.

Definition at line 175 of file p3m.impl.hpp.

References CPU.

◆ is_tuned()

template<typename FloatType, Arch Architecture, class FFTConfig>
bool CoulombP3MImpl< FloatType, Architecture, FFTConfig >::is_tuned ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements CoulombP3M.

Definition at line 174 of file p3m.impl.hpp.

Referenced by on_activation(), and tune().

◆ long_range_energy()

template<typename FloatType, Arch Architecture, class FFTConfig>
double CoulombP3MImpl< FloatType, Architecture, FFTConfig >::long_range_energy ( )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 199 of file p3m.impl.hpp.

References long_range_kernel().

Referenced by add_long_range_forces_gpu().

◆ long_range_kernel()

template<typename FloatType, Arch Architecture, class FFTConfig>
double CoulombP3MImpl< FloatType, Architecture, FFTConfig >::long_range_kernel ( bool force_flag,
bool energy_flag )
protected

◆ long_range_pressure()

template<typename FloatType, Arch Architecture, class FFTConfig>
Utils::Vector9d CoulombP3MImpl< FloatType, Architecture, FFTConfig >::long_range_pressure ( )
overridevirtual

Calculate the long range electrostatics part of the pressure tensor. This is part \(\Pi_{\textrm{rec}, \alpha, \beta}\) eq. (2.7) in [19]. The part \(\Pi_{\textrm{corr}, \alpha, \beta}\) eq. (2.8) is not present here since M is the empty set in our simulations.

Implements CoulombP3M.

Definition at line 591 of file p3m.impl.definitions.hpp.

References Utils::Vector< int, N >::broadcast(), charge_assign(), for_each_3d_order(), System::Leaf< Actor< CoulombP3M > >::get_system(), p3m, Coulomb::Actor< CoulombP3M >::prefactor, and Utils::sqr().

◆ on_activation()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::on_activation ( )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 182 of file p3m.impl.hpp.

References CUDA, init_cpu_kernels(), is_tuned(), request_gpu(), CoulombP3M::sanity_checks(), and tune().

◆ prepare_fft_mesh()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::prepare_fft_mesh ( bool reset_weights,
bool zero_rs )
inlineoverridevirtual

Implements CoulombP3M.

Definition at line 217 of file p3m.impl.hpp.

References kokkos_deep_copy(), and p3m.

Referenced by charge_assign().

◆ request_gpu()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::request_gpu ( ) const
protected

◆ scaleby_box_l()

template<typename FloatType, Arch Architecture, class FFTConfig>
void CoulombP3MImpl< FloatType, Architecture, FFTConfig >::scaleby_box_l ( )
overrideprotectedvirtual

◆ tune()

Member Data Documentation

◆ m_gpu_data

template<typename FloatType, Arch Architecture, class FFTConfig>
std::shared_ptr<P3MGpuParams> CoulombP3MImpl< FloatType, Architecture, FFTConfig >::m_gpu_data = nullptr
protected

Definition at line 243 of file p3m.impl.hpp.

Referenced by add_long_range_forces_gpu(), and init_gpu_kernels().

◆ p3m


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