ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
DipolarP3MHeffte< FloatType, Architecture, FFTConfig > Struct Template Reference

#include <dp3m_heffte.hpp>

Inheritance diagram for DipolarP3MHeffte< FloatType, Architecture, FFTConfig >:
Collaboration diagram for DipolarP3MHeffte< FloatType, Architecture, FFTConfig >:

Public Types

using DipolarP3MStateClass = DipolarP3MState<FloatType, FFTConfig>

Public Member Functions

 ~DipolarP3MHeffte () override=default
 DipolarP3MHeffte (std::unique_ptr< DipolarP3MStateClass > &&dp3m_state, TuningParameters tuning_params, double prefactor)
void init () override
void tune () override
void count_magnetic_particles () override
bool is_tuned () const noexcept override
bool is_gpu () const noexcept override
bool is_double_precision () const noexcept override
void on_activation () override
double long_range_energy () override
Utils::Vector9d long_range_pressure () override
 Reciprocal-space virial for the dipolar Ewald/P3M sum.
void add_long_range_forces () override
void dipole_assign () override
Public Member Functions inherited from DipolarP3M
 DipolarP3M (P3MParameters const &dp3m_params)
virtual ~DipolarP3M ()=default
void on_boxl_change ()
 Recalculate all box-length-dependent parameters.
void on_node_grid_change () const
void on_periodicity_change () const
void on_cell_structure_change ()
void sanity_checks () const
ParticleForce pair_force (double d1d2, Utils::Vector3d const &dip1, Utils::Vector3d const &dip2, Utils::Vector3d &dip_fld_p1, Utils::Vector3d &dip_fld_p2, Utils::Vector3d const &d, double dist, double dist2) const
 Calculate real-space contribution of p3m dipolar pair forces and torques.
double pair_energy (Utils::Vector3d const &dip1, Utils::Vector3d const &dip2, Utils::Vector3d const &d, double dist, double dist2) const
 Calculate real-space contribution of dipolar pair energy.
Public Member Functions inherited from Dipoles::Actor< DipolarP3M >
void set_prefactor (double new_prefactor)
Public Member Functions inherited from System::Leaf< Actor< DipolarP3M > >
void bind_system (std::shared_ptr< System > const &system)
void detach_system (std::shared_ptr< System > const &system)

Public Attributes

DipolarP3MStateClass & dp3m
 Dipolar P3M parameters.
Public Attributes inherited from DipolarP3M
P3MParameters const & dp3m_params
Public Attributes inherited from Dipoles::Actor< DipolarP3M >
double prefactor
 Magnetostatics prefactor.

Protected Member Functions

double long_range_kernel (bool force_flag, bool energy_flag)
 Compute the k-space part of forces and energies.
double calc_average_self_energy_k_space () const override
void calc_energy_correction () override
void calc_influence_function_force () override
void calc_influence_function_energy () override
double calc_surface_term (bool force_flag, bool energy_flag) override
void init_cpu_kernels ()
void scaleby_box_l () override
void npt_add_virial_contribution (double virial) const override
Protected Member Functions inherited from DipolarP3M
void sanity_checks_boxl () const
 Checks for correctness of the k-space cutoff.
void sanity_checks_node_grid () const
void sanity_checks_periodicity () const
void sanity_checks_cell_structure () const
Protected Member Functions inherited from System::Leaf< Actor< DipolarP3M > >
auto & get_system ()

Additional Inherited Members

Protected Attributes inherited from System::Leaf< Actor< DipolarP3M > >
std::weak_ptr< System > m_system

Detailed Description

template<typename FloatType, Arch Architecture, class FFTConfig>
struct DipolarP3MHeffte< FloatType, Architecture, FFTConfig >

Definition at line 166 of file dp3m_heffte.hpp.

Member Typedef Documentation

◆ DipolarP3MStateClass

template<typename FloatType, Arch Architecture, class FFTConfig>
using DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::DipolarP3MStateClass = DipolarP3MState<FloatType, FFTConfig>

Definition at line 173 of file dp3m_heffte.hpp.

Constructor & Destructor Documentation

◆ ~DipolarP3MHeffte()

template<typename FloatType, Arch Architecture, class FFTConfig>
DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::~DipolarP3MHeffte ( )
overridedefault

References Utils::ROW_MAJOR.

◆ DipolarP3MHeffte()

template<typename FloatType, Arch Architecture, class FFTConfig>
DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::DipolarP3MHeffte ( std::unique_ptr< DipolarP3MStateClass > && dp3m_state,
TuningParameters tuning_params,
double prefactor )
inline

Member Function Documentation

◆ add_long_range_forces()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::add_long_range_forces ( )
inlineoverridevirtual

Implements DipolarP3M.

Definition at line 229 of file dp3m_heffte.hpp.

References CPU, and long_range_kernel().

◆ calc_average_self_energy_k_space()

template<typename FloatType, Arch Architecture, class FFTConfig>
double DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::calc_average_self_energy_k_space ( ) const
overrideprotectedvirtual

◆ calc_energy_correction()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::calc_energy_correction ( )
overrideprotectedvirtual

◆ calc_influence_function_energy()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::calc_influence_function_energy ( )
overrideprotectedvirtual

◆ calc_influence_function_force()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::calc_influence_function_force ( )
overrideprotectedvirtual

◆ calc_surface_term()

template<typename FloatType, Arch Architecture, class FFTConfig>
double DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::calc_surface_term ( bool force_flag,
bool energy_flag )
overrideprotectedvirtual

