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< Class >
void bind_system (std::shared_ptr< System > const &system)
 
void detach_system (std::shared_ptr< System > const &system)
 

Public Attributes

DipolarP3MStateClassdp3m
 Dipolar P3M parameters.
 
- Public Attributes inherited from DipolarP3M
P3MParameters constdp3m_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< Class >
autoget_system ()
 
autoget_system () const
 

Additional Inherited Members

- Protected Attributes inherited from System::Leaf< Class >
std::weak_ptr< Systemm_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

◆ DipolarP3MHeffte()

Member Function Documentation

◆ add_long_range_forces()

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

◆ 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

Implements DipolarP3M.

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

References System::System::box_geo, comm_cart, and stream.

◆ calc_energy_correction()

◆ 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

Implements DipolarP3M.

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

References comm_cart, ParticleRange::size(), and stream.

◆ 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 System::System::cell_structure, comm_cart, and stream.

◆ dipole_assign()

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

Implements DipolarP3M.

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

◆ init()

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

◆ init_cpu_kernels()

◆ is_double_precision()

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

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
inlineoverridevirtualnoexcept

Implements DipolarP3M.

Definition at line 213 of file dp3m_heffte.hpp.

References CPU, and stream.

◆ is_tuned()

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

Implements DipolarP3M.

Definition at line 212 of file dp3m_heffte.hpp.

◆ long_range_energy()

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

◆ long_range_kernel()

◆ 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 391 of file dp3m_heffte.impl.hpp.

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

◆ npt_add_virial_contribution()

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

Implements DipolarP3M.

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

References System::System::npt_add_virial_contribution(), and stream.

◆ on_activation()

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

◆ scaleby_box_l()

◆ tune()

Member Data Documentation

◆ dp3m

template<typename FloatType , Arch Architecture, class FFTConfig >
DipolarP3MStateClass& DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::dp3m

Dipolar P3M parameters.

Definition at line 175 of file dp3m_heffte.hpp.

Referenced by DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::DipolarP3MHeffte().


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