sisl.physics.sparse_physics module¶
Class implementation for an orbital system with, and without spin
-
class
sisl.physics.sparse_physics.
SparseOrbitalBZ
(geom, dim=1, dtype=None, nnzpr=None, **kwargs)[source]¶ Bases:
sisl.sparse_geometry.SparseOrbital
Sparse object containing the orbital connections in a Brillouin zone
It contains an intrinsic sparse matrix of the physical elements.
Assigning or changing elements is as easy as with standard
numpy
assignments:>>> S = SparseOrbitalBZ(...) >>> S[1,2] = 0.1
which assigns 0.1 as the element between orbital 2 and 3. (remember that Python is 0-based elements).
Attributes
S
dim
Number of components per element dkind
Data type of sparse elements (in str) dtype
Data type of sparse elements finalized
Whether the contained data is finalized and non-used elements have been removed geom
Associated geometry geometry
Associated geometry nnz
Number of non-zero elements orthogonal
True if the object is using an orthogonal basis shape
Shape of sparse matrix Methods
Sk
([k, dtype, gauge, format])Setup the overlap matrix for a given k-point align
(other)See SparseCSR.align
for detailsconstruct
(func[, na_iR, method, eta])Automatically construct the sparse model based on a function that does the setting up of the elements copy
([dtype])A copy of this object create_construct
(R, param)Create a simple function for passing to the construct
function.cut
(seps, axis, *args, **kwargs)Cuts the sparse orbital model into different parts. eigh
([k, atoms, gauge, eigvals_only, ...])Returns the eigenvalues of the physical quantity eigsh
([k, n, atoms, gauge, eigvals_only])Calculates a subset of eigenvalues of the physical quantity (default 10) eliminate_zeros
()Removes all zero elements from the sparse matrix empty
([keep])See SparseCSR.empty
for detailsfinalize
()Finalizes the model fromsp
(geom, P[, S])Read and return the object with possible overlap iter
([local])Iterations of the orbital space in the geometry, two indices from loop iter_nnz
([atom, orbital])Iterations of the non-zero elements repeat
(reps, axis)Create a repeated sparse orbital object, equivalent to Geometry.repeat
reset
([dim, dtype, nnzpr])The sparsity pattern is cleaned and every thing is reset. spsame
(other)Compare two sparse objects and check whether they have the same entries. sub
(atom)Create a subset of this sparse matrix by only retaining the elements corresponding to the atom
tile
(reps, axis)Create a tiled sparse orbital object, equivalent to Geometry.tile
tocsr
(index[, isc])Return a scipy.sparse.csr_matrix
of the specified indexCreate SparseOrbitalB model from geometry
Initializes an object using the
geom
object as the underlying geometry for the parameters that connects orbital elements.Attributes
S
dim
Number of components per element dkind
Data type of sparse elements (in str) dtype
Data type of sparse elements finalized
Whether the contained data is finalized and non-used elements have been removed geom
Associated geometry geometry
Associated geometry nnz
Number of non-zero elements orthogonal
True if the object is using an orthogonal basis shape
Shape of sparse matrix Methods
Sk
([k, dtype, gauge, format])Setup the overlap matrix for a given k-point align
(other)See SparseCSR.align
for detailsconstruct
(func[, na_iR, method, eta])Automatically construct the sparse model based on a function that does the setting up of the elements copy
([dtype])A copy of this object create_construct
(R, param)Create a simple function for passing to the construct
function.cut
(seps, axis, *args, **kwargs)Cuts the sparse orbital model into different parts. eigh
([k, atoms, gauge, eigvals_only, ...])Returns the eigenvalues of the physical quantity eigsh
([k, n, atoms, gauge, eigvals_only])Calculates a subset of eigenvalues of the physical quantity (default 10) eliminate_zeros
()Removes all zero elements from the sparse matrix empty
([keep])See SparseCSR.empty
for detailsfinalize
()Finalizes the model fromsp
(geom, P[, S])Read and return the object with possible overlap iter
([local])Iterations of the orbital space in the geometry, two indices from loop iter_nnz
([atom, orbital])Iterations of the non-zero elements repeat
(reps, axis)Create a repeated sparse orbital object, equivalent to Geometry.repeat
reset
([dim, dtype, nnzpr])The sparsity pattern is cleaned and every thing is reset. spsame
(other)Compare two sparse objects and check whether they have the same entries. sub
(atom)Create a subset of this sparse matrix by only retaining the elements corresponding to the atom
tile
(reps, axis)Create a tiled sparse orbital object, equivalent to Geometry.tile
tocsr
(index[, isc])Return a scipy.sparse.csr_matrix
of the specified index-
S
¶
-
Sk
(k=(0, 0, 0), dtype=None, gauge='R', format='csr', *args, **kwargs)[source]¶ Setup the overlap matrix for a given k-point
Creation and return of the overlap matrix for a given k-point (default to Gamma).
Parameters: k : array_like
the k-point to setup the overlap at
dtype : numpy.dtype , optional
the data type of the returned matrix. Do NOT request non-complex data-type for non-Gamma k. The default data-type is ‘
numpy.complex128`
gauge : {‘R’, ‘r’}
the chosen gauge,
R
for cell vector gauge, andr
for orbital distance gauge.format : {‘csr’, ‘array’, ‘dense’, ‘coo’, ...}
the returned format of the matrix, defaulting to the
scipy.sparse.csr_matrix
, however if one always requires operations on dense matrices, one can always return innumpy.ndarray
('array'
) ornumpy.matrix
('dense'
).Notes
Currently the implemented gauge for the k-point is the cell vector gauge:
\[S(k) = S_{ij} e^{i k R}\]where \(R\) is an integer times the cell vector and \(i\), \(j\) are orbital indices.
Another possible gauge is the orbital distance which can be written as
\[S(k) = S_{ij} e^{i k r}\]where \(r\) is the distance between the orbitals \(i\) and \(j\). Currently the second gauge is not implemented (yet).
-
eigh
(k=(0, 0, 0), atoms=None, gauge='R', eigvals_only=True, overwrite_a=True, overwrite_b=True, *args, **kwargs)[source]¶ Returns the eigenvalues of the physical quantity
Setup the system and overlap matrix with respect to the given k-point, then reduce the space to the specified atoms and calculate the eigenvalues.
All subsequent arguments gets passed directly to
scipy.linalg.eigh
-
eigsh
(k=(0, 0, 0), n=10, atoms=None, gauge='R', eigvals_only=True, *args, **kwargs)[source]¶ Calculates a subset of eigenvalues of the physical quantity (default 10)
Setup the quantity and overlap matrix with respect to the given k-point, then reduce the space to the specified atoms and calculate a subset of the eigenvalues using the sparse algorithms.
All subsequent arguments gets passed directly to
scipy.linalg.eigsh
-
iter
(local=False)[source]¶ Iterations of the orbital space in the geometry, two indices from loop
An iterator returning the current atomic index and the corresponding orbital index.
>>> for ia, io in self:
In the above case
io
always belongs to atomia
andia
may be repeated according to the number of orbitals associated with the atomia
.Parameters: local :
bool=False
whether the orbital index is the global index, or the local index relative to the atom it resides on.
-
orthogonal
¶ True if the object is using an orthogonal basis
-
-
class
sisl.physics.sparse_physics.
SparseOrbitalBZSpin
(geom, dim=1, dtype=None, nnzpr=None, **kwargs)[source]¶ Bases:
sisl.physics.sparse_physics.SparseOrbitalBZ
Sparse object containing the orbital connections in a Brillouin zone with possible spin-components
It contains an intrinsic sparse matrix of the physical elements.
Assigning or changing elements is as easy as with standard
numpy
assignments:>>> S = SparseOrbitalBZSpin(...) >>> S[1,2] = 0.1
which assigns 0.1 as the element between orbital 2 and 3. (remember that Python is 0-based elements).
Attributes
S
dim
Number of components per element dkind
Data type of sparse elements (in str) dtype
Data type of sparse elements finalized
Whether the contained data is finalized and non-used elements have been removed geom
Associated geometry geometry
Associated geometry nnz
Number of non-zero elements orthogonal
True if the object is using an orthogonal basis shape
Shape of sparse matrix spin
Spin class Methods
Sk
([k, dtype, gauge, format])Setup the overlap matrix for a given k-point align
(other)See SparseCSR.align
for detailsconstruct
(func[, na_iR, method, eta])Automatically construct the sparse model based on a function that does the setting up of the elements copy
([dtype])A copy of this object create_construct
(R, param)Create a simple function for passing to the construct
function.cut
(seps, axis, *args, **kwargs)Cuts the sparse orbital model into different parts. eigh
([k, atoms, gauge, eigvals_only, ...])Returns the eigenvalues of the physical quantity eigsh
([k, n, atoms, gauge, eigvals_only])Calculates a subset of eigenvalues of the physical quantity (default 10) eliminate_zeros
()Removes all zero elements from the sparse matrix empty
([keep])See SparseCSR.empty
for detailsfinalize
()Finalizes the model fromsp
(geom, P[, S])Read and return the object with possible overlap iter
([local])Iterations of the orbital space in the geometry, two indices from loop iter_nnz
([atom, orbital])Iterations of the non-zero elements repeat
(reps, axis)Create a repeated sparse orbital object, equivalent to Geometry.repeat
reset
([dim, dtype, nnzpr])The sparsity pattern is cleaned and every thing is reset. spsame
(other)Compare two sparse objects and check whether they have the same entries. sub
(atom)Create a subset of this sparse matrix by only retaining the elements corresponding to the atom
tile
(reps, axis)Create a tiled sparse orbital object, equivalent to Geometry.tile
tocsr
(index[, isc])Return a scipy.sparse.csr_matrix
of the specified indexCreate SparseOrbitalBZSpin model from geometry
Initializes an object using the
geom
object as the underlying geometry for the parameters that connects orbital elements.Attributes
S
dim
Number of components per element dkind
Data type of sparse elements (in str) dtype
Data type of sparse elements finalized
Whether the contained data is finalized and non-used elements have been removed geom
Associated geometry geometry
Associated geometry nnz
Number of non-zero elements orthogonal
True if the object is using an orthogonal basis shape
Shape of sparse matrix spin
Spin class Methods
Sk
([k, dtype, gauge, format])Setup the overlap matrix for a given k-point align
(other)See SparseCSR.align
for detailsconstruct
(func[, na_iR, method, eta])Automatically construct the sparse model based on a function that does the setting up of the elements copy
([dtype])A copy of this object create_construct
(R, param)Create a simple function for passing to the construct
function.cut
(seps, axis, *args, **kwargs)Cuts the sparse orbital model into different parts. eigh
([k, atoms, gauge, eigvals_only, ...])Returns the eigenvalues of the physical quantity eigsh
([k, n, atoms, gauge, eigvals_only])Calculates a subset of eigenvalues of the physical quantity (default 10) eliminate_zeros
()Removes all zero elements from the sparse matrix empty
([keep])See SparseCSR.empty
for detailsfinalize
()Finalizes the model fromsp
(geom, P[, S])Read and return the object with possible overlap iter
([local])Iterations of the orbital space in the geometry, two indices from loop iter_nnz
([atom, orbital])Iterations of the non-zero elements repeat
(reps, axis)Create a repeated sparse orbital object, equivalent to Geometry.repeat
reset
([dim, dtype, nnzpr])The sparsity pattern is cleaned and every thing is reset. spsame
(other)Compare two sparse objects and check whether they have the same entries. sub
(atom)Create a subset of this sparse matrix by only retaining the elements corresponding to the atom
tile
(reps, axis)Create a tiled sparse orbital object, equivalent to Geometry.tile
tocsr
(index[, isc])Return a scipy.sparse.csr_matrix
of the specified index-
eigh
(k=(0, 0, 0), atoms=None, gauge='R', eigvals_only=True, overwrite_a=True, overwrite_b=True, *args, **kwargs)[source]¶ Returns the eigenvalues of the physical quantity
Setup the system and overlap matrix with respect to the given k-point, then reduce the space to the specified atoms and calculate the eigenvalues.
All subsequent arguments gets passed directly to
scipy.linalg.eigh
-
eigsh
(k=(0, 0, 0), n=10, atoms=None, gauge='R', eigvals_only=True, *args, **kwargs)[source]¶ Calculates a subset of eigenvalues of the physical quantity (default 10)
Setup the quantity and overlap matrix with respect to the given k-point, then reduce the space to the specified atoms and calculate a subset of the eigenvalues using the sparse algorithms.
All subsequent arguments gets passed directly to
scipy.linalg.eigsh
-
spin
¶ Spin class
-