The Cell object — ASE documentation (2024)

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>>> cellCell([[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.volume16.979328000000002
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 jthCartesian coordinate of the ith unit vector.

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

Create cell.

Parameters:

array: 3x3 arraylike object

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

angles()[source]

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

area(i)[source]

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

areas()[source]

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

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: str = None, npoints: int = None, *, density: float = None, special_points: Mapping[str, Sequence[float]] = None, eps: float = 0.0002, pbc: bool | Sequence[bool] = True) BandPath[source]

Build a BandPath for this cell.

If special points are None, determine the Bravais lattice ofthis cell and return a suitable Brillouin zone path withstandard special points.

If special special points are given, interpolate the pathdirectly 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 pointis 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 notnecessary. If cell has three nonzero cell vectors, usee.g. pbc=[1, 1, 0] to request a 2D bandpath nevertheless.

Example

>>> 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.

cellpar(radians=False)[source]

Get unit cell parameters. Sequence of 6 numbers.

First three are unit cell vector lengths and second threeare 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().

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)[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())FCC(a=5.65685)

Note

The Bravais lattice object follows the AFlowconventions. cell.get_bravais_lattice().tocell() maydiffer from the original cell by a permutation or otheroperation which maps it to the AFlow convention. Forexample, the orthorhombic lattice enforces a < b < c.

To build a bandpath for a particular cell, usease.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 thatdo not span three dimensions.

lengths()[source]

Return the length of each lattice vector as an array.

mask()[source]

Boolean mask of which cell vectors are nonzero.

minkowski_reduce()[source]

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(eps=1e-05)[source]

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

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

normal(i)[source]

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

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

normals()[source]

Normal vectors of each axis as a 3x3 matrix.

property orthorhombic: bool

Return whether this cell is represented by a diagonal matrix.

permute_axes(permutation)[source]

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 basisof the cell vectors. For the purpose of defining the basis, cellvectors that are zero will be replaced by unit vectors as percomplete().

standard_form()[source]

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

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

Returns:

rcell: the standardized cell object

Q: ndarray

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

uncomplete(pbc)[source]

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.

The Cell object — ASE  documentation (2024)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Tyson Zemlak

Last Updated:

Views: 5750

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.