pengwann.occupations.get_occupation_matrix#

occupations.get_occupation_matrix(eigenvalues, mu, nspin, occupation_function=<function fixed>, **function_kwargs)#

Reconstruct the occupation matrix from an ab-initio calculation.

Parameters:
eigenvaluesndarray of float

The Kohn-Sham eigenvalues.

mufloat

The Fermi level.

nspinint

The number of electrons per fully-occupied Kohn-Sham state. For non-spin-polarised calculations set to 2, for spin-polarised calculations set to 1.

occupation_functioncallable(), optional

The occupation function used to calculate the occupation matrix. Defaults to fixed() (i.e. fixed occupations).

**function_kwargs

Additional keyword arguments to be passed to occupation_function.

Returns:
occupation_matrixndarray of float

The occupation matrix.

Notes

Ideally the occupation matrix should be read in directly from the ab initio code (in which case this function is redundant). Failing that, the occupation matrix can be reconstructed so long as the correct occupation function is used.

Various pre-defined occupation functions (Gaussian, Marzari-Vanderbilt etc) can be found in this module. If none of these match the occupation function used by the ab initio code, a custom occupation function can be defined and passed as occupation_function (so long as it takes eigenvalues and mu as the first two positional arguments).