# Unit Cell¶

class chemfiles::UnitCell

An UnitCell represent the box containing the atoms, and its periodicity

A unit cell is fully represented by three lenghts (a, b, c); and three angles (alpha, beta, gamma). The angles are stored in degrees, and the lenghts in Angstroms.

A cell also has a matricial representation, by projecting the three base vector into an orthonormal base. We choose to represent such matrix as an upper triangular matrix:

 | a_x b_x c_x | | 0 b_y c_y | | 0 0 c_z | 

Public Types

enum CellShape

Possible shapes for the unit cell.

Values:

ORTHORHOMBIC = 0

Orthorhombic cell, with the three angles equals to 90°

TRICLINIC = 1

Triclinic cell, with any values for the angles.

INFINITE = 2

Infinite cell, to use when there is no cell.

Public Functions

UnitCell(const UnitCell &other)

Copy constructor.

UnitCell(UnitCell &&other)

Move constructor.

UnitCell()

Construct an INFINITE unit cell.

UnitCell(double a)

Construct a cubic unit cell of side size a.

UnitCell(double a, double b, double c)

Construct an ORTHOROMBIC unit cell of side size a, b, c.

UnitCell(double a, double b, double c, double alpha, double beta, double gamma)

Construct a TRICLINIC unit cell of side size a, b, c, and cell angles alpha, beta, gamma

UnitCell(CellShape shape)

Construct a cell of type type, with all lenghts set to 0 and all angles set to 90°

UnitCell(CellShape shape, double a)

Construct a cell of type type, with all lenghts set to a and all angles set to 90°

UnitCell(CellShape shape, double a, double b, double c)

Construct a cell of type type, with lenghts set to a ,b, d, and all angles set to 90°

Matrix3D matricial() const

Get a matricial representation of the cell.

void raw_matricial(double matrix[3][3]) const

Populate C-style matricial representation of the cell. The array should have a 3 x 3 size.

CellShape shape() const

Get the cell shape.

void shape(CellShape shape)

Set the cell shape to shape.

double a() const

Get the first lenght (a) of the cell.

void set_a(double val)

Set the first lenght (a) of the cell.

double b() const

Get the second lenght (b) of the cell.

void set_b(double val)

Set the second lenght (b) of the cell.

double c() const

Get the third lenght (c) of the cell.

void set_c(double val)

Set the third lenght (c) of the cell.

double alpha() const

Get the first angle (alpha) of the cell.

void set_alpha(double val)

Set the first angle (alpha) of the cell if possible.

double beta() const

Get the second angle (beta) of the cell.

void set_beta(double val)

Set the second angle (beta) of the cell if possible.

double gamma() const

Get the third angle (gamma) of the cell.

void set_gamma(double val)

Set the third angle (gamma) of the cell if possible.

double volume() const

Get the unit cell volume.

Vector3D wrap(const Vector3D &vect) const

Wrap the vector vect in the unit cell, using periodic boundary conditions.