UnitCell¶
-
class UnitCell¶
An UnitCell represent the box containing the atoms, and its periodicity
A unit cell is represented by the cell matrix, containing the three cell vectors:
| a_x b_x c_x | | a_y b_y c_y | | a_z b_z c_z |
Public Types
Public Functions
-
UnitCell()¶
Construct an
INFINITE
unit cell, with all lengths set to 0
-
UnitCell(Vector3D lengths, Vector3D angles)¶
Construct a unit cell with the given cell
lengths
andangles
If all lengths are set to 0, then the cell is
INFINITE
. If at least one length is not zero and all angles are 90.0, then the cell isORTHORHOMBIC
. Else aTRICLINIC
cell is created.
-
UnitCell(Matrix3D matrix)¶
Construct a unit cell from a cell matrix.
If
matrix
contains only zeros, then an infinite cell is created. If only the diagonal of the matrix is non-zero, then the cell isORTHORHOMBIC
. Else aTRICLINIC
cell is created. The matrix entries should be in Angstroms.
-
void set_shape(CellShape shape)¶
Set the cell shape to
shape
- Throws:
Error – if
shape
isORTHORHOMBIC
and some angles are not 90°, or ifshape
isINFINITE
and some lengths are not 0.0.
-
void set_lengths(Vector3D lengths)¶
Set the lengths of the cell’s vectors. The values should be in angstroms.
This function reset cell orientation!
After the call, the cell is aligned such that the first cell vector is along the x axis, and the second cell vector is in the xy plane.
- Throws:
Error – if the cell shape is
INFINITE
.
-
void set_angles(Vector3D angles)¶
Set the angles between the cell’s vectors. The values should be in degrees.
This function reset cell orientation!
After the call, the cell is aligned such that the first cell vector is along the x axis, and the second cell vector is in the xy plane.
- Throws:
Error – if the cell shape is not
TRICLINIC
.
-
double volume() const¶
Get the unit cell volume
-
UnitCell()¶