The function calculateMolecularEnergySpectrum() calculates and returns the eigenvalue spectrum of a molecule.
List of arguments
An object returned from a previously performed self-consistent calculation on a MoleculeConfiguration object.
Default:
None
The returned object from this function has the following query method:
Array energies(): Returns
the molecular eigenvalues as a NumPy array with dimensions
(nstates) for a spin-unpolarized calculation and
(2,nstates) for a spin-polarized where the spin-up
component will be the first entry. nstates is the
number of molecular energy states for the system.
configuration = MoleculeConfiguration(...) scf = KohnShamMethod.apply(configuration) molecular_spectrum = calculateMolecularEnergySpectrum(scf) f = VNLFile("results.vnl") f.addToSample(configuration,"my sample") f.addToSample(molecular_spectrum,"my sample")
Print a formatted list of the eigenenergies. This function works for both spin-and unpolarized calculations:
def printSpectrum(spectrum): energies = spectrum.energies() if len(energies.shape)==2: # spin-polarized print '# Level\tSpin-Up (eV)\tSpin-Down (eV)' for i in range(energies.shape[1]): print "%i\t%g\t%g" % ( i,energies[0,i].inUnitsOf(eV),\ energies[1,i].inUnitsOf(eV) ) else: # not spin-polarized print '# Level\tEnergy (eV)' for i in range(len(energies)): print "%i\t%g" % ( i,energies[i].inUnitsOf(eV) )
The dimension of the list of energies returned by the method
energies() depends on whether the performed
SCF-calculation was spin-polarized. The shape property
can be used to check whether the calculation was spin-polarized or not (as
illustrated in the above script example).
The energy zero-level for the molecular spectrum is chosen at the vacuum level, i.e. the value of the effective potential far away from the molecule.
The molecular spectrum object can also be saved in a VNLFile for plotting in Virtual NanoLab, as also shown in the examples.
Use calculateEigenstateOccupations() to calculate the occupation of the eigenstates.