![]() |
Shamrock 2025.10.0
Astrophysical Code
|
utility for generating FCC (face-centered cubic) crystal lattices More...
#include <shammath/include/shammath/crystalLattice.hpp>
Public Types | |
| using | Tscal = shambase::VecComponent<Tvec> |
| using | Iterator = iterator_utils::LatticeIterator<Tvec, LatticeFCC> |
| Iterator utility to generate the lattice. | |
| using | IteratorDiscontinuous = iterator_utils::LatticeIteratorDiscontinuous<Tvec, LatticeFCC> |
| Iterator utility to generate the lattice in a discontinuous order. | |
Static Public Member Functions | |
| static constexpr i32 | pmod (i32 a, i32 b) noexcept |
| Positive modulo (C++ % keeps the sign of the dividend). | |
| static constexpr Tvec | generator (Tscal dr, std::array< i32, dim > coord) noexcept |
| generate a FCC lattice centered on (0,0,0) | |
| static constexpr bool | can_make_periodic_box (std::array< i32, dim > coord_min, std::array< i32, dim > coord_max) |
| check if the given lattice coordinates bounds can make a periodic box | |
| static constexpr CoordRange< Tvec > | get_periodic_box (Tscal dr, std::array< i32, dim > coord_min, std::array< i32, dim > coord_max) |
| Get the periodic box corresponding to integer lattice coordinates this function will throw if the coordinates asked cannot make a periodic lattice. | |
| static constexpr std::pair< std::array< i32, dim >, std::array< i32, dim > > | get_box_index_bounds (Tscal dr, Tvec box_min, Tvec box_max) |
| Get the lattice integer coordinates bounds covering the given box (with a one cell margin on each side). | |
| static constexpr std::pair< std::array< i32, dim >, std::array< i32, dim > > | nearest_periodic_box_indices (std::array< i32, dim > coord_min, std::array< i32, dim > coord_max) |
| get the nearest integer triplets bound that gives a periodic box (by only increasing the upper bound) | |
| static constexpr Tvec | get_box_dim (Tscal dr, u32 xcnt, u32 ycnt, u32 zcnt) |
| Get the box size for a FCC lattice of xcnt * ycnt * zcnt lattice cells this function will throw if the counts asked cannot make a periodic lattice. | |
| static std::tuple< Tvec, Tvec > | get_ideal_fcc_box (Tscal dr, std::tuple< Tvec, Tvec > box) |
| Get the smallest periodic FCC box containing the given box. | |
Static Public Attributes | |
| static constexpr u32 | dim = 3 |
| static constexpr i32 | z_period = 3 |
| Number of layers after which the stacking sequence repeats along z. | |
utility for generating FCC (face-centered cubic) crystal lattices
The lattice is built as a stack of close-packed triangular layers normal to the z axis following the ABCABC... stacking sequence (as opposed to LatticeHCP which uses the ABAB... sequence). Like LatticeHCP, neighbours are 2 dr apart, so both lattices share the same particle density and the same in-plane / inter-layer spacings, only the stacking differs.
Since the stacking repeats every 3 layers, a periodic box requires the number of layers along z to be a multiple of 3 (instead of 2 for HCP).
| Tvec | position vector type |
Definition at line 441 of file crystalLattice.hpp.
| using shammath::LatticeFCC< Tvec >::Iterator = iterator_utils::LatticeIterator<Tvec, LatticeFCC> |
Iterator utility to generate the lattice.
Definition at line 601 of file crystalLattice.hpp.
| using shammath::LatticeFCC< Tvec >::IteratorDiscontinuous = iterator_utils::LatticeIteratorDiscontinuous<Tvec, LatticeFCC> |
Iterator utility to generate the lattice in a discontinuous order.
Definition at line 604 of file crystalLattice.hpp.
| using shammath::LatticeFCC< Tvec >::Tscal = shambase::VecComponent<Tvec> |
Definition at line 448 of file crystalLattice.hpp.
|
inlinestaticconstexpr |
check if the given lattice coordinates bounds can make a periodic box
| coord_min | integer triplet for the minimal coordinates on the lattice |
| coord_max | integer triplet for the maximal coordinates on the lattice |
Definition at line 488 of file crystalLattice.hpp.
|
inlinestaticconstexprnoexcept |
generate a FCC lattice centered on (0,0,0)
Layer k is the triangular layer A shifted by (k mod 3) * (1, 1/sqrt(3)) (in units of dr), which gives the ABC stacking.
| dr | |
| coord |
Definition at line 466 of file crystalLattice.hpp.
|
inlinestaticconstexpr |
Get the box size for a FCC lattice of xcnt * ycnt * zcnt lattice cells this function will throw if the counts asked cannot make a periodic lattice.
| dr | the particle spacing in the lattice |
| xcnt | number of particles per row along x |
| ycnt | number of rows along y (must be even) |
| zcnt | number of layers along z (must be a multiple of 3) |
Definition at line 616 of file crystalLattice.hpp.
|
inlinestaticconstexpr |
Get the lattice integer coordinates bounds covering the given box (with a one cell margin on each side).
Definition at line 547 of file crystalLattice.hpp.
|
inlinestatic |
Get the smallest periodic FCC box containing the given box.
Definition at line 625 of file crystalLattice.hpp.
|
inlinestaticconstexpr |
Get the periodic box corresponding to integer lattice coordinates this function will throw if the coordinates asked cannot make a periodic lattice.
| dr | the particle spacing in the lattice |
| coord_min | integer triplet for the minimal coordinates on the lattice |
| coord_max | integer triplet for the maximal coordinates on the lattice |
Definition at line 519 of file crystalLattice.hpp.
|
inlinestaticconstexpr |
get the nearest integer triplets bound that gives a periodic box (by only increasing the upper bound)
| coord_min | integer triplet for the minimal coordinates on the lattice |
| coord_max | integer triplet for the maximal coordinates on the lattice |
Definition at line 581 of file crystalLattice.hpp.
|
inlinestaticconstexprnoexcept |
Positive modulo (C++ % keeps the sign of the dividend).
Definition at line 454 of file crystalLattice.hpp.
|
staticconstexpr |
Definition at line 443 of file crystalLattice.hpp.
|
staticconstexpr |
Number of layers after which the stacking sequence repeats along z.
Definition at line 451 of file crystalLattice.hpp.