occ
Loading...
Searching...
No Matches
occ::crystal::UnitCell Class Reference

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)
 
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UnitCell() [1/4]

occ::crystal::UnitCell::UnitCell ( )

◆ UnitCell() [2/4]

occ::crystal::UnitCell::UnitCell ( double  a,
double  b,
double  c,
double  alpha,
double  beta,
double  gamma 
)

◆ UnitCell() [3/4]

occ::crystal::UnitCell::UnitCell ( const Vec3 lengths,
const Vec3 angles 
)

◆ UnitCell() [4/4]

occ::crystal::UnitCell::UnitCell ( const Mat3 vectors)

Member Function Documentation

◆ a()

double occ::crystal::UnitCell::a ( ) const
inline

the length of the a-axis in Angstroms

◆ a_star_vector()

auto occ::crystal::UnitCell::a_star_vector ( ) const
inline

the \(\bf{a^*}\) vector in reciprocal lattice

◆ a_vector()

auto occ::crystal::UnitCell::a_vector ( ) const
inline

the \(\bf{a}\) lattice vector

◆ adp_adhoc_direct()

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).

Returns
Mat3 representing the ADP direct transformation matrix

◆ adp_adhoc_inverse()

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).

Returns
Mat3 representing the ADP inverse transformation matrix

◆ alpha()

double occ::crystal::UnitCell::alpha ( ) const
inline

angle \(\alpha\), i.e. the angle between the b- and c-axes in radians

◆ angles()

const auto & occ::crystal::UnitCell::angles ( ) const
inline

Vector of lengths \((a, b, c)\).

◆ b()

double occ::crystal::UnitCell::b ( ) const
inline

the length of the b-axis in Angstroms

◆ b_star_vector()

auto occ::crystal::UnitCell::b_star_vector ( ) const
inline

the \(\bf{b^*}\) vector in reciprocal lattice

◆ b_vector()

auto occ::crystal::UnitCell::b_vector ( ) const
inline

the \(\bf{b}\) lattice vector

◆ beta()

double occ::crystal::UnitCell::beta ( ) const
inline

angle \(\beta\), i.e. the angle between the a- and c-axes in radians

◆ c()

double occ::crystal::UnitCell::c ( ) const
inline

the length of the c-axis in Angstroms

◆ c_star_vector()

auto occ::crystal::UnitCell::c_star_vector ( ) const
inline

the \(\bf{c^*}\) vector in reciprocal lattice

◆ c_vector()

auto occ::crystal::UnitCell::c_vector ( ) const
inline

the \(\bf{c}\) lattice vector

◆ cell_type()

std::string occ::crystal::UnitCell::cell_type ( ) const

String representing the type of cell e.g. "monoclinic".

◆ direct()

const auto & occ::crystal::UnitCell::direct ( ) const
inline

The direct matrix of this unit cell (columns are lattice vectors)

◆ gamma()

double occ::crystal::UnitCell::gamma ( ) const
inline

angle \(\gamma\), i.e. the angle between the a- and b-axes in radians

◆ hkl_limits()

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.

Returns
HKL of the limits bounding a given sphere

◆ inverse()

const auto & occ::crystal::UnitCell::inverse ( ) const
inline

The inverse matrix of this unit cell (rows are reciprocal lattice vectors)

◆ is_cubic()

bool occ::crystal::UnitCell::is_cubic ( ) const

Check if cubic i.e. \( a=b=c, \alpha=\beta=\gamma \).

◆ is_hexagonal()

bool occ::crystal::UnitCell::is_hexagonal ( ) const

Check if hexagonal i.e.

\( a = b, a \ne c, \alpha = 90^\circ , \gamma = 120^\circ \)

◆ is_monoclinic()

bool occ::crystal::UnitCell::is_monoclinic ( ) const

Check if monoclinic i.e.

\( a \ne b \ne c, \alpha = \gamma = 90^\circ \ne \beta \)

◆ is_orthogonal()

bool occ::crystal::UnitCell::is_orthogonal ( ) const
inline

Check if orthogonal i.e. \(\alpha = \beta = \gamma = 90^\circ\).

◆ is_orthorhombic()

bool occ::crystal::UnitCell::is_orthorhombic ( ) const

Check if orthorhombic i.e.

\( a \ne b \ne c, \alpha = \beta = \gamma = 90^\circ \)

