48#if defined(P3M) or defined(DP3M)
104 auto constexpr value_to_tune = -1.;
107 throw std::domain_error(
"Parameter 'epsilon' must be >= 0");
111 throw std::domain_error(
"Parameter 'accuracy' must be > 0");
118 throw std::domain_error(
"Parameter 'r_cut' must be > 0");
126 throw std::domain_error(
"Parameter 'alpha' must be > 0");
133 throw std::domain_error(
"Parameter 'mesh' must be > 0");
141 throw std::domain_error(
"Parameter 'mesh_off' must be >= 0 and <= 1");
145 if ((cao < 1 or cao > 7) and (not
tuning or
cao != -1)) {
146 throw std::domain_error(
"Parameter 'cao' must be >= 1 and <= 7");
150 throw std::domain_error(
"Parameter 'cao' cannot be larger than 'mesh'");
207 for (
auto i = 0u; i < 3u; i++) {
217 LocalBox const &local_geo,
double skin,
250 std::array<std::vector<int>, 3> ret{};
252 for (
auto i = 0u; i < 3u; ++i) {
253 ret[i] = std::vector<int>(
static_cast<std::size_t
>(mesh_size[i]));
255 for (
int j = 1; j <= mesh_size[i] / 2; j++) {
257 ret[i][mesh_size[i] - j] = -j;
259 if (zero_out_midpoint)
260 ret[i][mesh_size[i] / 2] = 0;
Vector implementation and trait types for boost qvm interoperability.
static DEVICE_QUALIFIER constexpr Vector< T, N > broadcast(typename Base::value_type const &value)
Create a vector that has all entries set to the same value.
This file contains the defaults for ESPResSo.
#define P3M_MESHOFF
P3M: Default for offset of first mesh point from the origin (left down corner of the simulation box).
auto hadamard_division(Vector< T, N > const &a, Vector< U, N > const &b)
auto hadamard_product(Vector< T, N > const &a, Vector< U, N > const &b)
Arch
P3M kernel architecture.
std::array< std::vector< int >, 3 > calc_p3m_mesh_shift(Utils::Vector3i const &mesh_size, bool zero_out_midpoint=false)
Calculate indices that shift P3MParameters::mesh by mesh/2.
auto constexpr P3M_EPSILON_METALLIC
This value indicates metallic boundary conditions.
static SteepestDescentParameters params
Currently active steepest descent instance.
std::array< std::span< FloatType >, 3 > rs_fields
real-space vector meshes for the electric or dipolar field.
int ks_pnum
number of permutations in k_space
Utils::Vector3i start
Indices of the lower left corner of the local mesh grid.
std::span< FloatType > rs_scalar
real-space scalar mesh for charge assignment and FFT.
Utils::Vector3i stop
Indices of the upper right corner of the local mesh grid.
Utils::Vector3i size
Extents of the local mesh grid.
Properties of the local mesh.
Utils::Vector3i dim
dimension (size) of local mesh.
int in_ur[3]
inner up right grid point + (1,1,1)
int size
number of local mesh points.
void recalc_ld_pos(P3MParameters const ¶ms)
Recalculate quantities derived from the mesh and box length: ld_pos (position of the left down mesh).
void calc_local_ca_mesh(P3MParameters const ¶ms, LocalBox const &local_geo, double skin, double space_layer)
Calculate properties of the local FFT mesh for the charge assignment process.
int in_ld[3]
inner left down grid point
int r_margin[6]
number of margin mesh points from neighbour nodes
int margin[6]
number of margin mesh points.
int q_2_off
offset between mesh lines of the last dimension
double ld_pos[3]
position of the first local mesh point.
int inner[3]
dimension of mesh inside node domain.
int ld_ind[3]
index of lower left corner of the local mesh in the global mesh.
int q_21_off
offset between mesh lines of the two last dimensions
Structure to hold P3M parameters and some dependent variables.
auto calc_grid_pos(Utils::Vector3d const &pos) const
Convert spatial position to grid position.
Utils::Vector3d cao_cut
cutoff for charge assignment.
double alpha
unscaled alpha_L for use with fast inline functions only
P3MParameters(bool tuning, double epsilon, double r_cut, Utils::Vector3i const &mesh, Utils::Vector3d const &mesh_off, int cao, double alpha, double accuracy)
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 alpha_L
Ewald splitting parameter (0.
int cao3
number of points unto which a single charge is interpolated, i.e.
Utils::Vector3d mesh_off
offset of the first mesh point (lower left corner) from the coordinate origin ([0,...
Utils::Vector3d ai
inverse mesh constant.
double r_cut
unscaled r_cut_iL for use with fast inline functions only
void recalc_a_ai_cao_cut(Utils::Vector3d const &box_l)
Recalculate quantities derived from the mesh and box length: a, ai and cao_cut.
bool tuning
tuning or production?
Utils::Vector3i mesh
number of mesh points per coordinate direction (>0), in real space.
double epsilon
epsilon of the "surrounding dielectric".
Utils::Vector3d a
mesh constant.