Class Lattice¶
Defined in File lattice.hpp
Inheritance Relationships¶
Derived Types¶
public brille::Direct(Class Direct)public brille::Reciprocal(Class Reciprocal)
Class Documentation¶
-
class
brille::Lattice¶ A class to hold information about a space-spanning lattice in three dimensions.
A space-spanning lattice in N dimensions has N basis vectors which can be described fully by their N lengths and the
sum(1:N-1)angles between each set of basis vectors, orsum(1:N)scalars in total. Storing only their lengths and angles is therefore always more efficient than storing all N² components of the basis vectors in an orthonormal frame. This class stores the 3 lengths and 3 angles required to describe a 3 dimensional space-spanning lattice, plus the volume of the lattice unit cell and an optional Hall number if a non-Primitive lattice is desired.Subclassed by brille::Direct, brille::Reciprocal
Public Functions
-
Lattice(const std::array<double, 3> &l, const std::array<double, 3> &a, const Bravais b, const Symmetry sgs, const PointSymmetry pgs, const Basis base)¶ Construct the Lattice from its components, excluding the volume which is calculated.
-
Lattice(const brille::Array2<double> &latmat, const std::vector<std::array<double, 3>> &pos, const std::vector<unsigned long> &typ, const Symmetry &sym)¶ Construct the Lattice from an Array2 3x3 basis vector matrix, plus basis and symmetry information.
-
template<class
I>Lattice(const double *latmat, std::vector<I> &strides, const int h)¶ Construct the Lattice from a possibly-not-contiguous matrix of the basis vectors.
-
template<class
I>Lattice(const double *lengths, std::vector<I> &lenstrides, const double *angles, std::vector<I> &angstrides, const int h, const AngleUnit au = AngleUnit::not_provided)¶ Construct the lattice from two vectors of the lengths and angles.
- Parameters
lengths: A pointer to the first of three basis vector lengths in arbitrary length unitslenstrides: The first element must contain the stride in bytes between basis vector lenght entriesangles: A pointer to the first of three inter-basis-vector angles in units of pi, radian, or degreeangstrides: The first element must contain the stride in bytes between angle entriesh: The hall number specifying the lattice symmetriesau: An enum which identifies which units the provided angles use. If omitted or AngleUnit::not_provided, an attempt is made to guess the units. If all provided angles have values less than π then they are assumed to be in units of radian, otherwise they are assumed to be in units of degrees.
-
Lattice(const double*, const double*, const int h = 1, const AngleUnit au = AngleUnit::not_provided)¶ Construct the Lattice from a vector of the basis vector lengths and a vector of the basis vector angles.
-
Lattice(const double la = 1.0, const double lb = 1.0, const double lc = 1.0, const double al = brille::halfpi, const double bl = brille::halfpi, const double cl = brille::halfpi, const int h = 1)¶ Construct the Lattice from the three scalar lengths and three scalar angles.
-
Lattice(const double*, const std::string&, const std::string &choice = "")¶ Construct the Lattice from a matrix of the basis vectors, specifying an International Tables symmetry name instead of a Hall number.
-
Lattice(const double*, const double*, const std::string&, const std::string &choice = "", const AngleUnit au = AngleUnit::not_provided)¶ Construct the lattice from vectors, specifying an International Tables symmetry name instead of a Hall number.
-
template<class
I>Lattice(const double *latmat, std::vector<I> &strides, const std::string &itname, const std::string &choice = "")¶
-
template<class
I>Lattice(const double *lengths, std::vector<I> &lenstrides, const double *angles, std::vector<I> &angstrides, const std::string &itname, const std::string &choice = "", const AngleUnit au = AngleUnit::not_provided)¶ Construct the lattice from two possibly-not-contiguous vectors of the lengths and angles.
-
Lattice(const double, const double, const double, const double, const double, const double, const std::string&, const std::string &choice = "")¶ Construct the lattice from scalars, specifying an International Tables symmetry name instead of a Hall number.
-
~Lattice() = default¶
-
double
get_a() const¶ Return the first basis vector length.
-
double
get_b() const¶ Return the second basis vector length.
-
double
get_c() const¶ Return the third basis vector length.
-
double
get_alpha() const¶ Return the angle between the second and third basis vectors in radian.
-
double
get_beta() const¶ Return the angle between the first and third basis vectors in radian.
-
double
get_gamma() const¶ Return the angle between the first and second basis vectors in radian.
-
double
get_volume() const¶ Return the volume of the parallelpiped unit cell formed by the basis vectors.
-
double
calculatevolume()¶ Calculate and return the unit cell volume.
-
void
get_metric_tensor(double *mt) const¶ Calculate the metric tensor of the Lattice
- Parameters
[out] mt: Pointer to memory which can store 9 doubles
-
void
get_covariant_metric_tensor(double *mt) const¶ Calculate the covariant metric tensor of the Lattice this is typically referred to as the metric tensor
- Parameters
[out] mt: Pointer to memory which can store 9 doubles
-
void
get_contravariant_metric_tensor(double *mt) const¶ Calculate the contravariant metric tensor of the Lattice the inverse of the metric tensor
- Parameters
[out] mt: Pointer to memory which can store 9 doubles
-
std::vector<double>
get_metric_tensor() const¶ Calculate the metric tensor of the Lattice
- Return
A std::vector of the row-ordered matrix
-
std::vector<double>
get_covariant_metric_tensor() const¶ Calculate the covariant metric tensor of the Lattice this is typically referred to as the metric tensor
- Return
A std::vector of the row-ordered matrix
-
std::vector<double>
get_contravariant_metric_tensor() const¶ Calculate the contravariant metric tensor of the Lattice the inverse of the metric tensor
- Return
A std::vector of the row-ordered matrix
-
bool
issame(const Lattice&) const¶ Determine if the passed Lattice represents the same space-spanning lattice.
-
bool
isapprox(const Lattice&) const¶ Determine if the passed Lattice represents an equivalent space-spanning lattice within the specified tolerance. Simultaneous permutations of lengths and angles are considered as equivalent e.g., (a,b,c)(α,β,γ) ≡ (b,c,a)(β,γ,α) ≡ (c,a,b)(γ,α,β), as are antipermutations, e.g., (a,b,c)(α,β,γ) ≡ (a,c,b)(α,γ,β) ≡ (c,b,a)(γ,β,α) ≡ (b,a,c)(β,α,γ).
-
int
ispermutation(const Lattice&) const¶ Determine if the passed Lattice is a permutation of the space-spanning lattice within the specified tolerance. The equivalence is encoded in a signed integer:
-
void
print()¶ Print the basis vector lengths and angles to the console.
-
std::string
string_repr()¶ Return a string representation of the basis vector lengths and angles.
-
Symmetry
get_spacegroup_symmetry(const int time_reversal = 0) const¶ Return the Spacegroup symmetry operation object of the Lattice.
-
Symmetry
set_spacegroup_symmetry(const Symmetry &gens)¶ Set the Spacegroup symmetry operation object also sets PointSymmetry.
-
PointSymmetry
get_pointgroup_symmetry(const int time_reversal = 0) const¶ Return the Pointgroup Symmetry operation object of the Lattice.
-
bool
has_space_inversion() const¶ Check whether the pointgroup has the space-inversion operator, ̄1.
Protected Functions
-
double
unitvolume() const¶
-
template<class
I>
voidset_ang_pointer(const double *avec, const I span, const AngleUnit angle_unit)¶
-
void
check_hall_number(const int h)¶
-
void
check_IT_name(const std::string &itname, const std::string &choice = "")¶
Protected Attributes
-
std::array<double, 3>
len¶ basis vector lengths
-
std::array<double, 3>
ang¶ basis vector angles ordered θ₁₂, θ₀₂, θ₀₁, in radian
-
double
volume¶ volume of the unit cell formed by the basis vectors
-
Symmetry
spgsym¶ Spacegroup symmetry operators.
-
PointSymmetry
ptgsym¶ Pointgroup symmetry operators.
-