140 double dist2)
const {
146#if USE_ERFC_APPROXIMATION
159 auto const dist2i = 1. / dist2;
181#if USE_ERFC_APPROXIMATION
195 double dist2)
const {
200 auto const dip1 =
p1.calc_dip();
201 auto const dip2 =
p2.calc_dip();
206#if USE_ERFC_APPROXIMATION
218 auto const dist2i = 1. / dist2;
261std::shared_ptr<DipolarP3M>
Vector implementation and trait types for boost qvm interoperability.
double prefactor
Magnetostatics prefactor.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
__device__ void vector_product(float const *a, float const *b, float *out)
std::shared_ptr< DipolarP3M > new_dipolar_p3m_heffte(P3MParameters &&p3m_params, TuningParameters const &tuning_params, double prefactor, bool single_precision, Arch arch)
constexpr T AS_erfc_part(T d)
Approximate by applying a formula from chapter 7.
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Common functions for dipolar and charge P3M.
Arch
P3M kernel architecture.
void sanity_checks_boxl() const
Checks for correctness of the k-space cutoff.
virtual void init()=0
Recalculate all derived parameters.
virtual bool is_gpu() const noexcept=0
void sanity_checks() const
virtual double calc_surface_term(bool force_flag, bool energy_flag)=0
Compute the dipolar surface terms.
virtual void scaleby_box_l()=0
virtual void tune()=0
Tune dipolar P3M parameters to desired accuracy.
virtual void npt_add_virial_contribution(double energy) const =0
Update the NpT virial.
virtual void calc_energy_correction()=0
Calculate energy correction that minimizes the error.
void on_node_grid_change() const
virtual bool is_double_precision() const noexcept=0
void on_boxl_change()
Recalculate all box-length-dependent parameters.
virtual double long_range_energy()=0
Compute the k-space part of energies.
void sanity_checks_cell_structure() const
virtual ~DipolarP3M()=default
P3MParameters const & dp3m_params
double pair_energy(Particle const &p1, Particle const &p2, Utils::Vector3d const &d, double dist, double dist2) const
Calculate real-space contribution of dipolar pair energy.
virtual void on_activation()=0
virtual void calc_influence_function_force()=0
Calculate the influence function for the dipolar forces and torques.
virtual double calc_average_self_energy_k_space() const =0
Calculate self-energy in k-space.
virtual bool is_tuned() const noexcept=0
virtual void add_long_range_forces()=0
Compute the k-space part of forces.
void sanity_checks_periodicity() const
ParticleForce pair_force(double d1d2, Utils::Vector3d const &dip1, Utils::Vector3d const &dip2, Utils::Vector3d const &d, double dist, double dist2) const
Calculate real-space contribution of p3m dipolar pair forces and torques.
DipolarP3M(P3MParameters const &dp3m_params)
void sanity_checks_node_grid() const
void on_periodicity_change() const
virtual void count_magnetic_particles()=0
Count the number of magnetic particles and calculate the sum of the squared dipole moments.
void on_cell_structure_change()
virtual void calc_influence_function_energy()=0
Calculate the influence function for the dipolar energy.
virtual void dipole_assign()=0
Assign the physical dipoles using the tabulated assignment function.
Structure to hold P3M parameters and some dependent variables.
double alpha
unscaled alpha_L for use with fast inline functions only
double accuracy
accuracy of the actual parameter set.
double r_cut
unscaled r_cut_iL for use with fast inline functions only
Force information on a particle.
Struct holding all information for one particle.