30#include "communication.hpp"
39#include <Kokkos_Core.hpp>
53template <
typename FloatType, Arch Architecture,
class FFTConfig>
class P3MFFT;
60template <
typename FloatType, Arch Architecture,
class FFTConfig>
90 std::array<std::shared_ptr<P3MFFT<FloatType, Arch::CPU, FFTConfig>>, 3>
ffts;
91 std::shared_ptr<P3MFFT<FloatType, Arch::CPU, FFTConfig>>
fft;
92 Kokkos::View<FloatType **, r_space_layout, Kokkos::HostSpace>
98 "CoulombP3MState::rs_charge_density_kokkos", 0, 0);
106template <
typename FloatType, Arch Architecture,
class FFTConfig>
117 std::shared_ptr<KokkosHandle> m_kokkos_handle;
118 std::unique_ptr<CoulombP3MStateClass> p3m_state_ptr;
123 auto constexpr memory_order = CoulombP3MStateClass::memory_order;
138 throw std::domain_error(
"Parameter 'timings' must be > 0");
156 void tune()
override;
159 double square_sum_q)
override {
173 return std::is_same_v<FloatType, double>;
216 using execution_space = Kokkos::DefaultHostExecutionSpace;
217 auto const num_threads = execution_space().concurrency();
238 void kernel_ks_charge_density();
239 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.
double long_range_energy() override
void adapt_epsilon_elc() 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
double long_range_kernel(bool force_flag, bool energy_flag)
Compute the k-space part of forces and energies.
void add_long_range_forces_gpu()
bool is_gpu() const noexcept override
void charge_assign() override
void on_activation() override
~CoulombP3MHeffte() override=default
void count_charged_particles() override
void calc_influence_function_energy() override
Calculate the influence function optimized for the energy and the self energy correction.
CoulombP3MHeffte(std::unique_ptr< CoulombP3MStateClass > &&p3m_state, TuningParameters tuning_params, double prefactor)
CoulombP3MStateClass & p3m
Coulomb P3M parameters.
bool is_tuned() const noexcept override
Utils::Vector9d long_range_pressure() override
void add_long_range_forces() override
bool is_double_precision() const noexcept override
void calc_influence_function_force() override
Calculate the optimal influence function of .
void prepare_fft_mesh(bool reset_weights) override
void scaleby_box_l() override
Base class for the electrostatics P3M algorithm.
Kokkos::DefaultHostExecutionSpace execution_space
Kokkos::View< FloatType **, r_space_layout, Kokkos::HostSpace > rs_charge_density_kokkos
std::array< std::vector< FloatType >, 3 > rs_E_fields_no_halo
electric fields in real-space without halo
std::vector< FloatType > rs_charge_density
charge density in real-space with halo
FFTConfig::r_space_layout r_space_layout
std::array< std::shared_ptr< P3MFFT< FloatType, Arch::CPU, FFTConfig > >, 3 > ffts
Kokkos::HostSpace memory_space
std::vector< ComplexType > ks_charge_density
charge density in k-space without halo
std::array< std::vector< FloatType >, 3 > rs_E_fields
electric fields in real-space with halo
std::shared_ptr< P3MFFT< FloatType, Arch::CPU, FFTConfig > > fft
FFTConfig::k_space_layout k_space_layout
std::array< std::vector< ComplexType >, 3 > ks_E_fields
electric fields in k-space without halo
p3m_interpolation_cache inter_weights
double square_sum_q
square of sum of charges.
std::complex< value_type > ComplexType
std::size_t sum_qpart
number of charged particles.
p3m_send_mesh< FloatType > halo_comm
double sum_q2
Sum of square of charges.
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.
P3MLocalMesh local_mesh
Local mesh geometry information for this MPI rank.
P3MParameters params
P3M base parameters.