Name

calculateEigenstateOccupations Calculates the occupation of eigenstates for a molecule.

Synopsis

Namespace: ATK.KohnSham
array calculateEigenstateOccupations(self_consistent_calculation)

Description

The function calculateEigenstateOccupations() calculates and returns the occupation of each eigenstate for a molecule.

List of arguments

self_consistent_calculation

An object returned from a previously performed self-consistent calculation on a MoleculeConfiguration object.

Default: None

Usage examples

Definition of a function printSpectrumWithOccupations() for printing a formatted list of molecular eigenenergies including their respective occupations. The function works for both calculations that are spin-polarized and not:

def f(x,pad=15):
    if isinstance(x,int):
        s = "%i" % x
    else:
        s = "%.4g" % x
    return s.rjust(pad)
    
def printSpectrumWithOccupations(self_consistent_calculation):
    spectrum = calculateMolecularEnergySpectrum(self_consistent_calculation)
    energies = spectrum.energies()
    occ = calculateEigenstateOccupations(self_consistent_calculation)
    if len(energies.shape)==2:
        # spin-polarized
        print '                Spin Up                       Spin Down'
        print 'Level   Energy (eV)     Occupation    Energy (eV)     Occupation'
        print '----------------------------------------------------------------'
        for i in range(energies.shape[1]):
            print "%s%s%s%s%s" % ( f(i,2),
                f(energies[0,i].inUnitsOf(eV)),f(occ[0,i]),
                f(energies[1,i].inUnitsOf(eV)),f(occ[1,i]) )
    else:
        # not spin-polarized
        print 'Level   Energy (eV)     Occupation'
        for i in range(len(energies)):
            print "%s%s%s" % ( f(i,2),f(energies[i].inUnitsOf(eV)),f(occ[i]) )

The function f()> is used for padding the numbers with spaces, to make the columns right-justified.

Notes

The dimensionality of the returned NumPy array will be:

  • (2, n_\mathrm{states}) for spin-polarized molecular calculations;

  • (n_\mathrm{states}) for unpolarized molecular calculations;

  • (2, n_\mathrm{bands}, n_\mathrm{\mathbf{k}-points}) for spin-polarized bulk calculations;

  • (n_\mathrm{bands}) for unpolarized bulk calculations;

where n_\mathrm{states} is the number of eigenstates (for molecules), and n_\mathrm{bands} is the number of energy bands (for bulk). Note that the number of k-points, n_\mathrm{\mathbf{k}-points}, refers to the Monkhorst-Pack sampling used for solving the self-consistent problem, and not a specific band structure calculation. Use the shape property to check if the calculation is spin-polarized or not (see example above).

For bulk systems, the dimensionality of the returned NumPy array will be:

  • (2,n_\mathrm{states}) for spin-polarized calculations.

  • (n_\mathrm{states}) for unpolarized calculations.

where n_\mathrm{states} is the number of eigenstates. Use the shape property to check if the calculation is spin-polarized or not (see the example shown above).