# 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. float
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. 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 The molecular energy spectrum as a PhysicalQuantity with one entry for each molecular eigenstate. 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 The Fermi level in absolute energy. PhysicalQuantity of type energy
fermiTemperature()

Return the Fermi temperature used in this molecular energy spectrum.

Returns: The Fermi temperature. PhysicalQuantity or type temperature
metatext()
Returns: The metatext of the object or None if no metatext is present. str | unicode | 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. list of float
projectionList()

Return the ProjectionList object used in this molecular energy spectrum.

Returns: The ProjectionList object. ProjectionList
setMetatext(metatext)

Set a given metatext string on the object.

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

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