tightbinder.result.Spectrum#
- class Spectrum(eigen_energy=None, eigen_states=None, kpoints=None, system=None)[source]#
Bases:
objectThe Spectrum class is designed to store the results from the Hamiltonian diagonalization, and to perform manipulations on the eigenvectors and eigenvalues and extract information about the system.
- Parameters:
eigen_energy (
ndarray) – Array (n, nk) with the energies for each kpoint stored as columns.eigen_states (
ndarray) – Array (nk, n, n) with the eigenvectors for each kpoint.kpoints (
ndarray) – Array with kpoints where the Bloch Hamiltonian was evaluated.system (
System) – System used in the calculation.
Methods
Method to compute the average IPR associated to a group of states.
Routine to compute the Fermi level energy according to the given filling .
Routine to compute the gap of a material based on its Fermi level/filling.
Method to compute the inverse participation ratio (IPR) from the eigenvectors.
Method to compute the occupation for all the states in the spectrum on the specified atoms.
Routine to identify edge states according to a given penetration parameter.
Routine to check if an eigenstate can be regarded as edge state (as in localized at the edge).
Method to plot the bands along a path in reciprocal space, normally along high symmetry points.
Method to plot bands from diagonalization in the whole Brillouin zone.
Method to plot bands as function of k, but also as a colormap to show edge occupation of each state.
Method to plot an array of some quantity for each state in the spectrum as a bar plot
Routine to plot all the eigenvalues coming from the Bloch Hamiltonian diagonalization in an ordered way.
Routine to set the Fermi energy to zero.
TODO write_bands_to_file
TODO write_states_to_file
- calculate_average_ipr(states)[source]#
Method to compute the average IPR associated to a group of states.
- calculate_fermi_energy(filling, bottom=True)[source]#
Routine to compute the Fermi level energy according to the given filling . Fermi energy is set systematically in-between the last occupied state and the first unoccupied state (midgap for insulators and approximately last filled for metals).
- Parameters:
- Return type:
- Returns:
Value of Fermi energy.
- calculate_gap()[source]#
Routine to compute the gap of a material based on its Fermi level/filling.
- Return type:
- Returns:
Gap value.
- calculate_ipr()[source]#
Method to compute the inverse participation ratio (IPR) from the eigenvectors.
- calculate_occupation(atom_indices)[source]#
Method to compute the occupation for all the states in the spectrum on the specified atoms.
- identify_edge_states(system, penetration=0.1)[source]#
Routine to identify edge states according to a given penetration parameter. To be used with OBC only.
- static is_edge_state(state, norbitals, edge_indices, penetration=0.1)[source]#
Routine to check if an eigenstate can be regarded as edge state (as in localized at the edge). TODO: norbitals should be a list with the orbitals for all species.
- Parameters:
state (
ndarray) – Array with coefficients of eigenstate.norbitals (
int) – Number of orbitals per atom. NB: Must be changed to list.edge_indices (
List[int]) – List with indices of atoms in the edge.penetration (
float) – Maximum probability allowed for the state to be in non-edge atoms. Defaults to 0.1
- Return type:
- Returns:
True or False.
- plot_along_path(labels, title='', edge_states=False, rescale=True, ax=None, e_values=[], fontsize=10, linewidth=2, edgecolor='red')[source]#
Method to plot the bands along a path in reciprocal space, normally along high symmetry points.
- Parameters:
labels (
List[str]) – Labels of the High Symmetry Points of the path.title (
str) – Title of the plot. Defaults to empty string.edge_states (
bool) – Boolean parameter to toggle on or off edge bands in a different color. Edge bands are defined as those immediately above and below the Fermi level. Defaults to False.rescale (
bool) – Boolean to rescale the energy spectrum to the Fermi energy. I.e. highest occupied state has energy zero. Defaults to True.ax (
Axes) – Axes object from matplotlib to plot bands there. Useful for figures with subplots.e_values (
List[float]) – List with two values, [e_min, e_max] to show bands only in that energy range.linewidth (
float) – Linewidth. Defaults to 2.fontsize (
float) – Adjusts size of lines and text.edgecolor – Color of the edge bands if edge_states=True.
- Return type:
- plot_bands(title='', ax=None)[source]#
Method to plot bands from diagonalization in the whole Brillouin zone.
- plot_bands_w_atomic_occupation(labels, atom_indices, title='', rescale=True, ax=None, e_values=[], fontsize=10)[source]#
Method to plot bands as function of k, but also as a colormap to show edge occupation of each state.
- Parameters:
labels – Labels of the High Symmetry Points of the path.
atom_indices – List of indices of atoms where we want to measure the occupation.
title – Title of the plot. Defaults to empty string.
edge_states – Boolean parameter to toggle on or off edge bands in a different color. Edge bands are defined as those immediately above and below the Fermi level. Defaults to False.
rescale – Boolean to rescale the energy spectrum to the Fermi energy. I.e. highest occupied state has energy zero. Defaults to True.
ax – Axes object from matplotlib to plot bands there. Useful for figures with subplots.
e_values – List with two values, [e_min, e_max] to show bands only in that energy range.
fontsize – Adjusts size of lines and text.
- static plot_quantity(array, name=None, sort=False, ax=None)[source]#
Method to plot an array of some quantity for each state in the spectrum as a bar plot