MolecularEnergySpectrum

class MolecularEnergySpectrum(configuration=None, energy_zero_parameter=None, projection_list=None)

Class for calculating the molecular energy spectrum for a configuration.

Parameters:
  • configuration (MoleculeConfiguration | BulkConfiguration | DeviceConfiguration | SurfaceConfiguration) – The configuration the molecular energy spectrum should be calculated for.

  • energy_zero_parameter (FermiLevel | AbsoluteEnergy) – Specifies the choice for the energy zero.
    Default: FermiLevel

  • projection_list (ProjectionList) – Specifies the orbitals within the configuration to include in the calculation.
    Default: ProjectionList(All) - All atoms included.

degeneracy()
Returns:

The spin degeneracy for the spectrum. That is, 2 for Unpolarized spin type, else 1.

Return type:

float

determineHomoEnergy(spin=<class 'NL.ComputerScienceUtilities.NLFlag.Spin.All'>)

Determine the HOMO energy for the molecule for the given spin channel. For polarized calculations with fixed spin momentum, the average of 2 Fermi levels is used.

Parameters:

spin (Spin.Up | Spin.Down | Spin.All) – The spin for which the HOMO energy should be returned. For Spin.All, the returned energy is the highest of all spin channels.
Default: Spin.All

Returns:

The molecular energy of HOMO.

Return type:

PhysicalQuantity of type energy

determineHomoLumoGap(spin=<class 'NL.ComputerScienceUtilities.NLFlag.Spin.All'>)

Determine the HOMO-LUMO gap for the molecule for the given spin channel. For polarized calculations with fixed spin momentum, the average of 2 Fermi levels is used.

Parameters:

spin (Spin.Up | Spin.Down | Spin.All) – The spin for which the LUMO energy should be returned. For Spin.All, the returned energy is the lowest of all spin channels.
Default: Spin.All

Returns:

The HOMO-LUMO gap energy.

Return type:

PhysicalQuantity of type energy

determineLumoEnergy(spin=<class 'NL.ComputerScienceUtilities.NLFlag.Spin.All'>)

Determine the LUMO energy for the molecule for the given spin channel. For polarized calculations with fixed spin momentum, the average of 2 Fermi levels is used.

Parameters:

spin (Spin.Up | Spin.Down | Spin.All) – The spin for which the LUMO energy should be returned. For Spin.All, the returned energy is the lowest of all spin channels.
Default: Spin.All

Returns:

The molecular energy of LUMO.

Return type:

PhysicalQuantity of type energy

energyZero()

Return the energy zero used for the energy scale in this molecular energy spectrum.

Returns:

The energy zero used for the energy scale in this molecular energy spectrum.

Return type:

PhysicalQuantity or type energy

evaluate(spin=None)

Return the molecular energy spectrum.

Parameters:

spin (Spin.Up | Spin.Down | Spin.All) – The spin for which the spectrum should be returned. For noncollinear and spin-orbit calculations, this must be Spin.All.
Default: Spin.Up for unpolarized calculations, else Spin.All

Returns:

The molecular energy spectrum as a PhysicalQuantity with one entry for each molecular eigenstate.

Return type:

PhysicalQuantity of type energy

fermiLevel(spin=None)
Parameters:

spin (Spin.Up | Spin.Down | Spin.All) – The spin the Fermi level should be returned for. Must be either Spin.Up, Spin.Down, or Spin.All. Only when the band structure is calculated with a fixed spin moment will the Fermi level depend on spin.
Default: Spin.Up

Returns:

The Fermi level in absolute energy.

Return type:

PhysicalQuantity of type energy

fermiTemperature()

Return the Fermi temperature used in this molecular energy spectrum.

Returns:

The Fermi temperature.

Return type:

PhysicalQuantity or type temperature

metatext()
Returns:

The metatext of the object or None if no metatext is present.

Return type:

str | None

nlprint(stream=None)

Print a string containing an ASCII table useful for plotting the AnalysisSpin object.

Parameters:

stream (python stream) – The stream the table should be written to.
Default: NLPrintLogger()

occupation()

Method for calculating the occupation for these eigenstates.

Returns:

The occupation for each orbital.

Return type:

list of float

projectionList()

Return the ProjectionList object used in this molecular energy spectrum.

Returns:

The ProjectionList object.

Return type:

ProjectionList

setMetatext(metatext)

Set a given metatext string on the object.

Parameters:

metatext (str | None) – The metatext string that should be set. A value of “None” can be given to remove the current metatext.

uniqueString()

Return a unique string representing the state of the object.

Usage Examples

Calculate the molecular energy spectrum of an ammonia molecule and print out the energy levels and occupations:

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=[Nitrogen, Hydrogen, Hydrogen, Hydrogen],
    cartesian_coordinates= [[ 0.      ,  0.      ,  0.124001],
                         [ 0.      ,  0.941173, -0.289336],
                         [ 0.81508 , -0.470587, -0.289336],
                         [-0.81508 , -0.470587, -0.289336]]*Angstrom )

# Define the calculator
calculator = HuckelCalculator()
molecule_configuration.setCalculator(calculator)

# Calculate and save the molecular energy spectrum
molecular_energy_spectrum = MolecularEnergySpectrum(
    configuration=molecule_configuration,
    energy_zero_parameter=AbsoluteEnergy,
    )
nlsave('molecular.hdf5', molecular_energy_spectrum)

# Extract the energies and occupations
energy = molecular_energy_spectrum.evaluate()
occ = molecular_energy_spectrum.occupation()

# ... and print them out
print("level   energy(eV)    occupation")
for i in numpy.arange(len(energy)):
    print('  %d  %12.4f  %12.4f  ' % (i, energy[i].inUnitsOf(eV),occ[0][i]))

nh3.py

Notes