ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
DipolarP3M Struct Referenceabstract

Dipolar P3M solver. More...

#include <dp3m.hpp>

+ Inheritance diagram for DipolarP3M:
+ Collaboration diagram for DipolarP3M:

Public Member Functions

 DipolarP3M (P3MParameters const &dp3m_params)
 
virtual ~DipolarP3M ()=default
 
virtual bool is_tuned () const noexcept=0
 
virtual bool is_gpu () const noexcept=0
 
virtual bool is_double_precision () const noexcept=0
 
virtual void on_activation ()=0
 
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 ()
 
virtual void init ()=0
 Recalculate all derived parameters.
 
void sanity_checks () const
 
virtual void count_magnetic_particles ()=0
 Count the number of magnetic particles and calculate the sum of the squared dipole moments.
 
virtual void dipole_assign (ParticleRange const &particles)=0
 Assign the physical dipoles using the tabulated assignment function.
 
virtual void tune ()=0
 Tune dipolar P3M parameters to desired accuracy.
 
virtual double long_range_energy (ParticleRange const &particles)=0
 Compute the k-space part of energies.
 
virtual void add_long_range_forces (ParticleRange const &particles)=0
 Compute the k-space part of forces.
 
ParticleForce pair_force (Particle const &p1, Particle const &p2, Utils::Vector3d const &d, double dist2, double dist) const
 Calculate real-space contribution of p3m dipolar pair forces and torques.
 
double pair_energy (Particle const &p1, Particle const &p2, Utils::Vector3d const &d, double dist2, double dist) 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

P3MParameters const & dp3m_params
 
- Public Attributes inherited from Dipoles::Actor< DipolarP3M >
double prefactor
 Magnetostatics prefactor.
 

Protected Member Functions

virtual double calc_average_self_energy_k_space () const =0
 Calculate self-energy in k-space.
 
virtual void calc_energy_correction ()=0
 Calculate energy correction that minimizes the error.
 
virtual void calc_influence_function_force ()=0
 Calculate the influence function for the dipolar forces and torques.
 
virtual void calc_influence_function_energy ()=0
 Calculate the influence function for the dipolar energy.
 
virtual double calc_surface_term (bool force_flag, bool energy_flag, ParticleRange const &particles)=0
 Compute the dipolar surface terms.
 
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
 
virtual void scaleby_box_l ()=0
 
- Protected Member Functions inherited from System::Leaf< Class >
auto & get_system ()
 
auto & get_system () const
 

Additional Inherited Members

- Protected Attributes inherited from System::Leaf< Class >
std::weak_ptr< Systemm_system
 

Detailed Description

Dipolar P3M solver.

Definition at line 59 of file dp3m.hpp.

Constructor & Destructor Documentation

◆ DipolarP3M()

DipolarP3M::DipolarP3M ( P3MParameters const &  dp3m_params)
inline

Definition at line 63 of file dp3m.hpp.

◆ ~DipolarP3M()

virtual DipolarP3M::~DipolarP3M ( )
virtualdefault

Member Function Documentation

◆ add_long_range_forces()

virtual void DipolarP3M::add_long_range_forces ( ParticleRange const &  particles)
pure virtual

Compute the k-space part of forces.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ calc_average_self_energy_k_space()

virtual double DipolarP3M::calc_average_self_energy_k_space ( ) const
protectedpure virtual

Calculate self-energy in k-space.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ calc_energy_correction()

virtual void DipolarP3M::calc_energy_correction ( )
protectedpure virtual

Calculate energy correction that minimizes the error.

This quantity is only calculated once and is cached.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ calc_influence_function_energy()

virtual void DipolarP3M::calc_influence_function_energy ( )
protectedpure virtual

Calculate the influence function for the dipolar energy.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ calc_influence_function_force()

virtual void DipolarP3M::calc_influence_function_force ( )
protectedpure virtual

Calculate the influence function for the dipolar forces and torques.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ calc_surface_term()

virtual double DipolarP3M::calc_surface_term ( bool  force_flag,
bool  energy_flag,
ParticleRange const &  particles 
)
protectedpure virtual

Compute the dipolar surface terms.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ count_magnetic_particles()

virtual void DipolarP3M::count_magnetic_particles ( )
pure virtual

Count the number of magnetic particles and calculate the sum of the squared dipole moments.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ dipole_assign()

virtual void DipolarP3M::dipole_assign ( ParticleRange const &  particles)
pure virtual

Assign the physical dipoles using the tabulated assignment function.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ init()

virtual void DipolarP3M::init ( )
pure virtual

Recalculate all derived parameters.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

Referenced by on_cell_structure_change().

◆ is_double_precision()

virtual bool DipolarP3M::is_double_precision ( ) const
pure virtualnoexcept

◆ is_gpu()

virtual bool DipolarP3M::is_gpu ( ) const
pure virtualnoexcept

