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

#include <BoxGeometry.hpp>

Public Member Functions

 BoxGeometry ()
 
 BoxGeometry (BoxGeometry const &rhs)
 
void set_periodic (unsigned coord, bool val)
 Set periodicity for direction.
 
constexpr bool periodic (unsigned coord) const
 Check periodicity in direction.
 
Utils::Vector3d const & length () const
 Box length.
 
Utils::Vector3d const & length_inv () const
 Inverse box length.
 
Utils::Vector3d const & length_half () const
 Half box length.
 
void set_length (Utils::Vector3d const &box_l)
 Set box side lengths.
 
double volume () const
 Box volume.
 
template<std::floating_point T>
get_mi_coord (T a, T b, unsigned coord) const noexcept
 Get the minimum-image distance between two coordinates.
 
auto cuboid_minimum_image () const
 Cuboid minimum-image fold parameters for hoisting into kernels.
 
template<std::floating_point T>
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3< T > get_mi_vector (Utils::Vector3< T > const &a, Utils::Vector3< T > const &b) const noexcept
 Get the minimum-image vector between two coordinates.
 
template<std::floating_point T>
ESPRESSO_ATTR_ALWAYS_INLINEget_mi_dist2 (Utils::Vector3< T > const &a, Utils::Vector3< T > const &b) const noexcept
 Get the squared minimum-image distance between two coordinates.
 
template<std::floating_point T>
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3< T > get_mi_vector (T const &a0, T const &a1, T const &a2, T const &b0, T const &b1, T const &b2) const noexcept
 Get the minimum-image vector between two coordinates.
 
BoxType type () const
 
void set_type (BoxType type)
 
LeesEdwardsBC const & lees_edwards_bc () const
 
void set_lees_edwards_bc (LeesEdwardsBC bc)
 
void lees_edwards_update (double pos_offset, double shear_velocity)
 Update the Lees-Edwards parameters of the box geometry for the current simulation time.
 
Utils::Vector3d velocity_difference (Utils::Vector3d const &x, Utils::Vector3d const &y, Utils::Vector3d const &u, Utils::Vector3d const &v) const noexcept
 Calculate the velocity difference including the Lees-Edwards velocity.
 
void fold_position (Utils::Vector3d &pos, Utils::Vector3i &image_box) const
 Fold coordinates to primary simulation box in-place.
 
auto folded_position (Utils::Vector3d const &pos) const noexcept
 Calculate coordinates folded to primary simulation box.
 
auto folded_image_box (Utils::Vector3d const &pos, Utils::Vector3i const &image_box) const noexcept
 Calculate image box of coordinates folded to primary simulation box.
 
auto image_shift (Utils::Vector3i const &image_box) const noexcept
 Calculate image box shift vector.
 
auto unfolded_position (Utils::Vector3d const &pos, Utils::Vector3i const &image_box) const noexcept
 Unfold particle coordinates to image box.
 

Detailed Description

Definition at line 170 of file BoxGeometry.hpp.

Constructor & Destructor Documentation

◆ BoxGeometry() [1/2]

BoxGeometry::BoxGeometry ( )
inline

Definition at line 172 of file BoxGeometry.hpp.

References CUBOID, set_length(), set_periodic(), and set_type().

◆ BoxGeometry() [2/2]

BoxGeometry::BoxGeometry ( BoxGeometry const &  rhs)
inline

Definition at line 179 of file BoxGeometry.hpp.

References length(), periodic(), set_length(), set_periodic(), and type().

Member Function Documentation

◆ cuboid_minimum_image()

auto BoxGeometry::cuboid_minimum_image ( ) const
inline

Cuboid minimum-image fold parameters for hoisting into kernels.

Definition at line 285 of file BoxGeometry.hpp.

Referenced by link_cell_kokkos().

◆ fold_position()

void BoxGeometry::fold_position ( Utils::Vector3d pos,
Utils::Vector3i image_box 
) const
inline

Fold coordinates to primary simulation box in-place.

