31#include "communication.hpp"
40#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
41#include <Kokkos_Core.hpp>
54template <
typename FloatType,
class FFTConfig>
class P3MFFT;
61template <
typename FloatType,
class FFTConfig>
87 std::shared_ptr<P3MFFT<FloatType, FFTConfig>>
fft;
88#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
95 "CoulombP3MState::rs_charge_density_kokkos", 0, 0);
104template <
typename FloatType, Arch Architecture,
class FFTConfig>
113#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
115 std::shared_ptr<KokkosHandle> m_kokkos_handle;
117 std::unique_ptr<CoulombP3MStateClass> p3m_state_ptr;
122 auto constexpr memory_order = CoulombP3MStateClass::memory_order;
139 throw std::domain_error(
"Parameter 'timings' must be > 0");
144#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
159 void tune()
override;
162 double square_sum_q)
override {
176 return std::is_same_v<FloatType, double>;
221#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
246 void kernel_ks_charge_density();
247 void kernel_rs_electric_field();
Vector implementation and trait types for boost qvm interoperability.
void set_prefactor(double new_prefactor)
double prefactor
Electrostatics prefactor.
Cache for interpolation weights.
void reset(int cao)
Reset the cache.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
std::shared_ptr< KokkosHandle > kokkos_handle
Common functions for dipolar and charge P3M.
auto constexpr P3M_EPSILON_METALLIC
This value indicates metallic boundary conditions.
P3M algorithm for long-range Coulomb interaction.
static SteepestDescentParameters params
Currently active steepest descent instance.
void adapt_epsilon_elc() override
void charge_assign(ParticleRange const &particles) override
void count_charged_particles_elc(std::size_t n, double sum_q2, double square_sum_q) override
std::shared_ptr< P3MGpuParams > m_gpu_data
void assign_charge(double q, Utils::Vector3d const &real_pos, bool skip_cache) override
bool is_gpu() const noexcept override
double long_range_kernel(bool force_flag, bool energy_flag, ParticleRange const &particles)
Compute the k-space part of forces and energies.
void on_activation() override
~CoulombP3MHeffte() override=default
void count_charged_particles() override
double long_range_energy(ParticleRange const &particles) override
void calc_influence_function_energy() override
Calculate the influence function optimized for the energy and the self energy correction.
void add_long_range_forces(ParticleRange const &particles) override
CoulombP3MHeffte(std::unique_ptr< CoulombP3MStateClass > &&p3m_state, TuningParameters tuning_params, double prefactor)
CoulombP3MStateClass & p3m
Coulomb P3M parameters.
bool is_tuned() const noexcept override
bool is_double_precision() const noexcept override
void calc_influence_function_force() override
Calculate the optimal influence function of .
void add_long_range_forces_gpu(ParticleRange const &particles)
Utils::Vector9d long_range_pressure(ParticleRange const &particles) override
void prepare_fft_mesh(bool reset_weights) override
void scaleby_box_l() override
Base class for the electrostatics P3M algorithm.
std::size_t sum_qpart
number of charged particles.
std::array< std::vector< FloatType >, 3 > rs_E_fields_no_halo
electric fields in real-space without halo
std::complex< value_type > ComplexType
std::array< std::vector< FloatType >, 3 > rs_E_fields
electric fields in real-space with halo
double square_sum_q
square of sum of charges.
Kokkos::View< FloatType **, Kokkos::LayoutRight, Kokkos::HostSpace > rs_charge_density_kokkos
std::vector< FloatType > rs_charge_density
charge density in real-space with halo
std::shared_ptr< P3MFFT< FloatType, FFTConfig > > fft
p3m_send_mesh< FloatType > halo_comm
double sum_q2
Sum of square of charges.
std::vector< ComplexType > ks_charge_density
charge density in k-space without halo
std::array< std::vector< ComplexType >, 3 > ks_E_fields
electric fields in k-space without halo
p3m_interpolation_cache inter_weights
void sanity_checks() const
std::size_t size
number of local mesh points including halo layers.
int cao
charge assignment order ([0,7]).
bool tuning
tuning or production?
double epsilon
epsilon of the "surrounding dielectric".
State of the p3m methods, the part which applies to both, electrostatic and dipolar p3m.
P3MParameters params
P3M base parameters.
P3MLocalMesh local_mesh
Local mesh geometry information for this MPI rank.