The Cell object

The Cell object represents three lattice vectors forming a parallel epiped.

atoms.cell is a Cell object.


>>> from import bulk
>>> cell = bulk('Au').cell
>>> cell
Cell([[0.0, 2.04, 2.04], [2.04, 0.0, 2.04], [2.04, 2.04, 0.0]], pbc=True)

The cell behaves like a 3x3 array when used like one:

>>> cell[:]
array([[0.  , 2.04, 2.04],
       [2.04, 0.  , 2.04],
       [2.04, 2.04, 0.  ]])

Common functionality:

>>> cell.lengths()
array([2.88499567, 2.88499567, 2.88499567])
>>> cell.angles()
array([60., 60., 60.])
>>> cell.volume
class ase.cell.Cell(array)[source]

Parallel epipedal unit cell of up to three dimensions.

This object resembles a 3x3 array whose [i, j]-th element is the jth Cartesian coordinate of the ith unit vector.

Cells of less than three dimensions are represented by placeholder unit vectors that are zero.

Create cell.


array: 3x3 arraylike object

The three cell vectors: cell[0], cell[1], and cell[2].


Return an array with the three angles alpha, beta, and gamma.


Area spanned by the two vectors with index different from i.


Areas spanned by cell vector pairs (1, 2), (2, 0), and (0, 2).

classmethod ascell(cell)[source]

Return argument as a Cell object. See

A new Cell object is created if necessary.

bandpath(path: str = None, npoints: int = None, *, density: float = None, special_points: Mapping[str, Sequence[float]] = None, eps: float = 0.0002, pbc: Union[bool, Sequence[bool]] = True) BandPath[source]

Build a BandPath for this cell.

If special points are None, determine the Bravais lattice of this cell and return a suitable Brillouin zone path with standard special points.

If special special points are given, interpolate the path directly from the available data.


path: string

String of special point names defining the path, e.g. ‘GXL’.

npoints: int

Number of points in total. Note that at least one point is added for each special point in the path.

density: float

density of kpoints along the path in Å⁻¹.

special_points: dict

Dictionary mapping special points to scaled kpoint coordinates. For example {'G': [0, 0, 0], 'X': [1, 0, 0]}.

eps: float

Tolerance for determining Bravais lattice.

pbc: three bools

Whether cell is periodic in each direction. Normally not necessary. If cell has three nonzero cell vectors, use e.g. pbc=[1, 1, 0] to request a 2D bandpath nevertheless.


>>> from ase.cell import Cell
>>> cell = Cell.fromcellpar([4, 4, 4, 60, 60, 60])
>>> cell.bandpath('GXW', npoints=20)
BandPath(path='GXW', cell=[3x3], special_points={GKLUWX}, kpts=[20x3])
cartesian_positions(scaled_positions) ndarray[source]

Calculate Cartesian positions from scaled positions.


Get unit cell parameters. Sequence of 6 numbers.

First three are unit cell vector lengths and second three are angles between them:

[len(a), len(b), len(c), angle(b,c), angle(a,c), angle(a,b)]

in degrees.

See also ase.geometry.cell.cell_to_cellpar().


Convert missing cell vectors into orthogonal unit vectors.


Return a copy of this cell.

classmethod fromcellpar(cellpar, ab_normal=(0, 0, 1), a_direction=None)[source]

Return new Cell from cell lengths and angles.

See also cellpar_to_cell().

get_bravais_lattice(eps=0.0002, *, pbc=True)[source]

Return BravaisLattice for this cell:

>>> from ase.cell import Cell
>>> cell = Cell.fromcellpar([4, 4, 4, 60, 60, 60])
>>> print(cell.get_bravais_lattice())


The Bravais lattice object follows the AFlow conventions. cell.get_bravais_lattice().tocell() may differ from the original cell by a permutation or other operation which maps it to the AFlow convention. For example, the orthorhombic lattice enforces a < b < c.

To build a bandpath for a particular cell, use ase.cell.Cell.bandpath() instead of this method. This maps the kpoints back to the original input cell.

property handedness: int

Sign of the determinant of the matrix of cell vectors.

1 for right-handed cells, -1 for left, and 0 for cells that do not span three dimensions.


Return the length of each lattice vector as an array.


Boolean mask of which cell vectors are nonzero.


Minkowski-reduce this cell, returning new cell and mapping.

See also ase.geometry.minkowski_reduction.minkowski_reduce().

classmethod new(cell=None)[source]

Create new cell from any parameters.

If cell is three numbers, assume three lengths with right angles.

If cell is six numbers, assume three lengths, then three angles.

If cell is 3x3, assume three cell vectors.


Niggli reduce this cell, returning a new cell and mapping.

See also


Normal vector of the two vectors with index different from i.

This is the cross product of those vectors in cyclic order from i.


Normal vectors of each axis as a 3x3 matrix.

property orthorhombic: bool

Return whether this cell is represented by a diagonal matrix.


Permute axes of cell.

property rank: int

“Return the dimension of the cell.

Equal to the number of nonzero lattice vectors.

reciprocal() Cell[source]

Get reciprocal lattice as a Cell object.

The reciprocal cell is defined such that

cell.reciprocal() @ cell.T == np.diag(cell.mask())

within machine precision.

Does not include factor of 2 pi.

scaled_positions(positions) ndarray[source]

Calculate scaled positions from Cartesian positions.

The scaled positions are the positions given in the basis of the cell vectors. For the purpose of defining the basis, cell vectors that are zero will be replaced by unit vectors as per complete().


Rotate axes such that unit cell is lower triangular. The cell handedness is preserved.

A lower-triangular cell with positive diagonal entries is a canonical (i.e. unique) description. For a left-handed cell the diagonal entries are negative.


rcell: the standardized cell object

Q: ndarray

The orthogonal transformation. Here, rcell @ Q = cell, where cell is the input cell and rcell is the lower triangular (output) cell.


Return new cell, zeroing cell vectors where not periodic.

property volume: float

Get the volume of this cell.

If there are less than 3 lattice vectors, return 0.