DiagonalizationSolver¶
- class DiagonalizationSolver(bands_above_fermi_level=None, processes_per_kpoint=None, optimize_for_speed_over_memory=None)¶
Calculate the density matrix by direct diagonalization.
- Parameters:
bands_above_fermi_level (int |
Automatic
|All
) – The number of bands above the Fermi level. Must be either a non-negative integer,All
orAutomatic
. When set toAll
the total number of bands will be equal to the total number of basis functions. When set toAutomatic
an adaptive method will be used. For most systems,Automatic
provides a major speed-up as compared toAll
. If the number of states above the Fermi level changes significantly from one diagonalization step to another, the adapative method may lead to slowing down of the calculation. Default:Automatic
processes_per_kpoint (int) – The number of processes to use per kpoint. Must be a positive integer. Default: The number will be determined automatically from the total number of k-points and processes such as to keep the number as small as possible. One may set this number manually in order to reduce the memory requirements for each process.
optimize_for_speed_over_memory (bool) – Whether to optimize the diagonalization for speed over memory. If True, the solver will determine the most optimal algorithm in terms of speed. Note that optimizing for speed can increase the memory usage by up to 30 %. Note also that this flag only has an effect if
processes_per_kpoint=1
, or the automatic value forprocesses_per_kpoint=1
turns out to be 1. It is intended to be used for medium-sized to large systems with many k-points. Default: False
- bandsAboveFermiLevel()¶
- Returns:
The initial guess for the number of bands above the Fermi level.
- Return type:
int |
All
- optimizeForSpeedOverMemory()¶
- Returns:
Whether the diagonalization should be optimized for speed over memory.
- Return type:
bool
- processesPerKpoint()¶
- Returns:
Number of processes per kpoint.
- Return type:
int
- uniqueString()¶
Return a unique string representing the state of the object.
Usage Example¶
Define a density matrix method that uses the DiagonalizationSolver:
algorithm_parameters = AlgorithmParameters(
density_matrix_method = DiagonalizationSolver())
Notes¶
Diagonalization algorithm¶
The library used for diagonalization of the LCAO Hamiltonian depends on the value
of the parameter processes_per_kpoint
:
Number of bands included in the diagonalization¶
When the parameter bands_above_fermi_level
is set to Automatic
(default),
the diagonalization solver uses an adaptive method. The method determines the number of
occupied bands to include when diagonalizing the Hamiltonian after
each diagonalization step. Then, it increases the number of occupied states by
a large enough margin such that the next diagonalization step is guaranteed to
include all occupied bands.
Attention
If the number of bands above the Fermi level is too low such that not all
occupied states are included, the diagonalization is repeated with an increased number
of bands. This can slow down the calculation, and therefore setting bands_above_fermi_level
manually is not recommended.
The behavior of bands_above_fermi_level
with regard to the spin type UNPOLARIZED,
POLARIZED, and NONCOLLINEAR is described in Notes of the
Bandstructure analysis object.