Crystal systems#

Orthorhombic#

File: libfly/system/boxes/orthorhombic.hpp

Specialised simulation box for orthorhombic supercells.

class Orthorhombic#

Generalised orthogonal simulation box.

Public Functions

inline Orthorhombic(Arr<double> const &ex, Arr<bool> const &pd)#

Construct a new Orthorhombic box object.

Parameters:
  • ex – Length of simulation box along each axis.

  • pd – True for each periodic axis.

inline Eigen::DiagonalMatrix<double, spatial_dims> basis() const noexcept#

Fetch the basis vectors of this cell.

Returns:

Eigen::DiagonalMatrix<double, spatial_dims> A matrix with each column corresponding to a basis vector.

template<typename E>
inline Vec canon_image(Eigen::MatrixBase<E> const &x) const#

Maps an atom into the canonical cell.

Guarantees \(0 \le x_i < \text{extent}_i\) for all \(i\).

Warning

Assumes atoms are within the extents of the non-periodic axes!

inline OrthoGrid make_grid(double r_cut) const#

Make an OrthoGrid object.

Parameters:

r_cut – The cut-off radius for atomic interactions.

inline double min_width() const noexcept#

Get the minimum width along any dimension.

inline bool periodic(Eigen::Index i) const noexcept#

Query if the ith axis is periodic.

Friends

inline friend bool operator==(Orthorhombic const &a, Orthorhombic const &b) noexcept#

Comparison operator, no surprises.

Grid#

class OrthoGrid : public fly::system::HyperGrid#

Maps position vector -> ND integer-tuples -> 1D index.

OrthoGrid is constructable using the Orthorhombic::make_grid factory.

Public Functions

template<Sign S>
inline std::optional<Vec> gen_image(Vec x, int ax) const#

Generate the periodic image of an atom along a particular axis ax.

Warning

Only supports atoms with a projection along axis in the canonical cell.

Template Parameters:

S – Direction along axis which to generate image.

Parameters:
  • xPosition of the atom who’s image we are computing.

  • axIndex of axis along which to generate image.

Returns:

std::optional<Vec> If the atom’s image is beyond the cut-off (r_cut) for atomic interactions then the image’s position otherwise std::nullopt.

Triclinic#

File: libfly/system/boxes/triclinic.hpp

Specialised simulation box for Triclinic supercells.

class Triclinic#

Generalized triclinic simulation box.

Public Functions

inline Triclinic(Mat const &basis, Arr<bool> const &pd)#

Construct a new Triclinic box object.

Todo

Introduce exceptions for some ASSERT/VERIFY places.

Parameters:
  • basis – Matrix with columns equal to the basis vectors of the parallelotope.

  • pd – True for each periodic axis.

inline Mat basis() const noexcept#

Fetch the basis vectors of this cell.

Returns:

Mat A matrix with each column corresponding to a basis vector.

template<typename E>
inline Vec canon_image(Eigen::MatrixBase<E> const &x) const#

Maps an atom into the canonical cell.

Warning

Assumes atoms are within the extents of the non-periodic axes!

inline TriGrid make_grid(double r_cut) const#

Make a TriGrid object.

Parameters:

r_cut – The cut-off radius for atomic interactions.

inline double min_width() const noexcept#

Get the minimum width along any dimension.

inline bool periodic(Eigen::Index i) const noexcept#

Query if the ith axis is periodic.

Friends

inline friend bool operator==(Triclinic const &a, Triclinic const &b) noexcept#

Comparison operator, no surprises.

Grid#

class TriGrid : public fly::system::HyperGrid#

Maps position vector -> ND integer-tuples -> 1D index.

TriGrid is constructable using the Triclinic::make_grid factory.

Although the grid is for an triclinic cell it still uses a HyperGrid as triclinic cells are worse approximations to spheres so the neighbour list construction would become more expensive.

Public Functions

template<Sign S, typename E>
inline std::optional<Vec> gen_image(Eigen::MatrixBase<E> const &x, int ax) const#

Generate the periodic image of an atom along a particular axis ax.

Warning

Only supports atoms with a projection along axis in the canonical cell.

Template Parameters:

S – Direction along axis which to generate image.

Parameters:
  • xPosition of the atom who’s image we are computing.

  • axIndex of axis along which to generate image.

Returns:

std::optional<Vec> If the atom’s image is beyond the cut-off (r_cut) for atomic interactions then the image’s position otherwise std::nullopt.

inline double min_width() const noexcept#

Get the minimum width along any dimension.

Hypergrid#

File: libfly/system/boxes/hypergrid.hpp

Generalised utilities for sub-dividing hyperrectangles.

class HyperGrid#

Maps a position-vector -> ND-integer-tuples -> 1D-index.

Dives a hyperrectangle into smaller hyperrectangle called cells.

Subclassed by fly::system::OrthoGrid, fly::system::TriGrid

Public Functions

inline HyperGrid(Arr<double> const &extents, double r_cut)#

Construct a new Grid object with cells at least r_cut along each axis.

Parameters:
  • extents – The size of the box along each axis.

  • r_cut – The cut-off radius for atomic interactions.

template<typename E>
inline int cell_idx(Eigen::MatrixBase<E> const &x) const noexcept#

Compute the cell index from an atoms canonical position.

Warning

Assumes atoms are in the extents of the HyperGrid or in the surrounding one-cell buffer i.e. ghost atoms.

inline double r_cut() const noexcept#

Fetch the cut-off radius for atomic interactions.

inline Arr<int> shape() const noexcept#

Get the total number of cells in the HyperGrid along each axis.