Lees-Edwards offset is ignored.

Parameters
[in,out]poscoordinates to fold
[in,out]image_boximage box offset

Definition at line 424 of file BoxGeometry.hpp.

References Algorithm::periodic_fold().

Referenced by fold_and_reset(), LeesEdwards::Push::operator()(), AtomDecomposition::resort(), GhostComm::serialize_and_reduce(), vs_com_update_particles(), and vs_relative_update_particles().

◆ folded_image_box()

auto BoxGeometry::folded_image_box ( Utils::Vector3d const &  pos,
Utils::Vector3i const &  image_box 
) const
inlinenoexcept

Calculate image box of coordinates folded to primary simulation box.

Parameters
[in]poscoordinates
[in]image_boximage box to fold
Returns
Folded image box.

Definition at line 463 of file BoxGeometry.hpp.

References Algorithm::periodic_fold().

◆ folded_position()

auto BoxGeometry::folded_position ( Utils::Vector3d const &  pos) const
inlinenoexcept

Calculate coordinates folded to primary simulation box.

Parameters
[in]poscoordinates to fold
Returns
Folded coordinates.

Definition at line 446 of file BoxGeometry.hpp.

References Algorithm::periodic_fold().

Referenced by gather_particle_data(), is_valid_position(), LB::ParticleCoupling::kernel(), and positions_in_halo().

◆ get_mi_coord()

template<std::floating_point T>
T BoxGeometry::get_mi_coord ( a,
b,
unsigned  coord 
) const
inlinenoexcept

Get the minimum-image distance between two coordinates.

Parameters
aCoordinate of the terminal point.
bCoordinate of the initial point.
coordDirection
Returns
Shortest distance from b to a across periodic images, i.e. a - b. Can be negative.

Definition at line 276 of file BoxGeometry.hpp.

References coord().

Referenced by get_mi_dist2(), get_mi_vector(), and get_mi_vector().

◆ get_mi_dist2()

template<std::floating_point T>
ESPRESSO_ATTR_ALWAYS_INLINE T BoxGeometry::get_mi_dist2 ( Utils::Vector3< T > const &  a,
Utils::Vector3< T > const &  b 
) const
inlinenoexcept

Get the squared minimum-image distance between two coordinates.

Equivalent to get_mi_vector(a, b).norm2(), but for cuboid boxes avoids constructing the intermediate vector.

Template Parameters
TFloating point type.
Parameters
aCoordinate of the terminal point.
bCoordinate of the initial point.
Returns
Squared shortest distance from b to a across periodic images.

Definition at line 336 of file BoxGeometry.hpp.

References CUBOID, get_mi_coord(), get_mi_vector(), LEES_EDWARDS, and type().

Referenced by link_cell_kokkos().

◆ get_mi_vector() [1/2]

template<std::floating_point T>
ESPRESSO_ATTR_ALWAYS_INLINE Utils::Vector3< T > BoxGeometry::get_mi_vector ( T const &  a0,
T const &  a1,
T const &  a2,
T const &  b0,
T const &  b1,
T const &  b2 
) const
inlinenoexcept

Get the minimum-image vector between two coordinates.

Template Parameters
TFloating point type.
Parameters
a0x element of the terminal point.
a1y element of the terminal point.
a2z element of the terminal point.
b0x element of the initial point.
b1y element of the initial point.
b2z element of the initial point.
Returns
Vector from b to a that minimizes the distance across periodic images, i.e. a - b.

Definition at line 364 of file BoxGeometry.hpp.

References CUBOID, LeesEdwardsBC::distance(), get_mi_coord(), LEES_EDWARDS, lees_edwards_bc(), Algorithm::periodic_fold(), LeesEdwardsBC::shear_plane_normal, and type().

◆ get_mi_vector() [2/2]

◆ image_shift()

auto BoxGeometry::image_shift ( Utils::Vector3i const &  image_box) const
inlinenoexcept

Calculate image box shift vector.

Definition at line 477 of file BoxGeometry.hpp.

