sisl.supercell module¶
Define a supercell
This class is the basis of many different objects.
-
class
sisl.supercell.
SuperCell
(cell, nsc=None)[source]¶ Bases:
object
Object to retain a super-cell and its nested values.
This supercell object handles cell vectors and its supercell mirrors.
Attributes
rcell
Returns the reciprocal cell for the SuperCell
without2*np.pi
Methods
add_vacuum
(vacuum, axis)Add vacuum along the axis
lattice vectorappend
(other, axis)Appends other SuperCell
to this grid along axiscenter
([axis])Returns center of the SuperCell
, possibly with respect to an axiscopy
()Returns a copy of the object. cut
(seps, axis)Cuts the cell into several different sections. fit
(xyz[, axis, tol])Fit the supercell to xyz
such that the unit-cell becomes periodic in the specified directionsis_orthogonal
()Returns true if the cell vectors are orthogonal move
(v)Appends additional space in the SuperCell object offset
([isc])Returns the supercell offset of the supercell index parallel
(other[, axis])Returns true if the cell vectors are parallel to other
prepend
(other, axis)Prepends other SuperCell
to this grid along axisread
(sile, *args, **kwargs)Reads SuperCell from the Sile
usingSile.read_supercell
rotate
(angle, v[, only, radians])Rotates the supercell, in-place by the angle around the vector rotatea
(angle[, only, radians])rotateb
(angle[, only, radians])rotatec
(angle[, only, radians])sc_index
(sc_off)Returns the integer index in the sc_off list that corresponds to sc_off
scale
(scale)Scale lattice vectors set_nsc
([nsc, a, b, c])Sets the number of supercells in the 3 different cell directions set_supercell
([nsc, a, b, c])Sets the number of supercells in the 3 different cell directions swapaxes
(a, b)Returns SuperCell
with swapped axistocell
(*args)Returns a 3x3 unit-cell dependent on the input translate
(v)Appends additional space in the SuperCell object Initialize a
SuperCell
object from initial quantitiesInitialize a
SuperCell
object with cell information and number of supercells in each direction.Attributes
rcell
Returns the reciprocal cell for the SuperCell
without2*np.pi
Methods
add_vacuum
(vacuum, axis)Add vacuum along the axis
lattice vectorappend
(other, axis)Appends other SuperCell
to this grid along axiscenter
([axis])Returns center of the SuperCell
, possibly with respect to an axiscopy
()Returns a copy of the object. cut
(seps, axis)Cuts the cell into several different sections. fit
(xyz[, axis, tol])Fit the supercell to xyz
such that the unit-cell becomes periodic in the specified directionsis_orthogonal
()Returns true if the cell vectors are orthogonal move
(v)Appends additional space in the SuperCell object offset
([isc])Returns the supercell offset of the supercell index parallel
(other[, axis])Returns true if the cell vectors are parallel to other
prepend
(other, axis)Prepends other SuperCell
to this grid along axisread
(sile, *args, **kwargs)Reads SuperCell from the Sile
usingSile.read_supercell
rotate
(angle, v[, only, radians])Rotates the supercell, in-place by the angle around the vector rotatea
(angle[, only, radians])rotateb
(angle[, only, radians])rotatec
(angle[, only, radians])sc_index
(sc_off)Returns the integer index in the sc_off list that corresponds to sc_off
scale
(scale)Scale lattice vectors set_nsc
([nsc, a, b, c])Sets the number of supercells in the 3 different cell directions set_supercell
([nsc, a, b, c])Sets the number of supercells in the 3 different cell directions swapaxes
(a, b)Returns SuperCell
with swapped axistocell
(*args)Returns a 3x3 unit-cell dependent on the input translate
(v)Appends additional space in the SuperCell object -
add_vacuum
(vacuum, axis)[source]¶ Add vacuum along the
axis
lattice vectorParameters: vacuum : float
amount of vacuum added, in Ang
axis : int
the lattice vector to add vacuum along
-
cell
¶
-
fit
(xyz, axis=None, tol=0.05)[source]¶ Fit the supercell to
xyz
such that the unit-cell becomes periodic in the specified directionsThe fitted supercell tries to determine the unit-cell parameters by solving a set of linear equations corresponding to the current supercell vectors.
>>> numpy.linalg.solve(self.cell.T, xyz.T)
Parameters: xyz : array_like
shape(*, 3)
the coordinates that we will wish to encompass and analyze.
axis : None or array_like
if
None
equivalent to[0, 1, 2]
, else only the cell-vectors along the provided axis will be usedtol : float
tolerance (in Angstrom) of the positions. I.e. we neglect coordinates which are not within the radius of this magnitude
-
n_s
¶
-
nsc
¶
-
parallel
(other, axis=(0, 1, 2))[source]¶ Returns true if the cell vectors are parallel to
other
Parameters: other : SuperCell
the other object to check whether the axis are parallel
axis : int or array_like
only check the specified axis (default to all)
-
rcell
¶ Returns the reciprocal cell for the
SuperCell
without2*np.pi
Note: The returned vectors are still in [0,:] format and not as returned by an inverse LAPACK algorithm.
-
static
read
(sile, *args, **kwargs)[source]¶ Reads SuperCell from the
Sile
usingSile.read_supercell
Parameters: sile :
Sile
, str
-
rotate
(angle, v, only='abc', radians=False)[source]¶ Rotates the supercell, in-place by the angle around the vector
One can control which cell vectors are rotated by designating them individually with
only='[abc]'
.Parameters: angle : float
the angle of which the geometry should be rotated
v : array_like [3]
the vector around the rotation is going to happen v = [1,0,0] will rotate in the
yz
planeradians : bool, False
Whether the angle is in radians (True) or in degrees (False)
only : (‘abc’), str, optional
only rotate the designated cell vectors.
-
sc_index
(sc_off)[source]¶ Returns the integer index in the sc_off list that corresponds to
sc_off
Returns the integer for the supercell
-
sc_off
¶
-
scale
(scale)[source]¶ Scale lattice vectors
Parameters: scale :
float
the scale factor for the new lattice vectors
-
set_nsc
(nsc=None, a=None, b=None, c=None)[source]¶ Sets the number of supercells in the 3 different cell directions
- nsc: [3], integer, optional
- number of supercells in each direction
- a: integer, optional
- number of supercells in the first unit-cell vector direction
- b: integer, optional
- number of supercells in the second unit-cell vector direction
- c: integer, optional
- number of supercells in the third unit-cell vector direction
-
set_supercell
(nsc=None, a=None, b=None, c=None)¶ Sets the number of supercells in the 3 different cell directions
- nsc: [3], integer, optional
- number of supercells in each direction
- a: integer, optional
- number of supercells in the first unit-cell vector direction
- b: integer, optional
- number of supercells in the second unit-cell vector direction
- c: integer, optional
- number of supercells in the third unit-cell vector direction
-
swapaxes
(a, b)[source]¶ Returns
SuperCell
with swapped axisIf
swapaxes(0,1)
it returns the 0 in the 1 values.
-
classmethod
tocell
(*args)[source]¶ Returns a 3x3 unit-cell dependent on the input
If you supply a single argument it is regarded as either a) a proper unit-cell b) the diagonal elements in the unit-cell
If you supply 3 arguments it will be the same as the diagonal elements of the unit-cell
If you supply 6 arguments it will be the same as the cell parameters, a, b, c, alpha, beta, gamma. The angles should be provided in degree (not radians).
-
translate
(v)¶ Appends additional space in the SuperCell object
-
vol
¶
-
-
class
sisl.supercell.
SuperCellChild
[source]¶ Bases:
object
Class to be inherited by using the
self.sc
as aSuperCell
objectInitialize by a
SuperCell
object and get access to several different routines directly related to theSuperCell
class.Attributes
cell
Returns the inherent SuperCell
objectscell
n_s
Returns the inherent SuperCell
objectsn_s
nsc
Returns the inherent SuperCell
objectsnsc
rcell
Returns the inherent SuperCell
objectsrcell
sc_off
Returns the inherent SuperCell
objectssc_off
vol
Returns the inherent SuperCell
objectsvol
Methods
add_vacuum
(vacuum, axis)Add vacuum along the axis
lattice vectoris_orthogonal
()Return true if all cell vectors are linearly independent sc_index
(*args, **kwargs)Call local SuperCell
objectsc_index
functionset_nsc
(nsc)Set the number of super-cells in the SuperCell
objectset_sc
(sc)Overwrites the local supercell set_supercell
(sc)Overwrites the local supercell -
add_vacuum
(vacuum, axis)[source]¶ Add vacuum along the
axis
lattice vectorParameters: vacuum : float
amount of vacuum added, in Ang
axis : int
the lattice vector to add vacuum along
-
set_sc
(sc)¶ Overwrites the local supercell
-