ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
#include "config/config.hpp"
#include "magnetostatics/dipolar_direct_sum.hpp"
#include "BoxGeometry.hpp"
#include "cells.hpp"
#include "communication.hpp"
#include "errorhandling.hpp"
#include "system/System.hpp"
#include <utils/cartesian_product.hpp>
#include <utils/math/sqr.hpp>
#include <utils/mpi/iall_gatherv.hpp>
#include <boost/mpi/collectives.hpp>
#include <boost/mpi/communicator.hpp>
#include <mpi.h>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iterator>
#include <ranges>
#include <stdexcept>
#include <tuple>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | PosMom |
Position and dipole moment of one particle. More... | |
Functions | |
static auto | pair_force (Utils::Vector3d const &d, Utils::Vector3d const &m1, Utils::Vector3d const &m2) |
Pair force of two interacting dipoles. | |
static auto | pair_potential (Utils::Vector3d const &d, Utils::Vector3d const &m1, Utils::Vector3d const &m2) |
Pair potential for two interacting dipoles. | |
static auto | dipole_field (Utils::Vector3d const &d, Utils::Vector3d const &m1) |
Dipole field contribution from a particle with dipole moment m1 at a distance d . | |
template<typename F > | |
void | for_each_image (Utils::Vector3i const &ncut, F f) |
Call kernel for every 3d index in a sphere around the origin. | |
template<class InputIterator , class T , class F > | |
T | image_sum (InputIterator begin, InputIterator end, InputIterator it, bool with_replicas, Utils::Vector3i const &ncut, BoxGeometry const &box_geo, T init, F f) |
Sum over all pairs with periodic images. | |
static auto | gather_particle_data (BoxGeometry const &box_geo, ParticleRange const &particles) |
static auto | get_n_cut (BoxGeometry const &box_geo, int n_replicas) |
|
static |
Dipole field contribution from a particle with dipole moment m1
at a distance d
.
d | Distance vector. |
m1 | Dipole moment of one particle. |
Definition at line 115 of file dipolar_direct_sum.cpp.
void for_each_image | ( | Utils::Vector3i const & | ncut, |
F | f | ||
) |
Call kernel for every 3d index in a sphere around the origin.
This calls a callable for all index-triples that are within ball around the origin with radius |ncut|.
F | Callable |
ncut | Limits in the three directions, all non-zero elements have to be the same number. |
f | will be called for each index triple within the limits of ncut . |
Definition at line 139 of file dipolar_direct_sum.cpp.
References Utils::cartesian_product(), and Utils::Vector< T, N >::norm2().
Referenced by DipolarDirectSum::add_long_range_forces(), and image_sum().
|
static |
Definition at line 221 of file dipolar_direct_sum.cpp.
References comm_cart, BoxGeometry::folded_position(), Utils::Mpi::iall_gatherv(), and ParticleRange::size().
Referenced by DipolarDirectSum::add_long_range_forces(), DipolarDirectSum::dipole_field_at_part(), and DipolarDirectSum::long_range_energy().
|
static |
Definition at line 261 of file dipolar_direct_sum.cpp.
References BoxGeometry::periodic().
Referenced by DipolarDirectSum::add_long_range_forces(), DipolarDirectSum::dipole_field_at_part(), and DipolarDirectSum::long_range_energy().
T image_sum | ( | InputIterator | begin, |
InputIterator | end, | ||
InputIterator | it, | ||
bool | with_replicas, | ||
Utils::Vector3i const & | ncut, | ||
BoxGeometry const & | box_geo, | ||
T | init, | ||
F | f | ||
) |
Sum over all pairs with periodic images.
This implements the "primed" pair sum, the sum over all pairs between one particles and all other particles, including ncut
periodic replicas in each direction. Primed means that in the primary replica the self-interaction is excluded, but not with the other periodic replicas. E.g. a particle does not interact with its self, but does with its periodically shifted versions.
begin | Iterator pointing to begin of particle range |
end | Iterator pointing past the end of particle range |
it | Pointer to particle that is considered |
with_replicas | If periodic replicas are to be considered at all. If false, distances are calculated as Euclidean distances, and not using minimum image convention. |
ncut | Number of replicas in each direction. |
box_geo | Box geometry. |
init | Initial value of the sum. |
f | Binary operation mapping distance and moment of the interaction partner to the value to be summed up for this pair. |
Definition at line 197 of file dipolar_direct_sum.cpp.
References for_each_image(), BoxGeometry::get_mi_vector(), and BoxGeometry::length().
Referenced by DipolarDirectSum::add_long_range_forces(), DipolarDirectSum::dipole_field_at_part(), and DipolarDirectSum::long_range_energy().
|
static |
Pair force of two interacting dipoles.
d | Distance vector. |
m1 | Dipole moment of one particle. |
m2 | Dipole moment of the other particle. |
Definition at line 62 of file dipolar_direct_sum.cpp.
References Utils::Vector< T, N >::norm2(), and vector_product().
Referenced by DipolarDirectSum::add_long_range_forces().
|
static |
Pair potential for two interacting dipoles.
d | Distance vector. |
m1 | Dipole moment of one particle. |
m2 | Dipole moment of the other particle. |
Definition at line 92 of file dipolar_direct_sum.cpp.