Class Avogadro::Core::UnitCell#

class UnitCell#

The UnitCell class provides a representation of a crystal’s unit cell.

Unnamed Group

inline Vector3 aVector() const#

The lattice vector in the unit cell. Units: Angstrom

inline Vector3 bVector() const#

The lattice vector in the unit cell. Units: Angstrom

inline Vector3 cVector() const#

The lattice vector in the unit cell. Units: Angstrom

inline void setAVector(const Vector3 &v)#

The lattice vector in the unit cell. Units: Angstrom

inline void setBVector(const Vector3 &v)#

The lattice vector in the unit cell. Units: Angstrom

inline void setCVector(const Vector3 &v)#

The lattice vector in the unit cell. Units: Angstrom

Unnamed Group

inline Real a() const#

The length of the lattice vector in the unit cell. Units: Angstrom

inline Real b() const#

The length of the lattice vector in the unit cell. Units: Angstrom

inline Real c() const#

The length of the lattice vector in the unit cell. Units: Angstrom

Unnamed Group

inline const Matrix3 &cellMatrix() const#

The cell matrix with lattice vectors as columns. Units: Angstrom

inline void setCellMatrix(const Matrix3 &m)#

The cell matrix with lattice vectors as columns. Units: Angstrom

Unnamed Group

inline Vector3 toFractional(const Vector3 &cart) const#

Convert the cartesian coordinate cart to fractional (lattice) units.

inline void toFractional(const Vector3 &cart, Vector3 &frac) const#

Convert the cartesian coordinate cart to fractional (lattice) units.

inline Vector3 toCartesian(const Vector3 &frac) const#

Convert the fractional (lattice) coordinate frac to cartesian units.

inline void toCartesian(const Vector3 &frac, Vector3 &cart) const#

Convert the cartesian coordinate cart to fractional (lattice) units.

Unnamed Group

inline Vector3 wrapFractional(const Vector3 &frac) const#

Adjust the fractional (lattice) coordinate frac so that it lies within the unit cell.

inline void wrapFractional(const Vector3 &frac, Vector3 &wrapped) const#

Adjust the fractional (lattice) coordinate frac so that it lies within the unit cell.

Unnamed Group

inline Vector3 wrapCartesian(const Vector3 &cart) const#

Adjust the cartesian coordinate cart so that it lies within the unit cell.

inline void wrapCartesian(const Vector3 &cart, Vector3 &wrapped) const#

Adjust the cartesian coordinate cart so that it lies within the unit cell.

Public Functions

inline UnitCell()#
inline UnitCell(Real a, Real b, Real c, Real alpha, Real beta, Real gamma)#
inline UnitCell(const Vector3 &a, const Vector3 &b, const Vector3 &c)#
inline explicit UnitCell(const Matrix3 &cellMatrix)#
inline UnitCell(const UnitCell &other)#
inline ~UnitCell()#
inline UnitCell &operator=(UnitCell other)#
inline Real alpha() const#

The angle (radians) between the ‘b’ and ‘c’ lattice vectors.

inline Real beta() const#

The angle (radians) between the ‘c’ and ‘a’ lattice vectors.

inline Real gamma() const#

The angle (radians) between the ‘a’ and ‘b’ lattice vectors.

void setCellParameters(Real a, Real b, Real c, Real alpha, Real beta, Real gamma)#

Set the cell parameters defining the unit cell. a, b, and c are in Angstrom, alpha, beta, and gamma are in radians.

inline Real volume() const#

The volume of the unit cell in cubic Angstroms.

inline Vector3 imageOffset(int i, int j, int k) const#
Returns:

A vector pointing to the origin of the translational image that is i images in the a() direction, j images in the b() direction, and k images in the c() direction.

inline const Matrix3 &fractionalMatrix() const#

The matrix used to convert cartesian to fractional coordinates.

inline void setFractionalMatrix(const Matrix3 &m)#
inline Vector3 minimumImage(const Vector3 &v) const#

Find the minimum image of a Cartesian vector v. A minimum image has all fractional coordinates between -0.5 and 0.5

inline Real distance(const Vector3 &v1, const Vector3 &v2) const#

Find the shortest distance between vectors v1 and v2.

Public Static Functions

static inline Vector3 minimumImageFractional(const Vector3 &v)#

Find the minimum fractional image of a fractional vector v. A minimum image has all fractional coordinates between -0.5 and 0.5.

Friends

friend void swap(UnitCell &lhs, UnitCell &rhs)#