# DiagonalizationSolver¶

class DiagonalizationSolver(bands_above_fermi_level=None, processes_per_kpoint=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 or Automatic. When set to All the total number of bands will be equal to the total number of basis functions. When set to Automatic an adaptive method will be used. For most systems, Automatic provides a major speed-up as compared to All. 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.
bandsAboveFermiLevel()
Returns: The initial guess for the number of bands above the Fermi level. int | All
processesPerKpoint()
Returns: Number of processes per kpoint. int

## 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:

• LAPACK is used when a single processor is used for each k-point, i.e. processes_per_kpoint=1.
• ELPA [nMBJ+14] is used when more than one processor is used for each k-point, e.g. processes_per_kpoint=2.

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

 [nMBJ+14] A. Marek, V. Blum, R. Johanni, V. Havu, B. Lang, T. Auckenthaler, A. Heinecke, H.-J. Bungartz, and H. Lederer. The elpa library: scalable parallel eigenvalue solutions for electronic structure theory and computational science. Journal of Physics: Condensed Matter, 26(21):213201, 2014. doi:10.1088/0953-8984/26/21/213201.