◆ is_tuned()

virtual bool DipolarP3M::is_tuned ( ) const
pure virtualnoexcept

◆ long_range_energy()

virtual double DipolarP3M::long_range_energy ( ParticleRange const &  particles)
pure virtual

Compute the k-space part of energies.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

◆ on_activation()

virtual void DipolarP3M::on_activation ( )
pure virtual

◆ on_boxl_change()

void DipolarP3M::on_boxl_change ( )
inline

Recalculate all box-length-dependent parameters.

Definition at line 73 of file dp3m.hpp.

References scaleby_box_l().

◆ on_cell_structure_change()

void DipolarP3M::on_cell_structure_change ( )
inline

Definition at line 76 of file dp3m.hpp.

References init(), and sanity_checks_cell_structure().

◆ on_node_grid_change()

void DipolarP3M::on_node_grid_change ( ) const
inline

Definition at line 74 of file dp3m.hpp.

References sanity_checks_node_grid().

◆ on_periodicity_change()

void DipolarP3M::on_periodicity_change ( ) const
inline

Definition at line 75 of file dp3m.hpp.

References sanity_checks_periodicity().

◆ pair_energy()

double DipolarP3M::pair_energy ( Particle const &  p1,
Particle const &  p2,
Utils::Vector3d const &  d,
double  dist2,
double  dist 
) const
inline

◆ pair_force()

ParticleForce DipolarP3M::pair_force ( Particle const &  p1,
Particle const &  p2,
Utils::Vector3d const &  d,
double  dist2,
double  dist 
) const
inline

Calculate real-space contribution of p3m dipolar pair forces and torques.

If NPT is compiled in, update the NpT virial.

Definition at line 142 of file dp3m.hpp.

References P3MParameters::accuracy, P3MParameters::alpha, Utils::AS_erfc_part(), Particle::calc_dip(), Particle::dipm(), dp3m_params, npt_add_virial_magnetic_contribution(), Dipoles::Actor< DipolarP3M >::prefactor, P3MParameters::r_cut, Utils::sqr(), and vector_product().

◆ sanity_checks()

void DipolarP3M::sanity_checks ( ) const
inline

◆ sanity_checks_boxl()

void DipolarP3M::sanity_checks_boxl ( ) const
protected

Checks for correctness of the k-space cutoff.

Definition at line 822 of file dp3m.cpp.

References P3MParameters::cao_cut, dp3m_params, and System::Leaf< Class >::get_system().

Referenced by sanity_checks().

◆ sanity_checks_cell_structure()

void DipolarP3M::sanity_checks_cell_structure ( ) const
protected

Definition at line 856 of file dp3m.cpp.

References communicator, System::Leaf< Class >::get_system(), HYBRID, and REGULAR.

Referenced by on_cell_structure_change(), and sanity_checks().

◆ sanity_checks_node_grid()

void DipolarP3M::sanity_checks_node_grid ( ) const
protected

Definition at line 871 of file dp3m.cpp.

References communicator, and Communicator::node_grid.

Referenced by on_node_grid_change(), and sanity_checks().

◆ sanity_checks_periodicity()

void DipolarP3M::sanity_checks_periodicity ( ) const
protected

Definition at line 848 of file dp3m.cpp.

References System::Leaf< Class >::get_system().

Referenced by on_periodicity_change(), and sanity_checks().

◆ scaleby_box_l()

virtual void DipolarP3M::scaleby_box_l ( )
protectedpure virtual

◆ tune()

virtual void DipolarP3M::tune ( )
pure virtual

Tune dipolar P3M parameters to desired accuracy.

The parameters mesh, cao, r_cut_iL and alpha_L are tuned to obtain the target accuracy in optimal time. These parameters are stored in the dp3m_params object.

The function utilizes the analytic expression of the error estimate for the dipolar P3M method in the paper of [9] in order to obtain the rms error in the force for a system of N randomly distributed particles in a cubic box. For the real space error, the estimate in [24] is used.

Parameter ranges if not given explicitly in the constructor:

  • mesh is set up such that the number of mesh points is equal to the number of magnetic dipolar particles
  • cao explores all possible values
  • alpha_L is tuned for each tuple (r_cut_iL, mesh, cao) and calculated assuming that the error contributions of real and reciprocal space should be equal

After checking if the total error lies below the target accuracy, the time needed for one force calculation is measured. Parameters that minimize the runtime are kept.

The function is based on routines of the program HE_Q.cpp for charges written by M. Deserno.

Implemented in DipolarP3MImpl< FloatType, Architecture >.

Member Data Documentation

◆ dp3m_params

P3MParameters const& DipolarP3M::dp3m_params

Definition at line 60 of file dp3m.hpp.

Referenced by pair_energy(), pair_force(), and sanity_checks_boxl().


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