![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
#include <dp3m_heffte.hpp>
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 |
Definition at line 166 of file dp3m_heffte.hpp.
| using DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::DipolarP3MStateClass = DipolarP3MState<FloatType, FFTConfig> |
Definition at line 173 of file dp3m_heffte.hpp.
|
overridedefault |
References Utils::ROW_MAJOR.
|
inline |
Definition at line 186 of file dp3m_heffte.hpp.
References Utils::Vector< int, N >::broadcast(), DipolarP3M::DipolarP3M(), dp3m, kokkos_handle, Dipoles::Actor< DipolarP3M >::prefactor, and Dipoles::Actor< DipolarP3M >::set_prefactor().
|
inlineoverridevirtual |
Implements DipolarP3M.
Definition at line 229 of file dp3m_heffte.hpp.
References CPU, and long_range_kernel().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 133 of file dp3m_heffte.impl.hpp.
References calc_average_self_energy_k_space(), comm_cart, dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), grid_influence_function_self_energy(), and Utils::int_pow().
Referenced by calc_average_self_energy_k_space(), and calc_energy_correction().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 1520 of file dp3m_heffte.impl.hpp.
References calc_average_self_energy_k_space(), calc_energy_correction(), dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), and Utils::int_pow().
Referenced by calc_energy_correction(), and long_range_kernel().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 1118 of file dp3m_heffte.impl.hpp.
References calc_influence_function_energy(), dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), grid_influence_function_dipolar(), influence_function_r2c(), and P3M_BRILLOUIN.
Referenced by calc_influence_function_energy(), and scaleby_box_l().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 1093 of file dp3m_heffte.impl.hpp.
References calc_influence_function_force(), dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), grid_influence_function_dipolar(), influence_function_r2c(), and P3M_BRILLOUIN.
Referenced by calc_influence_function_force(), and scaleby_box_l().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 1019 of file dp3m_heffte.impl.hpp.
References comm_cart, dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), Dipoles::Actor< DipolarP3M >::prefactor, and ParticleRange::size().
|
overridevirtual |
Implements DipolarP3M.
Definition at line 101 of file dp3m_heffte.impl.hpp.
References comm_cart, dp3m, and System::Leaf< Actor< DipolarP3M > >::get_system().
|
overridevirtual |
Implements DipolarP3M.
Definition at line 238 of file dp3m_heffte.impl.hpp.
References dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), and Utils::integral_parameter().
Referenced by long_range_kernel(), and long_range_pressure().
|
inlineoverridevirtual |
Implements DipolarP3M.
Definition at line 204 of file dp3m_heffte.hpp.
References CPU, and init_cpu_kernels().
Referenced by tune().
|
protected |
Definition at line 147 of file dp3m_heffte.impl.hpp.
References Utils::Vector< int, N >::broadcast(), comm_cart, communicator, count_magnetic_particles(), dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), Utils::int_pow(), p3m_max_cao, p3m_min_cao, and scaleby_box_l().
Referenced by init().
|
inlinenodiscardoverridevirtualnoexcept |
Implements DipolarP3M.
Definition at line 216 of file dp3m_heffte.hpp.
|
inlinenodiscardoverridevirtualnoexcept |
|
inlinenodiscardoverridevirtualnoexcept |
|
inlineoverridevirtual |
Implements DipolarP3M.
Definition at line 225 of file dp3m_heffte.hpp.
References long_range_kernel().
|
protected |
Compute the k-space part of forces and energies.
Definition at line 496 of file dp3m_heffte.impl.hpp.
References Utils::Vector< int, N >::broadcast(), calc_energy_correction(), comm_cart, dipole_assign(), dp3m, extract_block_into(), for_each_3d(), for_each_3d_order(), System::Leaf< Actor< DipolarP3M > >::get_system(), Utils::int_pow(), Utils::integral_parameter(), p3m_max_cao, p3m_min_cao, pad_with_zeros_discard_imag_into(), Dipoles::Actor< DipolarP3M >::prefactor, Utils::product(), Utils::ROW_MAJOR, Utils::sqr(), and this_node.
Referenced by add_long_range_forces(), and long_range_energy().
|
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().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 1532 of file dp3m_heffte.impl.hpp.
References System::Leaf< Actor< DipolarP3M > >::get_system(), and npt_add_virial_contribution().
Referenced by npt_add_virial_contribution().
|
inlineoverridevirtual |
Implements DipolarP3M.
Definition at line 220 of file dp3m_heffte.hpp.
References DipolarP3M::sanity_checks(), and tune().
|
overrideprotectedvirtual |
Implements DipolarP3M.
Definition at line 1501 of file dp3m_heffte.impl.hpp.
References calc_influence_function_energy(), calc_influence_function_force(), comm_cart, dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), and DipolarP3M::sanity_checks_boxl().
Referenced by init_cpu_kernels().
|
overridevirtual |
Implements DipolarP3M.
Definition at line 1265 of file dp3m_heffte.impl.hpp.
References System::System::box_geo, count_magnetic_particles(), TuningAlgorithm::determine_cao_limits(), DipolarTuningAlgorithm< FloatType, Architecture, FFTConfig >::determine_mesh_limits(), TuningAlgorithm::determine_r_cut_limits(), dp3m, System::Leaf< Actor< DipolarP3M > >::get_system(), init(), is_tuned(), System::System::on_dipoles_change(), Dipoles::Actor< DipolarP3M >::prefactor, DipolarTuningAlgorithm< FloatType, Architecture, FFTConfig >::setup_logger(), and TuningAlgorithm::tune().
Referenced by on_activation().
| DipolarP3MStateClass& DipolarP3MHeffte< FloatType, Architecture, FFTConfig >::dp3m |
Dipolar P3M parameters.
Definition at line 175 of file dp3m_heffte.hpp.
Referenced by calc_average_self_energy_k_space(), calc_energy_correction(), calc_influence_function_energy(), calc_influence_function_force(), calc_surface_term(), count_magnetic_particles(), DipolarP3MHeffte(), dipole_assign(), init_cpu_kernels(), long_range_kernel(), long_range_pressure(), new_dipolar_p3m_impl(), scaleby_box_l(), and tune().