plotter#

Plotting functions for defect calculations

Functions

plot_binding_energies

Plot binding energies for complex of defects as a function of the fermi level

plot_charge_transition_levels

Plotter for the charge transition levels.

plot_formation_energies

Produce defect Formation energy vs Fermi energy plot.

plot_pO2_vs_concentrations

Plot defect and carrier concentrations in a range of oxygen partial pressure.

plot_pO2_vs_conductivity

Plot conductivity as a function of the oxygen partial pressure.

plot_pO2_vs_fermi_level

Plot Fermi level as a function of the oxygen partial pressure.

plot_variable_species_vs_concentrations

Plot defect and carrier concentrations in a range of oxygen partial pressure.

plot_variable_species_vs_conductivity

Plot conductivity as a function of the oxygen partial pressure.

plot_variable_species_vs_fermi_level

Plot Fermi level as a function of the oxygen partial pressure.

plot_x_vs_concentrations

Plot defect concentrations as a function of generic data on the x-axis.

plot_x_vs_conductivity

Plot conductivity as a function of the oxygen partial pressure.

plot_x_vs_fermi_level

plot_binding_energies(entries, vbm, band_gap, temperature=0, names=None, xlim=None, ylim=None, figsize=(6, 6), fontsize=None, colors=None, format_legend=True, ax=None, **eform_kwargs)[source]#

Plot binding energies for complex of defects as a function of the fermi level

Parameters:
  • entries (list) – List of entries to calculate.

  • vbm (float) – Valence band maximum in eV.

  • band_gap (float) – Band gap of bulk material in eV.

  • temperature (float) – Temperature in K. If no custom formation energy is provided, this arg has no effect.

  • names (list) – List of strings with names of DefectEntry. If None, all defect complexes are plotted.

  • xlim (tuple) – Tuple giving the range of the x (fermi energy) axis

  • ylim (tuple) – Tuple giving the range for the formation energy axis

  • figsize (tuple) – Figure size.

  • fontsize (float) – Font size.

  • colors (list) – List of colors for line plot.

  • format_legend (bool) – Bool for getting latex-like legend based on the name of defect entries.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

  • eform_kwargs (dict) – Kwargs to pass to entry.formation_energy.

Return type:

matplotlib.axes.Axes

plot_charge_transition_levels(entries, vbm, band_gap, temperature=0, ylim=None, figsize=(6, 6), fontsize=None, colors=None, fermi_level=None, format_legend=True, get_integers=True, ax=None, **eform_kwargs)[source]#

Plotter for the charge transition levels.

Parameters:
  • entries (list) – List of entries to calculate.

  • vbm (float) – Valence band maximum in eV.

  • band_gap (float) – Band gap of bulk material in eV.

  • temperature (float) – Temperature in K. If no custom formation energy is provided, this arg has no effect.

  • ylim (tuple) – y-axis limits.

  • figsize (tuple) – Figure size.

  • fontsize (float) – Font size.

  • colors (list or str) – Colors for CTL lines and charge labels. Provide a string to use the same color for all species.

  • fermi_level (float) – Plot Fermi energy position.

  • format_legend (bool) – Bool for getting latex-like legend based on the name of defect entries.

  • get_integers (bool) – Get charge transition levels as integers.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

  • eform_kwargs (dict) – Kwargs to pass to entry.formation_energy.

Return type:

matplotlib.axes.Axes

plot_formation_energies(entries, chemical_potentials, vbm, band_gap, temperature=0, xlim=None, ylim=None, title=None, fermi_level=None, grid=True, figsize=(6, 6), fontsize=12, colors=None, show_legend=True, format_legend=True, ax=None, **eform_kwargs)[source]#

Produce defect Formation energy vs Fermi energy plot.

