The Cell object

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

atoms.cell is a Cell object.

Examples:

>>> from ase.build 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
16.979328000000002
class ase.cell.Cell(array, pbc=None)[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.

Parameters:

array: 3x3 arraylike object

The three cell vectors.

pbc: None or 3 booleans

For each cell vector, whether the system is periodic in the direction of that cell vector. If not given, the cell will be periodic along directions with nonzero cell vectors.

angles()[source]

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

classmethod ascell(cell)[source]

Return argument as a Cell object. See ase.cell.Cell.new().

A new Cell object is created if necessary.

bandpath(path=None, npoints=None, density=None, special_points=None, eps=0.0002)[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.

Parameters:

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.

Example

>>> 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)[source]

Calculate Cartesian positions from scaled positions.

cellpar(radians=False)[source]

Get cell lengths and angles of this cell.

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

complete()[source]

Convert missing cell vectors into orthogonal unit vectors.

copy()[source]

Return a copy of this cell.

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

Return new Cell from cell lengths and angles.

See also cellpar_to_cell().

get_bravais_lattice(eps=0.0002)[source]

Return BravaisLattice for this cell:

>>> cell = Cell.fromcellpar([4, 4, 4, 60, 60, 60])
>>> print(cell.get_bravais_lattice())
FCC(a=5.65685)

Note

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.

lengths()[source]

Return the length of each lattice vector as an array.

minkowski_reduce()[source]

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

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

classmethod new(cell=None, pbc=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(eps=1e-05)[source]

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

See also ase.build.tools.niggli_reduce_cell().

oldbandpath(path=None, npoints=None, density=None, eps=0.0002)[source]

Legacy implementation, please ignore.

property orthorhombic

Return whether this cell is represented by a diagonal matrix.

property rank

“Return the dimension of the cell.

Equal to the number of nonzero lattice vectors.

reciprocal()[source]

Get reciprocal lattice as a 3x3 array.

Does not include factor of 2 pi.

scaled_positions(positions)[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().

property volume

Get the volume of this cell.

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