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

Dipolar all with all and no replica. More...

#include <dipolar_direct_sum.hpp>

+ Inheritance diagram for DipolarDirectSum:
+ Collaboration diagram for DipolarDirectSum:

Public Member Functions

 DipolarDirectSum (double prefactor, int n_replicas)
 
void on_activation () const
 
void on_boxl_change () const
 
void on_node_grid_change () const
 
void on_periodicity_change () const
 
void on_cell_structure_change () const
 
void init () const
 
void sanity_checks () const
 
double long_range_energy (ParticleRange const &particles) const
 Calculate the interaction potential.
 
void add_long_range_forces (ParticleRange const &particles) const
 Calculate and add the interaction forces/torques to the particles.
 
void dipole_field_at_part (ParticleRange const &particles) const
 Calculate total dipole field of each particle.
 
- Public Member Functions inherited from Dipoles::Actor< DipolarDirectSum >
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

int n_replicas
 
- Public Attributes inherited from Dipoles::Actor< DipolarDirectSum >
double prefactor
 Magnetostatics prefactor.
 

Additional Inherited Members

- Protected Member Functions inherited from System::Leaf< Class >
auto & get_system ()
 
auto & get_system () const
 
- Protected Attributes inherited from System::Leaf< Class >
std::weak_ptr< Systemm_system
 

Detailed Description

Dipolar all with all and no replica.

Handling of a system of dipoles where no replicas exist. Assumes minimum image convention for those axis in which the system is periodic.

Definition at line 38 of file dipolar_direct_sum.hpp.

Constructor & Destructor Documentation

◆ DipolarDirectSum()

DipolarDirectSum::DipolarDirectSum ( double  prefactor,
int  n_replicas 
)

Member Function Documentation

◆ add_long_range_forces()

void DipolarDirectSum::add_long_range_forces ( ParticleRange const &  particles) const

Calculate and add the interaction forces/torques to the particles.

This employs a parallel N-square loop over all particle pairs. The computation the partitioned into several steps so that the communication latency can be hidden behinder some local computation:

  1. The local particle positions and momenta are packed into one array.
  2. The asynchronous distribution of the local arrays to all ranks is started.
  3. The interaction for the local pairs is started, here every pair is visited only once, and the force is added to both particles.
  4. Wait for the data from the other nodes.
  5. Calculate the interaction with the rest of the particles. Here every pair is visited twice (not necessarily on the same rank) so that no reduction of the forces is needed.

Logically this is equivalent to the potential calculation in DipolarDirectSum::long_range_energy, which calculates a naive N-square sum, but has better performance and scaling.

Definition at line 289 of file dipolar_direct_sum.cpp.

References ParticleForce::f, for_each_image(), gather_particle_data(), get_n_cut(), System::Leaf< Class >::get_system(), image_sum(), n_replicas, pair_force(), Dipoles::Actor< DipolarDirectSum >::prefactor, and vector_product().

◆ dipole_field_at_part()

void DipolarDirectSum::dipole_field_at_part ( ParticleRange const &  particles) const

Calculate total dipole field of each particle.

This employs a parallel N-square loop over all particles. Logically this is equivalent to the potential calculation in DipolarDirectSum::long_range_energy, which calculates a naive N-square sum. The difference is summation range, and the kernel calculates the dipole field rather than the energy.

Definition at line 417 of file dipolar_direct_sum.cpp.

References Utils::Array< T, N >::begin(), gather_particle_data(), get_n_cut(), System::Leaf< Class >::get_system(), image_sum(), n_replicas, and Dipoles::Actor< DipolarDirectSum >::prefactor.

◆ init()

void DipolarDirectSum::init ( ) const
inline

Definition at line 47 of file dipolar_direct_sum.hpp.

◆ long_range_energy()

double DipolarDirectSum::long_range_energy ( ParticleRange const &  particles) const

Calculate the interaction potential.

This employs a parallel N-square loop over all particle pairs.

Definition at line 379 of file dipolar_direct_sum.cpp.

References gather_particle_data(), get_n_cut(), System::Leaf< Class >::get_system(), image_sum(), n_replicas, and Dipoles::Actor< DipolarDirectSum >::prefactor.

◆ on_activation()

void DipolarDirectSum::on_activation ( ) const
inline

Definition at line 42 of file dipolar_direct_sum.hpp.

◆ on_boxl_change()

void DipolarDirectSum::on_boxl_change ( ) const
inline

Definition at line 43 of file dipolar_direct_sum.hpp.

◆ on_cell_structure_change()

void DipolarDirectSum::on_cell_structure_change ( ) const
inline

Definition at line 46 of file dipolar_direct_sum.hpp.

◆ on_node_grid_change()

void DipolarDirectSum::on_node_grid_change ( ) const
inline

Definition at line 44 of file dipolar_direct_sum.hpp.

◆ on_periodicity_change()

void DipolarDirectSum::on_periodicity_change ( ) const
inline

Definition at line 45 of file dipolar_direct_sum.hpp.

◆ sanity_checks()

void DipolarDirectSum::sanity_checks ( ) const
inline

Definition at line 48 of file dipolar_direct_sum.hpp.

Member Data Documentation

◆ n_replicas

int DipolarDirectSum::n_replicas

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