24#if defined(P3M) || defined(DP3M)
34#include "communication.hpp"
35#include "system/System.hpp"
65 auto const min_box_l = std::ranges::min(box_geo.length());
73 m_logger->report_fixed_r_cut_iL(r_cut_iL);
91 double r_cut_iL,
double alpha_L) {
94 p3m_params.r_cut = r_cut_iL * box_geo.length()[0];
95 p3m_params.r_cut_iL = r_cut_iL;
97 p3m_params.alpha_L = alpha_L;
98 p3m_params.alpha = alpha_L * box_geo.length_inv()[0];
99 p3m_params.mesh = mesh;
134 auto const min_box_l = std::ranges::min(box_geo.length());
139 m_logger->log_cao_too_large(mesh[0], cao);
156 double r_cut_iL, accuracy;
181 return static_cast<bool>(
veto);
185 auto const r_cut = r_cut_iL * box_geo.length()[0];
static auto constexpr P3M_TUNE_ACCURACY_TOO_LARGE
could not achieve target accuracy
static auto constexpr P3M_RCUT_PREC
Precision threshold for a non-zero real-space cutoff.
static auto constexpr P3M_TUNE_ELC_GAP_SIZE
conflict with ELC gap size
static auto constexpr P3M_TUNE_FFT_MESH_SIZE
conflict with FFT domain decomposition
static auto constexpr P3M_TUNE_CAO_TOO_LARGE
charge assignment order too large for mesh size
std::shared_ptr< LocalBox > local_geo
std::shared_ptr< CellStructure > cell_structure
std::shared_ptr< BoxGeometry > box_geo
double get_m_time(Utils::Vector3i const &mesh, int &tuned_cao, double &tuned_r_cut_iL, double &tuned_alpha_L, double &tuned_accuracy)
Get the optimal alpha and the corresponding computation time for a fixed mesh.
virtual std::optional< std::string > fft_decomposition_veto(Utils::Vector3i const &) const
Veto FFT decomposition in non-cubic boxes.
System::System & m_system
virtual void on_solver_change() const =0
Re-initialize the currently active solver.
double get_mc_time(Utils::Vector3i const &mesh, int cao, double &tuned_r_cut_iL, double &tuned_alpha_L, double &tuned_accuracy)
Get the optimal alpha and the corresponding computation time for a fixed mesh and cao.
virtual std::tuple< double, double, double, double > calculate_accuracy(Utils::Vector3i const &mesh, int cao, double r_cut_iL) const =0
Get the minimal error for this combination of parameters.
void increment_n_trials()
virtual std::optional< std::string > layer_correction_veto_r_cut(double r_cut) const =0
Veto real-space cutoffs larger than the layer correction gap.
void commit(Utils::Vector3i const &mesh, int cao, double r_cut_iL, double alpha_L)
Write tuned parameters to the P3M parameter struct.
void determine_cao_limits(int initial_cao)
Determine a sensible range for the charge assignment order.
void determine_r_cut_limits()
Determine a sensible range for the real-space cutoff.
virtual P3MParameters & get_params()=0
Get the P3M parameters.
std::unique_ptr< TuningLogger > m_logger
static auto constexpr time_granularity
Granularity of the time measurement (milliseconds).
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
This file contains the defaults for ESPResSo.
auto hadamard_division(Vector< T, N > const &a, Vector< U, N > const &b)
Common functions for dipolar and charge P3M.
double r_cut_iL
cutoff radius for real space electrostatics (>0), rescaled to r_cut_iL = r_cut * box_l_i.
int cao
charge assignment order ([0,7]).
double accuracy
accuracy of the actual parameter set.
double benchmark_integration_step(System::System &system, int int_steps)
Benchmark the integration loop.