UnitCell class

class chemfiles.CellShape

Available cell shapes in Chemfiles:

  • CellType.Orthorhombic: for cells where the three angles are 90°;

  • CellType.Triclinic: for cells where the three angles may not be 90°;

  • CellType.Infinite: for cells without periodic boundary conditions;

class chemfiles.UnitCell(a, b, c, alpha=90.0, beta=90.0, gamma=90.0)

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

An 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. The cell angles are defined as follow: alpha is the angles between the cell vectors b and c; beta as the angle between a and c; and gamma as the angle between a and b.

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 |

Create a new UnitCell with cell lenghts of a, b and c, and cell angles alpha, beta and gamma.

If alpha, beta and gamma are equal to 90.0, the new unit cell shape is CellShape.Orthorhombic. Else it is CellShape.Infinite.

property angles

Get the three angles of this UnitCell, in degrees.

property lengths

Get the three lenghts of this UnitCell, in Angstroms.

property matrix

Get this UnitCell matricial representation.

The matricial representation is obtained by aligning the a vector along the x axis and putting the b vector in the xy plane. This make the matrix an upper triangular matrix:

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

Get the shape of this UnitCell.

property volume

Get the volume of this UnitCell.


Wrap a vector in this UnitCell, and return the wrapped vector.