◆ count_magnetic_particles()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::count_magnetic_particles ( )
overridevirtual

Implements DipolarP3M.

Definition at line 101 of file dp3m_heffte.impl.hpp.

References comm_cart, dp3m, and System::Leaf< Actor< DipolarP3M > >::get_system().

◆ dipole_assign()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::dipole_assign ( )
overridevirtual

◆ init()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::init ( )
inlineoverridevirtual

Implements DipolarP3M.

Definition at line 204 of file dp3m_heffte.hpp.

References CPU, and init_cpu_kernels().

Referenced by tune().

◆ init_cpu_kernels()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::init_cpu_kernels ( )
protected

◆ is_double_precision()

template<typename FloatType, Arch Architecture, class FFTConfig>
bool DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::is_double_precision ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements DipolarP3M.

Definition at line 216 of file dp3m_heffte.hpp.

◆ is_gpu()

template<typename FloatType, Arch Architecture, class FFTConfig>
bool DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::is_gpu ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements DipolarP3M.

Definition at line 213 of file dp3m_heffte.hpp.

References CPU.

◆ is_tuned()

template<typename FloatType, Arch Architecture, class FFTConfig>
bool DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::is_tuned ( ) const
inlinenodiscardoverridevirtualnoexcept

Implements DipolarP3M.

Definition at line 212 of file dp3m_heffte.hpp.

Referenced by tune().

◆ long_range_energy()

template<typename FloatType, Arch Architecture, class FFTConfig>
double DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::long_range_energy ( )
inlineoverridevirtual

Implements DipolarP3M.

Definition at line 225 of file dp3m_heffte.hpp.

References long_range_kernel().

◆ long_range_kernel()

template<typename FloatType, Arch Architecture, class FFTConfig>
double DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::long_range_kernel ( bool force_flag,
bool energy_flag )
protected

◆ long_range_pressure()

template<typename FloatType, Arch Architecture, class FFTConfig>
Utils::Vector9d DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::long_range_pressure ( )
overridevirtual

Reciprocal-space virial for the dipolar Ewald/P3M sum.

Obtained via the same Nose-Klein strain-derivative method used for the Coulomb case ([19] eq. (2.7), \(\Pi_{\textrm{rec}, \alpha, \beta}\)), applied to the dipolar structure factor \(Q(\vec k) = \vec M(\vec k)\cdot\vec k\) with \(\vec M(\vec k) = \sum_j \vec \mu_j \exp(i\vec k\cdot\vec r_j)\). Unlike the charge structure factor, \(Q(\vec k)\) depends on \(\vec k\) explicitly (not only through the phase factor), which produces an extra cross term beyond the charge-case \(k_a k_b\) envelope. This cross term is generally asymmetric in \((a,b)\): its symmetric half, \(k_a\Re[M_b Q^*] + k_b\Re[M_a Q^*]\), is the dipole-dipole reciprocal-space pressure tensor eq. (46) in [2] (their \(\vec h\), \(\kappa\) correspond to \(\vec k\), \(\alpha\) here), which only ever reports that symmetrized form. The remaining antisymmetric half is not in that reference – it is the reciprocal-space image of the same dipole-dipole torque that already makes the real-space virial asymmetric (see DipolarDirectSum::long_range_pressure and DipolarP3M::pair_force), derived here by differentiating the reciprocal energy directly (via the strain parametrization \(H(\varepsilon)=LI+\varepsilon E_{ab}\)) instead of presupposing a symmetric result.

Care is needed with the index convention: probing the strain component \(\varepsilon_{ab}\) (i.e. \(H(\varepsilon)=LI+\varepsilon E_{ab}\)) yields \(-\partial U/\partial\varepsilon_{ab} = r_b F_a\) for a pair separation \(\vec r\) and force \(\vec F\) – the transpose of the \(r_a F_b\) (d (x) f) convention used by the real-space term and by DipolarDirectSum::long_range_pressure. Concretely, differentiating \(Q(\vec k)=\vec k\cdot\vec M\) gives a cross-term contribution to \(-\partial U/\partial\varepsilon_{ab}\) proportional to \(k_a\Re[M_bQ^*]\); to match the \(r_aF_b\) convention, this must be stored as the \((b,a)\) tensor component, i.e. \(\Pi_{ab}\) gets cross term \(2k_b\Re[M_aQ^*]\) (indices swapped relative to the strain probe that produced it).

Implements DipolarP3M.

Definition at line 398 of file dp3m_heffte.impl.hpp.

References Utils::Vector< int, N >::broadcast(), dipole_assign(), dp3m, for_each_3d(), System::Leaf< Actor< DipolarP3M > >::get_system(), Dipoles::Actor< DipolarP3M >::prefactor, Utils::product(), and Utils::sqr().

◆ npt_add_virial_contribution()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::npt_add_virial_contribution ( double virial) const
overrideprotectedvirtual

◆ on_activation()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::on_activation ( )
inlineoverridevirtual

Implements DipolarP3M.

Definition at line 220 of file dp3m_heffte.hpp.

References DipolarP3M::sanity_checks(), and tune().

◆ scaleby_box_l()

template<typename FloatType, Arch Architecture, class FFTConfig>
void DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::scaleby_box_l ( )
overrideprotectedvirtual

◆ tune()

Member Data Documentation

◆ dp3m


The documentation for this struct was generated from the following files: