UnitCell class

class chemfiles.CellShape(value)

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(lengths, angles=(90.0, 90.0, 90.0))

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

An unit cell is fully represented by three lengths (a, b, c); and three angles (alpha, beta, gamma). The angles are stored in degrees, and the lengths 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 the given cell lengths and cell angles. If lengths is a 3x3 matrix, it is taken to be the unit cell matrix, and angles is ignored.

If the three angles 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 lengths 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(vector)

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