Parameters:
  • entries (list) – List of entries to calculate.

  • chemical_potentials (dict) – Dictionary with chemical potentials of the elements {‘element’:chempot}.

  • vbm (float) – Valence band maximum in eV.

  • band_gap (float) – Band gap of bulk material in eV.

  • temperature (float) – Temperature in K. If no custom formation energy is provided, this arg has no effect.

  • xlim (tuple) – Tuple giving the range of the x (fermi energy) axis.

  • ylim (tuple) – Tuple giving the range for the formation energy axis.

  • title (str) – Title of the figure.

  • fermi_level (float) – Plot Fermi energy position with a vertical line.

  • grid (bool) – Show grid.

  • figsize (float or tuple) – Figure size.

  • fontsize (float) – Font size.

  • colors (list) – List of colors for line plot.

  • show_legend (bool) – Show legend.

  • format_legend (bool) – Get latex-like legend based on the name of defect entries.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

  • eform_kwargs (dict) – Kwargs to pass to entry.formation_energy.

Return type:

matplotlib.axes.Axes

plot_pO2_vs_concentrations(thermodata, output='total', figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, colors=None, ax=None, **kwargs)[source]#

Plot defect and carrier concentrations in a range of oxygen partial pressure.

Parameters:
  • thermodata (ThermoData) –

    ThermoData object that contains the thermodynamic data:

    partial_pressures(list)

    list with partial pressure values.

    defect_concentrations(list or dict)

    Defect concentrations in the same format as the output of DefectsAnalysis.

    carrier_concentrations(list)

    List of tuples with intrinsic carriers concentrations (holes,electrons).

  • output (str) –

    Type of output for defect concentrations:

    • ”all”: The output is the concentration of every defect entry.

    • ”stable”: The output is the concentration of the stable charge for every defect at each fermi level point.

    • ”total”: The output is the sum of the concentration in every charge for each specie.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • colors (list) – List of colors to use for plotting with matplotlib. If None the defaults are used.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

  • kwargs (dict) – Kwargs to pass to DefectConcentrations.filter_concentrations(**kwargs). If provided, only the filtered concentrations will be plotted. If output is set to “total”, only the filtered concentrations will be used to compute the total concentration.

Return type:

matplotlib.axes.Axes

plot_pO2_vs_conductivity(partial_pressures, conductivities, label=None, figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, ax=None)[source]#

Plot conductivity as a function of the oxygen partial pressure.

Parameters:
  • partial_pressures (list) – list with partial pressure values.

  • conductivities (dict or list) – If is a dict multiples lines will be plotted, with labels as keys and conductivity list as values. If is a list only one line is plotted with label taken from the “label” argument.

  • label (str) – Label for the data.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

Return type:

matplotlib.axes.Axes

plot_pO2_vs_fermi_level(partial_pressures, fermi_levels, band_gap, label=None, figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, colors=None, ax=None)[source]#

Plot Fermi level as a function of the oxygen partial pressure.

Parameters:
  • partial_pressures (list) – list with partial pressure values.

  • fermi_levels (dict or list) – If is a dict multiples lines will be plotted, with labels as keys and fermi level list as values. If is a list only one line is plotted with label taken from the “label” argument.

  • band_gap (float) – Band gap of the bulk material.

  • label (str) – Label for the data.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • colors (list) – List with colors for Fermi level data.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

Return type:

matplotlib.axes.Axes

plot_variable_species_vs_concentrations(thermodata, output='total', figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, colors=None, ax=None, **kwargs)[source]#

Plot defect and carrier concentrations in a range of oxygen partial pressure.

Parameters:
  • thermodata (ThermoData) –

    ThermoData object that contains the thermodynamic data:

    partial_pressures(list)

    list with partial pressure values.

    defect_concentrations(list or dict)

    Defect concentrations in the same format as the output of DefectsAnalysis.

    carrier_concentrations(list)

    List of tuples with intrinsic carriers concentrations (holes,electrons).

  • output (str) –

    Type of output for defect concentrations:

    • ”all”: The output is the concentration of every defect entry.

    • ”stable”: The output is the concentration of the stable charge for every defect at each fermi level point.

    • ”total”: The output is the sum of the concentration in every charge for each specie.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • colors (list) – List of colors to use for plotting with matplotlib. If None the defaults are used.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

  • kwargs (dict) – Kwargs to pass to DefectConcentrations.filter_concentrations(**kwargs). If provided, only the filtered concentrations will be plotted. If output is set to “total”, only the filtered concentrations will be used to compute the total concentration.

Return type:

matplotlib.axes.Axes

plot_variable_species_vs_conductivity(xlabel, variable_concentrations, conductivities, label=None, figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, ax=None)[source]#

Plot conductivity as a function of the oxygen partial pressure.

Parameters:
  • xlabel (str) – Label for concentration axis (cm^-3 is added).

  • variable_concentrations (list) – List of concentrations of variable species.

  • conductivities (dict or list) – If is a dict multiples lines will be plotted, with labels as keys and conductivity list as values. If is a list only one line is plotted with label taken from the “label” argument.

  • label (str) – Label for the data.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

Return type:

matplotlib.axes.Axes

plot_variable_species_vs_fermi_level(xlabel, variable_concentrations, fermi_levels, band_gap, label=None, figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, colors=None, ax=None)[source]#

Plot Fermi level as a function of the oxygen partial pressure.

Parameters:
  • xlabel (str) – Label for concentration axis (cm^-3 is added).

  • variable_concentrations (list) – List of concentrations of variable species.

  • fermi_levels (dict or list) – If is a dict multiples lines will be plotted, with labels as keys and fermi level list as values. If is a list only one line is plotted with label taken from the “label” argument.

  • band_gap (float) – Band gap of the bulk material.

  • label (str) – Label for the data.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • colors (list) – List with colors for Fermi level data.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

Return type:

matplotlib.axes.Axes

plot_x_vs_concentrations(x, xlabel, defect_concentrations, carrier_concentrations, output='total', figsize=(8, 8), fontsize=14, xlim=(1e-20, 10000000000.0), ylim=None, colors=None, ax=None, **kwargs)[source]#

Plot defect concentrations as a function of generic data on the x-axis.

Parameters:
  • x (list) – List with data on x-axis.

  • xlabel (str) – Label for x-axis.

  • defect_concentrations (list) – List of DefectConcentrations objects.

  • carrier_concentrations (list) – List of tuples with carrier concentrations (holes,electrons).

  • output (str) –

    Type of output for defect concentrations:

    • ”all”: The output is the concentration of every defect entry.

    • ”stable”: The output is the concentration of the stable charge for every defect at each fermi level point.

    • ”total”: The output is the sum of the concentration in every charge for each specie.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • colors (list) – List of colors to use for plotting with matplotlib. If None the defaults are used.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

  • kwargs (dict) – Kwargs to pass to DefectConcentrations.filter_concentrations(**kwargs). If provided, only the filtered concentrations will be plotted. If output is set to “total”, only the filtered concentrations will be used to compute the total concentration.

Return type:

matplotlib.axes.Axes

plot_x_vs_conductivity(x, xlabel, conductivities, label=None, figsize=(8, 8), fontsize=22, xlim=(1e-20, 10000000000.0), ylim=None, ax=None)[source]#

Plot conductivity as a function of the oxygen partial pressure.

Parameters:
  • x (list) – List with data on x-axis.

  • xlabel (str) – Label for x-axis.

  • conductivities (dict or list) – If is a dict multiples lines will be plotted, with labels as keys and conductivity list as values. If is a list only one line is plotted with label taken from the “label” argument.

  • label (str) – Label for the data.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

Return type:

matplotlib.axes.Axes

plot_x_vs_fermi_level(x, xlabel, fermi_levels, band_gap, label=None, figsize=(8, 8), fontsize=20, xlim=(1e-20, 10000000000.0), ylim=None, colors=None, ax=None)[source]#
Parameters:
  • x (list) – List with data on x-axis.

  • xlabel (str) – Label for x-axis.

  • fermi_levels (dict or list) – If is a dict multiples lines will be plotted, with labels as keys and fermi level list as values. If is a list only one line is plotted with label taken from the “label” argument.

  • band_gap (float) – Band gap of the bulk material.

  • label (str) – Label for the data.

  • figsize (tuple) – Size of the matplotlib figure.

  • fontsize (float) – Size of font for matplotlib rcParams.

  • xlim (tuple) – Range of x-axis.

  • ylim (tuple) – Range of y-axis.

  • colors (list,) – List with colors for Fermi level data.

  • ax (matplotlib.axes.Axes) – Axis to plot into. If None, a new figure and axis are created.

Return type:

matplotlib.axes.Axes