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)[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: cell[0], cell[1], and cell[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: 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.
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.
- 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.
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 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()
.
- 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 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.
- 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.
- 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()
.
- standard_form()[source]¶
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.
Returns:
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.