◆ lees_edwards_bc()

◆ lees_edwards_update()

void BoxGeometry::lees_edwards_update ( double  pos_offset,
double  shear_velocity 
)
inline

Update the Lees-Edwards parameters of the box geometry for the current simulation time.

Definition at line 395 of file BoxGeometry.hpp.

References LEES_EDWARDS, LeesEdwardsBC::pos_offset, LeesEdwardsBC::shear_velocity, and type().

Referenced by LeesEdwards::LeesEdwards::update_box_params().

◆ length()

◆ length_half()

Utils::Vector3d const & BoxGeometry::length_half ( ) const
inline

Half box length.

Returns
Return vector of half side-lengths of the box.

Definition at line 245 of file BoxGeometry.hpp.

Referenced by velocity_difference().

◆ length_inv()

Utils::Vector3d const & BoxGeometry::length_inv ( ) const
inline

Inverse box length.

Returns
Return vector of inverse side-lengths of the box.

Definition at line 239 of file BoxGeometry.hpp.

Referenced by add_PQ_force(), dipolar_energy_correction(), dipolar_force_corrections(), prepare_sc_cache(), setup_PoQ(), and setup_PQ().

◆ periodic()

constexpr bool BoxGeometry::periodic ( unsigned  coord) const
inlineconstexpr

Check periodicity in direction.

Parameters
coordDirection to check
Returns
true iff periodic in direction.

Definition at line 224 of file BoxGeometry.hpp.

References coord().

Referenced by BoxGeometry(), get_n_cut(), get_simulation_box(), and RegularDecomposition::RegularDecomposition().

◆ set_lees_edwards_bc()

void BoxGeometry::set_lees_edwards_bc ( LeesEdwardsBC  bc)
inline

Definition at line 389 of file BoxGeometry.hpp.

◆ set_length()

void BoxGeometry::set_length ( Utils::Vector3d const &  box_l)
inline

Set box side lengths.

Parameters
box_lLength that should be set.

Definition at line 251 of file BoxGeometry.hpp.

References Utils::Vector< T, N >::broadcast().

Referenced by BoxGeometry(), and BoxGeometry().

◆ set_periodic()

void BoxGeometry::set_periodic ( unsigned  coord,
bool  val 
)
inline

Set periodicity for direction.

Parameters
coordThe coordinate to set the periodicity for.
valTrue if this direction should be periodic.

Definition at line 213 of file BoxGeometry.hpp.

References coord().

Referenced by BoxGeometry(), and BoxGeometry().

◆ set_type()

void BoxGeometry::set_type ( BoxType  type)
inline

Definition at line 386 of file BoxGeometry.hpp.

References type().

Referenced by BoxGeometry().

◆ type()

◆ unfolded_position()

auto BoxGeometry::unfolded_position ( Utils::Vector3d const &  pos,
Utils::Vector3i const &  image_box 
) const
inlinenoexcept

Unfold particle coordinates to image box.

Definition at line 482 of file BoxGeometry.hpp.

Referenced by add_oif_global_forces(), calc_bonded_four_body_force(), calc_oif_mesh(), GatherPos::kernel(), GatherCom::kernel(), and vs_com_update_particles().

◆ velocity_difference()

Utils::Vector3d BoxGeometry::velocity_difference ( Utils::Vector3d const &  x,
Utils::Vector3d const &  y,
Utils::Vector3d const &  u,
Utils::Vector3d const &  v 
) const
inlinenoexcept

Calculate the velocity difference including the Lees-Edwards velocity.

Definition at line 402 of file BoxGeometry.hpp.

References LEES_EDWARDS, length_half(), LeesEdwardsBC::shear_plane_normal, and type().

Referenced by dpd_pair_force(), and PressureKernel::operator()().

◆ volume()

double BoxGeometry::volume ( ) const
inline

Box volume.

Returns
Return the volume of the box.

Definition at line 265 of file BoxGeometry.hpp.

References Utils::product().


The documentation for this class was generated from the following file: