electron_phonon.bandgap¶
(
- data_context,
- **kwargs
)
ElectronPhononBandgap provides access to the electron-phonon bandgap renormalization data and selection utilities.
This class allows users to query and select specific instances of electron-phonon bandgap calculations, based on the INCAR settings that were used to generate them (e.g. nbands_sum, selfen_delta or <mu_tag>). It provides methods to convert the data to dictionary form, retrieve available selection options, and access individual bandgap instances.
Notes
The <mu_tag> key in the metadata will be dynamically set based on the chemical potential tag returned by ChemicalPotential.mu_tag().
chemical_potential_mu_tag
tuple[str, numpy.ndarray]
Retrieves the INCAR tag that was used to set the chemical potential as well as its values.
Returns
tuple[str, numpy.ndarray]- The INCAR tag name and its corresponding value as set in the calculation. Possible tags are ‘selfen_carrier_den’, ‘selfen_mu’, or ‘selfen_carrier_per_cell’.
count
integer -- return number of occurrences of value
index
integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
path
read
select
str) → list[BandgapInstance]
Return a list of BandgapInstance objects matching the selection.
Parameters
- selection:
str - A string specifying which instances we would like to select. You specify a particular string like “nbands_sum=800” to select all instances that were run with that setup. If you provide multiple selections the results will be merged.
Returns
list[BandgapInstance]- Instances that match the selection criteria.
selections
dict
Return a dictionary describing what options are available to read the electron transport coefficients.
Returns
dict- A dictionary with keys as selection names and values as the corresponding
values. The keys include:
- “nbands_sum”: The sum of the number of bands.
- “selfen_delta”: The self-energy delta value.
- <mu_tag>: The chemical potential value for the current index.
to_dict
BandgapInstance ¶
(
- parent,
- index
)
Represents an instance of electron-phonon band gap calculations.
This class provides methods to access, and visualize the temperature-dependent direct and fundamental band gaps due to electron-phonon interactions. This is constructed with an index corresponding to the accumulator index as shown in the OUTCAR.
parent
index
plot
Almost same as the to_graph() function.
All arguments will be passed to to_graph. If the to_graph() would
produce multiple graphs this method will merge them into a single one.
read
read_metadata
Dict[str, Any]
Read metadata for this instance.
The metadata contains information about the settings used for this instance, such as the number of bands included in the summation, the delta value used for the self-energy calculation, and the scattering approximation employed.
Returns
Dict[str, Any]- A dictionary containing the metadata for this instance. The keys correspond to settings in the INCAR file, and the values are the respective settings used.
to_csv
(
- *args,
- filename:
str | Path= None, - **kwargs
)
Writes the data to a csv file.
Writes out a csv file for data stored in a dataframe generated with
the to_frame() method. Useful for creating external plots
for further analysis.
If no filename is provided a default filename is deduced from the name of the class.
Note that the filename must be a keyword argument, i.e., you explicitly
need to write filename=”name_of_file” because the arguments are passed
on to the to_graph() method. Please check the documentation of that
method to learn which arguments are allowed.
Parameters
- filename:
str | Path= None - Name of the csv file which the data is exported to.
to_dict
dict
Convert the electron-phonon bandgap calculation results to a dictionary.
Returns
dict- A dictionary containing:
- “metadata”: A dictionary with metadata about the calculation, including nbands_sum (the sum of the number of bands), selfen_delta (the self-energy delta value), and <mu_tag> (the chemical potential value for the current index).
- “direct_renorm”: The renormalized direct bandgap values.
- “direct”: The direct bandgap values.
- “fundamental_renorm”: The renormalized fundamental bandgap values.
- “fundamental”: The fundamental bandgap values.
- “temperatures”: The temperatures at which the calculations were performed.
Notes
The <mu_tag> key in the metadata will be dynamically set based on the chemical potential tag returned by ChemicalPotential.mu_tag().
to_frame
Dataframe
Convert data to pandas dataframe.
This will first convert use the to_graph() method to convert to a
Graph. All arguments are passed to that method. The resulting graph is then
converted to a dataframe.
Returns
Dataframe- Pandas dataframe corresponding to data in the graph
to_graph
str | object) → graph.Graph
Generates a graph representing the temperature dependence of bandgap energies.
This method accesses the electron-phonon bandgap data, applies the specified selection, and returns a graph object with energy values (in eV) plotted against temperature (in K). The graph includes series for the fundamental and direct bandgaps, with and without electron-phonon renormalization, as determined by the selection.
Parameters
- selection:
str | object - A selection string or object specifying which bandgap data to include in the graph. The selection is parsed and used to extract the relevant data series.
Returns
graph.Graph- A graph object containing the selected bandgap energy series as a function of temperature.
to_image
(
- *args,
- filename = None,
- **kwargs
)
Read the data and generate an image writing to the given filename.
The filetype is automatically deduced from the filename; possible are common raster (png, jpg) and vector (svg, pdf) formats. If no filename is provided a default filename is deduced from the name of the class and the picture has png format.
Note that the filename must be a keyword argument, i.e., you explicitly
need to write filename=”name_of_file” because the arguments are passed
on to the to_graph() method. Please check the documentation of that
method to learn which arguments are allowed.
to_plotly
Produces a graph and convertes it to a plotly figure.
The arguments to this function are passed on to the to_graph() method.
Takes the resulting graph and converts it to a plotly figure.