63 [[nodiscard]]
virtual bool is_tuned() const noexcept = 0;
64 [[nodiscard]] virtual
bool is_gpu() const noexcept = 0;
141 bool skip_cache) = 0;
152 auto const adist = alpha * dist;
153 auto const exp_adist_sq = exp(-adist * adist);
154 auto const dist_sq = dist * dist;
155 auto const two_a_sqrt_pi_i = 2. * alpha * std::numbers::inv_sqrtpi;
156#if USE_ERFC_APPROXIMATION
158 auto const fac = exp_adist_sq * (erfc_part_ri + two_a_sqrt_pi_i) / dist_sq;
160 auto const erfc_part_ri = erfc(adist) / dist;
161 auto const fac = (erfc_part_ri + two_a_sqrt_pi_i * exp_adist_sq) / dist_sq;
173#if USE_ERFC_APPROXIMATION
175 return prefactor * q1q2 * erfc_part_ri * exp(-adist * adist);
177 auto const erfc_part_ri = erfc(adist) / dist;
Vector implementation and trait types for boost qvm interoperability.
double prefactor
Electrostatics prefactor.
void sanity_checks_charge_neutrality() const
This file contains the defaults for ESPResSo.
constexpr T AS_erfc_part(T d)
Approximate by applying a formula from chapter 7.
Common functions for dipolar and charge P3M.
virtual ~CoulombP3M()=default
virtual bool is_gpu() const noexcept=0
void sanity_checks_periodicity() const
void on_cell_structure_change()
virtual void tune()=0
Tune P3M parameters to desired accuracy.
virtual void add_long_range_forces(ParticleRange const &)=0
Compute the k-space part of forces.
virtual void count_charged_particles_elc(int, double, double)=0
CoulombP3M(P3MParameters const &p3m_params)
Utils::Vector3d pair_force(double q1q2, Utils::Vector3d const &d, double dist) const
Calculate real-space contribution of p3m Coulomb pair forces.
void on_boxl_change()
Recalculate all box-length-dependent parameters.
double pair_energy(double q1q2, double dist) const
Calculate real-space contribution of Coulomb pair energy.
void sanity_checks_boxl() const
Checks for correctness of the k-space cutoff.
virtual void prepare_fft_mesh(bool reset_weights)=0
void sanity_checks_cell_structure() const
P3MParameters const & p3m_params
virtual Utils::Vector9d long_range_pressure(ParticleRange const &)=0
Compute the k-space part of the pressure tensor.
virtual void on_activation()=0
void sanity_checks() const
void on_periodicity_change() const
virtual void adapt_epsilon_elc()=0
virtual void calc_influence_function_force()=0
void on_node_grid_change() const
virtual bool is_double_precision() const noexcept=0
virtual bool is_tuned() const noexcept=0
virtual void count_charged_particles()=0
Count the number of charged particles and calculate the sum of the squared charges.
virtual double long_range_energy(ParticleRange const &)=0
Compute the k-space part of energies.
virtual void charge_assign(ParticleRange const &particles)=0
Assign the physical charges using the tabulated charge assignment function.
void sanity_checks_node_grid() const
virtual void assign_charge(double q, Utils::Vector3d const &real_pos, bool skip_cache)=0
Assign a single charge into the current charge grid.
virtual void init()=0
Recalculate all derived parameters.
virtual void scaleby_box_l()=0
virtual void calc_influence_function_energy()=0
Structure to hold P3M parameters and some dependent variables.
double alpha
unscaled alpha_L for use with fast inline functions only
double r_cut
unscaled r_cut_iL for use with fast inline functions only