◆ is_rhombohedral()

bool occ::crystal::UnitCell::is_rhombohedral ( ) const

Check if rhombohedral i.e.

\( a = b = c, \alpha = \beta = \gamma \ne 90^\circ \)

◆ is_tetragonal()

bool occ::crystal::UnitCell::is_tetragonal ( ) const

Check if tetragonal i.e.

\( a = b, a \ne c, \alpha = \beta = \gamma = 90^\circ \)

◆ is_triclinic()

bool occ::crystal::UnitCell::is_triclinic ( ) const

Check if triclinic i.e.

\( a \ne b \ne c, \alpha \ne \beta \ne \gamma \)

◆ lengths()

const auto & occ::crystal::UnitCell::lengths ( ) const
inline

Vector of lengths \((a, b, c)\).

◆ metric_tensor()

Mat3 occ::crystal::UnitCell::metric_tensor ( ) const
inline

◆ reciprocal()

const auto & occ::crystal::UnitCell::reciprocal ( ) const
inline

The reciprocal matrix of this unit cell (columns are reciprocal lattice vectors)

◆ reciprocal_metric_tensor()

Mat3 occ::crystal::UnitCell::reciprocal_metric_tensor ( ) const
inline

◆ set_a()

void occ::crystal::UnitCell::set_a ( double  a)

Set the length of the a-axis.

Parameters
anew length of the a-axis in Angstroms
Note
Will update other dependent values e.g. volume etc. No checking is performed.

◆ set_alpha()

void occ::crystal::UnitCell::set_alpha ( double  alpha)

Set the angle of between the b- and c-axes.

Parameters
alphanew angle between the b- and c-axes in radians
Note
Will update other dependent values e.g. volume etc. No checking is performed.

◆ set_b()

void occ::crystal::UnitCell::set_b ( double  b)

Set the length of the b-axis.

Parameters
bnew length of the b-axis in Angstroms
Note
Will update other dependent values e.g. volume etc. No checking is performed.

◆ set_beta()

void occ::crystal::UnitCell::set_beta ( double  beta)

Set the angle of between the a- and c-axes.

Parameters
betanew angle between the a- and c-axes in radians
Note
Will update other dependent values e.g. volume etc. No checking is performed.

◆ set_c()

void occ::crystal::UnitCell::set_c ( double  c)

Set the length of the c-axis.

Parameters
cnew length of the c-axis in Angstroms
Note
Will update other dependent values e.g. volume etc. No checking is performed.

◆ set_gamma()

void occ::crystal::UnitCell::set_gamma ( double  gamma)

Set the angle of between the a- and b-axes.

Parameters
gammanew angle between the a- and b-axes in radians
Note
Will update other dependent values e.g. volume etc. No checking is performed.

◆ to_cartesian()

auto occ::crystal::UnitCell::to_cartesian ( const Mat3N &  coords) const
inline

Convert a given matrix of coordinates from fractional to Cartesian.

Parameters
coordsMat3N of fractional coordinates
Returns
Mat3N of Cartesian coordinates

◆ to_cartesian_adp()

Mat6N occ::crystal::UnitCell::to_cartesian_adp ( const Mat6N adp) const

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.

Parameters
adpMat6N of ADPs in fractional coordinates
Returns
Mat6N of ADPs in Cartesian coordinates

◆ to_fractional()

auto occ::crystal::UnitCell::to_fractional ( const Mat3N &  coords) const
inline

Convert a given matrix of coordinates from Cartesian to fractional.

Parameters
coordsMat3N of Cartesian coordinates
Returns
Mat3N of fractional coordinates

◆ to_fractional_adp()

Mat6N occ::crystal::UnitCell::to_fractional_adp ( const Mat6N adp) const

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.

Parameters
adpMat6N of ADPs in Cartesian coordinates
Returns
Mat6N of ADPs in fractional coordinates

◆ to_reciprocal()

auto occ::crystal::UnitCell::to_reciprocal ( const Mat3N &  coords) const
inline

Convert a given matrix of coordinates from Cartesian to fractional.

Parameters
coordsMat3N of Cartesian coordinates
Returns
Mat3N of fractional coordinates

◆ volume()

double occ::crystal::UnitCell::volume ( ) const
inline

Volume of the unit cell in cubic Angstroms.


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