|
occ
|
This class represents a unit cell of a crystal lattice. More...
#include <unitcell.h>
Public Member Functions | |
| UnitCell () | |
| UnitCell (double a, double b, double c, double alpha, double beta, double gamma) | |
| UnitCell (const Vec3 &lengths, const Vec3 &angles) | |
| UnitCell (const Mat3 &vectors) | |
| Construct from a matrix of lattice vectors (columns = a, b, c). | |
| double | a () const |
| the length of the a-axis in Angstroms | |
| double | b () const |
| the length of the b-axis in Angstroms | |
| double | c () const |
| the length of the c-axis in Angstroms | |
| double | alpha () const |
| angle \(\alpha\), i.e. the angle between the b- and c-axes in radians | |
| double | beta () const |
| angle \(\beta\), i.e. the angle between the a- and c-axes in radians | |
| double | gamma () const |
| angle \(\gamma\), i.e. the angle between the a- and b-axes in radians | |
| double | volume () const |
| Volume of the unit cell in cubic Angstroms. | |
| Mat3 | metric_tensor () const |
| Mat3 | reciprocal_metric_tensor () const |
| void | set_a (double a) |
| Set the length of the a-axis. | |
| void | set_b (double b) |
| Set the length of the b-axis. | |
| void | set_c (double c) |
| Set the length of the c-axis. | |
| void | set_alpha (double alpha) |
| Set the angle of between the b- and c-axes. | |
| void | set_beta (double beta) |
| Set the angle of between the a- and c-axes. | |
| void | set_gamma (double gamma) |
| Set the angle of between the a- and b-axes. | |
| bool | is_cubic () const |
| Check if cubic i.e. \( a=b=c, \alpha=\beta=\gamma \). | |
| bool | is_triclinic () const |
| Check if triclinic i.e. | |
| bool | is_monoclinic () const |
| Check if monoclinic i.e. | |
| bool | is_orthorhombic () const |
| Check if orthorhombic i.e. | |
| bool | is_tetragonal () const |
| Check if tetragonal i.e. | |
| bool | is_rhombohedral () const |
| Check if rhombohedral i.e. | |
| bool | is_hexagonal () const |
| Check if hexagonal i.e. | |
| bool | is_orthogonal () const |
| Check if orthogonal i.e. \(\alpha = \beta = \gamma = 90^\circ\). | |
| std::string | cell_type () const |
| String representing the type of cell e.g. "monoclinic". | |
| auto | to_cartesian (const Mat3N &coords) const |
| Convert a given matrix of coordinates from fractional to Cartesian. | |
| Mat3 | adp_adhoc_direct () const |
| Calculate the direct matrix for ADP transformations. | |
| Mat3 | adp_adhoc_inverse () const |
| Calculate the inverse matrix for ADP transformations. | |
| Mat6N | to_fractional_adp (const Mat6N &adp) const |
| Convert ADPs from Cartesian to fractional coordinates. | |
| Mat6N | to_cartesian_adp (const Mat6N &adp) const |
| Convert ADPs from fractional to Cartesian coordinates. | |
| auto | to_fractional (const Mat3N &coords) const |
| Convert a given matrix of coordinates from Cartesian to fractional. | |
| auto | to_reciprocal (const Mat3N &coords) const |
| Convert a given matrix of coordinates from Cartesian to fractional. | |
| const auto & | direct () const |
| The direct matrix of this unit cell (columns are lattice vectors) | |
| const auto & | reciprocal () const |
| The reciprocal matrix of this unit cell (columns are reciprocal lattice vectors) | |
| const auto & | inverse () const |
| The inverse matrix of this unit cell (rows are reciprocal lattice vectors) | |
| auto | a_vector () const |
| the \(\bf{a}\) lattice vector | |
| auto | b_vector () const |
| the \(\bf{b}\) lattice vector | |
| auto | c_vector () const |
| the \(\bf{c}\) lattice vector | |
| auto | a_star_vector () const |
| the \(\bf{a^*}\) vector in reciprocal lattice | |
| auto | b_star_vector () const |
| the \(\bf{b^*}\) vector in reciprocal lattice | |
| auto | c_star_vector () const |
| the \(\bf{c^*}\) vector in reciprocal lattice | |
| const auto & | lengths () const |
| Vector of lengths \((a, b, c)\). | |
| const auto & | angles () const |
| Vector of lengths \((a, b, c)\). | |
| HKL | hkl_limits (double d_min) const |
| Return the maximum fractional coordinates \((h,k,l)\) needed to enclose a sphere of size d_min. | |
Static Public Member Functions | |
| static UnitCell | from_lattice_vectors (const Mat3 &vectors) |
| Construct from a matrix of lattice vectors (columns = a, b, c) while preserving the input direct matrix exactly. | |
This class represents a unit cell of a crystal lattice.
A UnitCell describes the lattice vectors of a 3D crystal structure, including the 6 (possibly unique) parameters lengths \((a,b,c)\) and angles \((\alpha, \beta, \gamma)\). It also serves as a utility class for coordinate transforms, and other conversions and checks.
| occ::crystal::UnitCell::UnitCell | ( | ) |
| occ::crystal::UnitCell::UnitCell | ( | double | a, |
| double | b, | ||
| double | c, | ||
| double | alpha, | ||
| double | beta, | ||
| double | gamma | ||
| ) |
| occ::crystal::UnitCell::UnitCell | ( | const Mat3 & | vectors | ) |
Construct from a matrix of lattice vectors (columns = a, b, c).
The matrix is canonicalized: only (a, b, c, α, β, γ) are extracted and the direct matrix is rebuilt in the conventional orientation (a along x, b in the xy plane). This loses the original basis orientation.
|
inline |
the length of the a-axis in Angstroms
|
inline |
the \(\bf{a^*}\) vector in reciprocal lattice
|
inline |
the \(\bf{a}\) lattice vector
| Mat3 occ::crystal::UnitCell::adp_adhoc_direct | ( | ) | const |
Calculate the direct matrix for ADP transformations.
This method computes the ad hoc direct matrix used specifically for transforming Anisotropic Displacement Parameters (ADPs).
| Mat3 occ::crystal::UnitCell::adp_adhoc_inverse | ( | ) | const |
Calculate the inverse matrix for ADP transformations.
This method computes the ad hoc inverse matrix used specifically for transforming Anisotropic Displacement Parameters (ADPs).
|
inline |
angle \(\alpha\), i.e. the angle between the b- and c-axes in radians
|
inline |
Vector of lengths \((a, b, c)\).
|
inline |
the length of the b-axis in Angstroms
|
inline |
the \(\bf{b^*}\) vector in reciprocal lattice
|
inline |
the \(\bf{b}\) lattice vector
|
inline |
angle \(\beta\), i.e. the angle between the a- and c-axes in radians
|
inline |
the length of the c-axis in Angstroms
|
inline |
the \(\bf{c^*}\) vector in reciprocal lattice
|
inline |
the \(\bf{c}\) lattice vector
| std::string occ::crystal::UnitCell::cell_type | ( | ) | const |
String representing the type of cell e.g. "monoclinic".
|
inline |
The direct matrix of this unit cell (columns are lattice vectors)
Construct from a matrix of lattice vectors (columns = a, b, c) while preserving the input direct matrix exactly.
Use this when the basis orientation matters (e.g. derivatives under affine strain) and must not be silently rotated via (a, b, c, α, β, γ) reconstruction.
|
inline |
angle \(\gamma\), i.e. the angle between the a- and b-axes in radians
| HKL occ::crystal::UnitCell::hkl_limits | ( | double | d_min | ) | const |
Return the maximum fractional coordinates \((h,k,l)\) needed to enclose a sphere of size d_min.
|
inline |
The inverse matrix of this unit cell (rows are reciprocal lattice vectors)
| bool occ::crystal::UnitCell::is_cubic | ( | ) | const |
Check if cubic i.e. \( a=b=c, \alpha=\beta=\gamma \).
| bool occ::crystal::UnitCell::is_hexagonal | ( | ) | const |
Check if hexagonal i.e.
\( a = b, a \ne c, \alpha = 90^\circ , \gamma = 120^\circ \)
| bool occ::crystal::UnitCell::is_monoclinic | ( | ) | const |
Check if monoclinic i.e.
\( a \ne b \ne c, \alpha = \gamma = 90^\circ \ne \beta \)
|
inline |
Check if orthogonal i.e. \(\alpha = \beta = \gamma = 90^\circ\).
| bool occ::crystal::UnitCell::is_orthorhombic | ( | ) | const |
Check if orthorhombic i.e.
\( a \ne b \ne c, \alpha = \beta = \gamma = 90^\circ \)
| bool occ::crystal::UnitCell::is_rhombohedral | ( | ) | const |
Check if rhombohedral i.e.
\( a = b = c, \alpha = \beta = \gamma \ne 90^\circ \)
| bool occ::crystal::UnitCell::is_tetragonal | ( | ) | const |
Check if tetragonal i.e.
\( a = b, a \ne c, \alpha = \beta = \gamma = 90^\circ \)
| bool occ::crystal::UnitCell::is_triclinic | ( | ) | const |
Check if triclinic i.e.
\( a \ne b \ne c, \alpha \ne \beta \ne \gamma \)
|
inline |
Vector of lengths \((a, b, c)\).
|
inline |
|
inline |
The reciprocal matrix of this unit cell (columns are reciprocal lattice vectors)
|
inline |
| void occ::crystal::UnitCell::set_a | ( | double | a | ) |
Set the length of the a-axis.
| a | new length of the a-axis in Angstroms |
| void occ::crystal::UnitCell::set_alpha | ( | double | alpha | ) |
Set the angle of between the b- and c-axes.
| alpha | new angle between the b- and c-axes in radians |
| void occ::crystal::UnitCell::set_b | ( | double | b | ) |
Set the length of the b-axis.
| b | new length of the b-axis in Angstroms |
| void occ::crystal::UnitCell::set_beta | ( | double | beta | ) |
Set the angle of between the a- and c-axes.
| beta | new angle between the a- and c-axes in radians |
| void occ::crystal::UnitCell::set_c | ( | double | c | ) |
Set the length of the c-axis.
| c | new length of the c-axis in Angstroms |
| void occ::crystal::UnitCell::set_gamma | ( | double | gamma | ) |
Set the angle of between the a- and b-axes.
| gamma | new angle between the a- and b-axes in radians |
|
inline |
Convert a given matrix of coordinates from fractional to Cartesian.
| coords | Mat3N of fractional coordinates |
Convert ADPs from fractional to Cartesian coordinates.
This method transforms a set of Anisotropic Displacement Parameters (ADPs) from fractional (ad-hoc) basis to Cartesian coordinate system.
| adp | Mat6N of ADPs in fractional coordinates |
|
inline |
Convert a given matrix of coordinates from Cartesian to fractional.
| coords | Mat3N of Cartesian coordinates |
Convert ADPs from Cartesian to fractional coordinates.
This method transforms a set of Anisotropic Displacement Parameters (ADPs) from Cartesian to the fractional (ad-hoc) coordinate system.
| adp | Mat6N of ADPs in Cartesian coordinates |
|
inline |
Convert a given matrix of coordinates from Cartesian to fractional.
| coords | Mat3N of Cartesian coordinates |
|
inline |
Volume of the unit cell in cubic Angstroms.