ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
dp3m.cpp File Reference

P3M algorithm for long-range magnetic dipole-dipole interaction. More...

#include "config/config.hpp"
#include "magnetostatics/dp3m.hpp"
#include "magnetostatics/dp3m.impl.hpp"
#include "fft/fft.hpp"
#include "p3m/TuningAlgorithm.hpp"
#include "p3m/TuningLogger.hpp"
#include "p3m/common.hpp"
#include "p3m/influence_function_dipolar.hpp"
#include "p3m/interpolation.hpp"
#include "p3m/math.hpp"
#include "BoxGeometry.hpp"
#include "LocalBox.hpp"
#include "Particle.hpp"
#include "ParticleRange.hpp"
#include "PropagationMode.hpp"
#include "cell_system/CellStructure.hpp"
#include "cell_system/CellStructureType.hpp"
#include "communication.hpp"
#include "errorhandling.hpp"
#include "integrators/Propagation.hpp"
#include "npt.hpp"
#include "system/System.hpp"
#include "tuning.hpp"
#include <utils/Vector.hpp>
#include <utils/integral_parameter.hpp>
#include <utils/math/int_pow.hpp>
#include <utils/math/sqr.hpp>
#include <boost/mpi/collectives/all_reduce.hpp>
#include <boost/mpi/collectives/reduce.hpp>
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdio>
#include <functional>
#include <iterator>
#include <numbers>
#include <optional>
#include <span>
#include <sstream>
#include <stdexcept>
#include <tuple>
#include <vector>
+ Include dependency graph for dp3m.cpp:

Go to the source code of this file.

Classes

struct  anonymous_namespace{dp3m.cpp}::AssignDipole< cao >
 
struct  anonymous_namespace{dp3m.cpp}::AssignTorques< cao >
 
struct  anonymous_namespace{dp3m.cpp}::AssignForces< cao >
 
class  DipolarTuningAlgorithm< FloatType, Architecture >
 

Namespaces

namespace  anonymous_namespace{dp3m.cpp}
 

Functions

static double dp3m_k_space_error (double box_size, int mesh, int cao, int n_c_part, double sum_q2, double alpha_L)
 Calculate the k-space error of dipolar-P3M.
 
static double dp3m_real_space_error (double box_size, double r_cut_iL, int n_c_part, double sum_q2, double alpha_L)
 Calculate the value of the errors for the REAL part of the force in terms of the splitting parameter alpha of Ewald.
 
double dp3m_rtbisection (double box_size, double r_cut_iL, int n_c_part, double sum_q2, double x1, double x2, double xacc, double tuned_accuracy)
 Compute the value of alpha through a bisection method.
 
static auto dp3m_tune_aliasing_sums (Utils::Vector3i const &shift, int mesh, double mesh_i, int cao, double alpha_L_i)
 Tuning dipolar-P3M.
 
void npt_add_virial_magnetic_contribution (double energy)
 Update the NpT virial.
 

Detailed Description

P3M algorithm for long-range magnetic dipole-dipole interaction.

By default the magnetic epsilon is metallic = 0.

Definition in file dp3m.cpp.

Function Documentation

◆ dp3m_k_space_error()

static double dp3m_k_space_error ( double  box_size,
int  mesh,
int  cao,
int  n_c_part,
double  sum_q2,
double  alpha_L 
)
static

◆ dp3m_real_space_error()

static double dp3m_real_space_error ( double  box_size,
double  r_cut_iL,
int  n_c_part,
double  sum_q2,
double  alpha_L 
)
static

Calculate the value of the errors for the REAL part of the force in terms of the splitting parameter alpha of Ewald.

Based on eq. (33) [44].

Please note that in this more refined approach we don't use eq. (37), but eq. (33) which maintains all the powers in alpha.

Definition at line 757 of file dp3m.cpp.

References Utils::sqr().

Referenced by DipolarTuningAlgorithm< FloatType, Architecture >::calculate_accuracy(), and dp3m_rtbisection().

◆ dp3m_rtbisection()

double dp3m_rtbisection ( double  box_size,
double  r_cut_iL,
int  n_c_part,
double  sum_q2,
double  x1,
double  x2,
double  xacc,
double  tuned_accuracy 
)

Compute the value of alpha through a bisection method.

Using bisection, find the root of a function "func-tuned_accuracy/sqrt(2.)" known to lie between x1 and x2.

Based on eq. (33) [44].

The root, returned as rtbis, will be refined until its accuracy is \(\pm\) xacc.

Definition at line 789 of file dp3m.cpp.

References dp3m_real_space_error().

Referenced by DipolarTuningAlgorithm< FloatType, Architecture >::calculate_accuracy().

◆ dp3m_tune_aliasing_sums()

static auto dp3m_tune_aliasing_sums ( Utils::Vector3i const &  shift,
int  mesh,
double  mesh_i,
int  cao,
double  alpha_L_i 
)
static

Tuning dipolar-P3M.

Definition at line 684 of file dp3m.cpp.

References Utils::Vector< T, N >::broadcast(), for_each_3d(), P3M_BRILLOUIN, Utils::product(), math::sinc(), and Utils::sqr().

Referenced by dp3m_k_space_error().

◆ npt_add_virial_magnetic_contribution()

void npt_add_virial_magnetic_contribution ( double  energy)

Update the NpT virial.

Definition at line 903 of file dp3m.cpp.

References npt_add_virial_contribution().

Referenced by DipolarP3M::pair_force().