eph Package

eph Package

a2f Module

This module contains objects for postprocessing A2F calculations (phonon lifetimes in metals and Eliashberg function).

Warning

Work in progress, DO NOT USE THIS CODE.

class abipy.eph.a2f.A2f(mesh, values_spin, values_spin_nu, ngqpt, meta)[source]

Bases: object

Eliashberg function a2F(w). Energies are in eV.

marker_spin = {0: '^', 1: 'v'}
iw0()[source]

Index of the first point in the mesh whose value is >= 0 Integrals are performed with wmesh[iw0 + 1, :] i.e. unstable modes are neglected.

to_string(title: str = None, verbose: int = 0) str[source]

String representation with verbosity level verbose and an optional title.

lambda_iso()[source]

Isotropic lambda.

omega_log()[source]

Logarithmic moment of alpha^2F: exp((2/lambda) int dw a2F(w) ln(w)/w)

get_moment(n: int, spin=None, cumulative: bool = False) float[source]

Computes the moment of a2F(w) i.e. $int dw [a2F(w)/w] w^n$ From Allen PRL 59 1460 (See also Grimvall, Eq 6.72 page 175)

get_moment_nu(n: int, nu: int, spin=None, cumulative: bool = False) float[source]

Computes the moment of a2F(w) i.e. $int dw [a2F(w)/w] w^n$ From Allen PRL 59 1460 (See also Grimvall, Eq 6.72 page 175)

get_mcmillan_tc(mustar: float) float[source]

Computes the critical temperature Tc in K computed with the McMillan equation and the input mustar.

get_mustar_from_tc(tc: float) float[source]

Return the value of mustar that gives the critical temperature tc in Kelving in the McMillan equation.

plot(what='a2f', units='eV', exchange_xy=False, ax=None, xlims=None, ylims=None, label=None, fontsize=8, **kwargs) Any[source]

Plot a2F(w) or lambda(w) depending on the value of what.

Parameters:
  • what – a2f for a2F(w), lambda for lambda(w)

  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • exchange_xy – True to exchange x-y axes.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • ylims – Limits for y-axis. See xlims for API.

  • label – True to add legend label to each curve.

  • fontsize – Legend and title fontsize

  • kwargs – linestyle, color, linewidth passed to ax.plot.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_with_lambda(units='eV', ax=None, xlims=None, fontsize=8, **kwargs) Any[source]

Plot a2F(w) and lambda(w) on the same figure.

Parameters:
  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • xlims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • fontsize – Legend and title fontsize

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_nuterms(units='eV', ax_mat=None, with_lambda=True, fontsize=8, xlims=None, ylims=None, label=None, **kwargs) Any[source]

Plot a2F(w), lambda(w) and optionally the individual contributions due to the phonon branches.

Parameters:
  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • ax_mat – Matrix of axis of shape [natom, 3]. None if a new figure should be created.

  • fontsize – Legend and title fontsize.

  • xlims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • ylims – Limits for y-axis. See xlims for API.

  • label – True to add legend label to each curve.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2(phdos, atol=1e-12, **kwargs) Any[source]

Grid with 3 plots showing: a2F(w), F(w), a2F(w). Requires phonon DOS.

Parameters:

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_tc_vs_mustar(start=0.1, stop=0.3, num=50, ax=None, **kwargs) Any[source]

Plot Tc(mustar)

Parameters:
  • start – The starting value of the sequence.

  • stop – The end value of the sequence

  • num (int) – optional. Number of samples to generate. Default is 50. Must be non-negative.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

class abipy.eph.a2f.A2Ftr(mesh, vals_in, vals_out)[source]

Bases: object

Transport Eliashberg function a2F(w). Energies are in eV.

marker_spin = {0: '^', 1: 'v'}
iw0()[source]

Index of the first point in the mesh whose value is >= 0 Integrals are performed with wmesh[iw0 + 1, :] i.e. unstable modes are neglected.

class abipy.eph.a2f.A2fFile(filepath: str)[source]

Bases: AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter

This file contains the phonon linewidths, EliashbergFunction, the abipy.dfpt.phonons.PhononBands, the abipy.electrons.ebands.ElectronBands and abipy.electrons.ebands.ElectronDos on the k-mesh. Provides methods to analyze and plot results.

Usage example:

with A2fFile("out_A2F.nc") as ncfile:
    print(ncfile)
    ncfile.ebands.plot()
    ncfile.phbands.plot()

Inheritance Diagram

Inheritance diagram of A2fFile
classmethod from_file(filepath: str) A2fFile[source]

Initialize the object from a netcdf file.

to_string(verbose=0) str[source]

String representation.

ebands()[source]

abipy.electrons.ebands.ElectronBands object.

edos()[source]

abipy.electrons.ebands.ElectronDos object with e-DOS computed by Abinit.

property structure: Structure

abipy.core.structure.Structure object.

property phbands

abipy.dfpt.phonons.PhononBands object with frequencies along the q-path. Contains (interpolated) linewidths.

params()[source]

dict with parameters that might be subject to convergence studies.

a2f_qcoarse()[source]

A2f with the Eliashberg function a2F(w) computed on the (coarse) ab-initio q-mesh.

a2f_qintp()[source]

A2f with the Eliashberg function a2F(w) computed on the dense q-mesh by Fourier interpolation.

get_a2f_qsamp(qsamp)[source]

Return the A2f object associated to q-sampling qsamp.

has_a2ftr()[source]

True if the netcdf file contains transport data.

a2ftr_qcoarse()[source]

A2ftr with the Eliashberg transport spectral function a2F_tr(w, x, x’) computed on the (coarse) ab-initio q-mesh

a2ftr_qintp()[source]

A2ftr with the Eliashberg transport spectral function a2F_tr(w, x, x’) computed on the dense q-mesh by Fourier interpolation.

get_a2ftr_qsamp(qsamp)[source]

Return the A2ftr object associated to q-sampling qsamp.

close() None[source]

Close the file.

get_panel(**kwargs)[source]

Build panel with widgets to interact with the A2fFile either in a notebook or in panel app.

plot_eph_strength(what_list=('phbands', 'gamma', 'lambda'), ax_list=None, ylims=None, label=None, fontsize=8, **kwargs) None[source]

Plot phonon bands with EPH coupling strength lambda(q, nu) and lambda(q, nu) These values have been Fourier interpolated by Abinit.

Parameters:
  • what_listphfreqs for phonons, lambda` for the eph coupling strength, gamma for phonon linewidths.

  • ax_list – List of matplotlib.axes.Axes (same length as what_list) or None if a new figure should be created.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • label – String used to label the plot in the legend.

  • fontsize – Legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot(what='gamma', units='eV', scale=None, alpha=0.6, ylims=None, ax=None, colormap='jet', **kwargs) Any[source]

Plot phonon bands with gamma(q, nu) or lambda(q, nu) depending on the value of what.

Parameters:
  • whatlambda for eph coupling strength, gamma for phonon linewidths.

  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • scale – float used to scale the marker size.

  • alpha – The alpha blending value for the markers between 0 (transparent) and 1 (opaque)

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib color map.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2f_interpol(units='eV', ylims=None, fontsize=8, **kwargs) Any[source]

Compare ab-initio a2F(w) with interpolated values.

Parameters:
  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • fontsize – Legend and title fontsize

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_with_a2f(what='gamma', units='eV', qsamp='qcoarse', phdos=None, ylims=None, **kwargs) Any[source]

Plot phonon bands with lambda(q, nu) + a2F(w) + phonon DOS.

Parameters:
  • whatlambda for eph coupling strength, gamma for phonon linewidths.

  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • qsamp

  • phdosabipy.dfpt.phonons.PhononDos object. Used to plot the PhononDos on the right.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user. Used in abiview.py to get a quick look at the results.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.a2f.A2fRobot(*args)[source]

Bases: Robot, RobotWithEbands, RobotWithPhbands

This robot analyzes the results contained in multiple A2F.nc files.

Inheritance Diagram

Inheritance diagram of A2fRobot
EXT = 'A2F'
linestyle_qsamp = {'qcoarse': '--', 'qintp': '-'}
marker_qsamp = {'qcoarse': '^', 'qintp': 'o'}
all_qsamps = ['qcoarse']
get_dataframe(abspath=False, with_geo=False, with_params=True, funcs=None) DataFrame[source]

Build and return a pandas.DataFrame with the most important results.

Parameters:
  • abspath – True if paths in index should be absolute. Default: Relative to getcwd().

  • with_geo – True if structure info should be added to the dataframe

  • funcs – Function or list of functions to execute to add more data to the DataFrame. Each function receives a A2fFile object and returns a tuple (key, value) where key is a string with the name of column and value is the value to be inserted.

  • with_params – False to exclude calculation parameters from the dataframe.

Return: pandas.DataFrame

plot_lambda_convergence(what='lambda', sortby=None, hue=None, ylims=None, fontsize=8, colormap='jet', **kwargs) Any[source]

Plot the convergence of the lambda(q, nu) parameters wrt to the sortby parameter.

Parameters:
  • what – “lambda” for eph strength, gamma for phonon linewidths.

  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • fontsize – Legend and title fontsize.

  • colormap – matplotlib color map.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2f_convergence(sortby=None, hue=None, qsamps='all', xlims=None, fontsize=8, colormap='jet', **kwargs) Any[source]

Plot the convergence of the Eliashberg function wrt to the sortby parameter.

Parameters:
  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • qsamps

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – Legend and title fontsize.

  • colormap – matplotlib color map.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2fdata_convergence(sortby=None, hue=None, qsamps='all', what_list=('lambda_iso', 'omega_log'), fontsize=8, **kwargs) Any[source]

Plot the convergence of the isotropic lambda and omega_log wrt the sortby parameter.

Parameters:
  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • qsamps

  • what_list

  • fontsize – Legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

gridplot_a2f(xlims=None, fontsize=8, sharex=True, sharey=True, **kwargs) Any[source]

Plot grid with a2F(w) and lambda(w) for all files treated by the robot.

Parameters:
  • xlims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • sharex – True to share x- and y-axis.

  • sharey – True to share x- and y-axis.

  • fontsize – Legend and title fontsize

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.a2f.A2fReader(path)[source]

Bases: BaseEphReader

Reads data from the EPH.nc file and constructs objects.

Inheritance Diagram

Inheritance diagram of A2fReader
read_edos() ElectronDos[source]

Read the abipy.electrons.ebands.ElectronDos used to compute EPH quantities.

read_phbands_qpath() PhononBands[source]

Read and return a abipy.dfpt.phonons.PhononBands object with frequencies computed along the q-path.

read_phlambda_qpath(sum_spin=True)[source]

Reads the EPH coupling strength interpolated along the q-path.

Returns:

numpy.ndarray with shape [nqpath, natom3] if not sum_spin else [nsppol, nqpath, natom3]

read_phgamma_qpath(sum_spin=True)[source]

Reads the phonon linewidths (eV) interpolated along the q-path.

Returns:

numpy.ndarray with shape [nqpath, natom3] if not sum_spin else [nsppol, nqpath, natom3]

read_a2f(qsamp)[source]

Read and return the Eliashberg function A2F.

common Module

Objects common to the other eph modules.

class abipy.eph.common.BaseEphReader(path)[source]

Bases: ElectronsReader

Provides methods common to the netcdf files produced by the EPH code. See Abinit docs for the meaning of the variables.

ddb_ngqpt()[source]

Q-Mesh for DDB file.

ngqpt()[source]

Effective Q-mesh used in to compute integrals (ph_linewidts, e-ph self-energy).

ph_ngqpt()[source]

Q-mesh for Phonon DOS, interpolated A2F …

eph_ngqpt_fine()[source]

Q-mesh for interpolated DFPT potentials

common_eph_params()[source]

Read basic parameters (scalars) from the netcdf files produced by the EPH code and cache them

abipy.eph.common.glr_frohlich(qpoint, becs_cart, epsinf_cart, phdispl_cart_bohr, phfreqs_ha, structure, qdamp=None, eph_wtol=1e-06, tol_qnorm=1e-06)[source]

Compute the long-range part of the e-ph matrix element with the simplified Frohlich model i.e. we include only G = 0 and the <k+q,b1|e^{i(q+G).r}|b2,k> coefficient is replaced by delta_{b1, b2}

Parameters:
  • qpointabipy.core.kpoints.Kpoint object.

  • becs_cart – (natom, 3, 3) arrays with Born effective charges in Cartesian coordinates.

  • epsinf_cart – (3, 3) array with macroscopic dielectric tensor in Cartesian coordinates.

  • phdispl_cart_bohr – (natom3_nu, natom3) complex array with phonon displacement in Cartesian coordinates (Bohr)

  • phfreqs_ha – (3 * natom) array with phonon frequencies in Ha.

  • structureabipy.core.structure.Structure object.

  • qdamp – Exponential damping.

  • eph_wtol – Set g to zero below this phonon frequency.

  • tol_qnorm – Tolerance of the norm of the q-point.

Returns:

(natom3) complex array with glr_nu.

common Module

This module contains objects for postprocessing e-ph calculations using the results stored in the out_EPH_CUMULANT.nc file.

class abipy.eph.cumulant.CumulantQpTempState(spin, kpoint, band, tmesh, e0, qpe, ze0, fan0, dw, qpe_oms)[source]

Bases: QpTempState

Quasi-particle result for given (spin, kpoint, band).

Note

Energies are in eV.

set_energies(wmesh, vals_wr, vals_e0ks, ntemp, nwr)[source]
class abipy.eph.cumulant.CumulantEPhFile(filepath)[source]

Bases: SigEPhFile

This file contains the Green’s Function using the cumulant expansion from a self-energy eph calculation, the abipy.electrons.ebands.ElectronBands on the k-mesh. Provides methods to analyze and plot results.

Usage example:

SigmaEphFile = SigEPhFile("out_SIGEPH.nc")
with CumulantEPhFile("out_EPH_CUMULANT.nc", SigmaEphFile) as ncfile:
    print(ncfile)
    ncfile.ebands.plot()

Inheritance Diagram

Inheritance diagram of CumulantEPhFile
classmethod from_file(filepath: str) CumulantEPhFile[source]

Initialize the object from a netcdf file.

to_string(verbose=0) str[source]

String representation.

get_cumulant_skb(spin, kpoint, band)[source]

“Return e-ph self-energy for the given (spin, kpoint, band).

class abipy.eph.cumulant.CumulantPhReader(path: str)[source]

Bases: SigmaPhReader

Reads data from file and constructs objects.

Inheritance Diagram

Inheritance diagram of CumulantPhReader
read_cumulant_skb(spin, kpoint, band)[source]

Returns the e-ph self energy for the given (spin, k-point, band).

Parameters:
  • spin – Spin index

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • band – band index.

Return: EphSelfEnergy object.

read_qp(spin, kpoint, band, ignore_imag=False)[source]

Return QpTempState for the given (spin, kpoint, band) (NB: band is a global index i.e. unshifted) Only real part is returned if ignore_imag.

class abipy.eph.cumulant.CumulantSelfEnergy(wmesh, qp, gw_vals, spfunccumul_wr, time_mesh=None, ct_vals=None, gt_vals=None, vals_e0ks=None, dvals_de0ks=None, dw_vals=None, frohl_vals_e0ks=None, frohl_dvals_de0ks=None, frohl_spfunc_wr=None)[source]

Bases: EphSelfEnergy

calculate_sigma_skb_fromgw(wmesh, qp, gw_vals)[source]
classmethod calculate_gw_from_sigeph_skb(sigeph, time_tol=0.0001)[source]

eph_plotter Module

Objects to plot electronic, vibrational and e-ph properties.

class abipy.eph.eph_plotter.EphPlotter(ebands_kpath, phbst_file, phdos_file, ebands_kmesh=None)[source]

Bases: object

This object provides methods to plot electron and phonons for a single system. An EphPlotter has:

EphPlotter uses these objects/files and other inputs/files provided by the user to generate matplotlib plots related to e-ph interaction.

Inheritance Diagram

Inheritance diagram of EphPlotter
classmethod from_ddb(ddb, ebands_kpath, ebands_kmesh=None, **kwargs) EphPlotter[source]

Build the object from the ddb file, invoke anaddb to get phonon properties. This entry point is needed to have phonon plots with LO-TO splitting as AbiPy will generate an anaddb input with the different q –> 0 directions required in phbands.plot to plot the LO-TO splitting correctly.

Parameters:
plot(eb_ylims=None, **kwargs) Any[source]

Plot electrons with possible (phonon-mediated) scattering channels for the CBM and VBM. Also plot phonon band structure and phonon PJDOS.

Parameters:

eb_ylims – Set the data limits for the y-axis of the electron band. Accept tuple e.g. (left, right) or scalar e.g. left. If None, limits are selected automatically.

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_phonons_occ(temps=(100, 200, 300, 400), **kwargs) Any[source]

Plot phonon band structure with markers proportional to the occupation of each phonon mode for different temperatures.

Parameters:

temps – List of temperatures in Kelvin.

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_linewidths_sigeph(sigeph, eb_ylims=None, **kwargs) Any[source]

Plot e-bands + e-DOS + Im(Sigma_{eph}) + phonons + gkq^2

Parameters:
  • sigephabipy.electrons.eph.SigephFile or string with path to file.

  • eb_ylims – Set the data limits for the y-axis of the electron band. Accept tuple e.g. (left, right) or scalar e.g. left. If None, limits are selected automatically.

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

gpath Module

This module contains objects for analyzing the PATH.nc file with the e-ph matrix elements along a k/q path

abipy.eph.gpath.k2s(k_vector, fmt='.3f', threshold=1e-08) str[source]
class abipy.eph.gpath.GpathFile(filepath: str | PathLike)[source]

Bases: AbinitNcFile, Has_Structure, NotebookWriter

This file stores the e-ph matrix elements along a k/q path and provides methods to analyze and plot results.

Usage example:

with GpathFile("out_GPATH.nc") as gpath:
    print(gpath)

Inheritance Diagram

Inheritance diagram of GpathFile
classmethod from_file(filepath: str | PathLike) GpathFile[source]

Initialize the object from a netcdf file.

property structure: Structure

abipy.core.structure.Structure object.

ebands_k()[source]

Electron bands along the k path.

ebands_kq()[source]

Electron bands along the k+q path as a function of q.

phbands()[source]

Phonon bands along the q-path (nq_path points).

close() None[source]

Close the file.

params()[source]

dict with the convergence parameters, e.g. nbsum.

to_string(verbose: int = 0) str[source]

String representation with verbosiy level verbose.

plot_g_qpath(band_range=None, which_g='avg', with_qexp: int = 0, scale=1, gmax_mev=250, ph_modes=None, with_phbands=True, with_ebands=False, ax_mat=None, fontsize=8, **kwargs) Any[source]

Plot the averaged |g(k,q)| in meV units along the q-path

Parameters:
  • band_range – Band range that will be averaged over (python convention).

  • which_g – “avg” to plot the symmetrized |g|, “raw” for unsymmetrized |g|.”all” for both.

  • with_qexp – Multiply |g(q)| by |q|^{with_qexp}.

  • scale – Scaling factor for the marker size used when with_phbands is True.

  • gmax_mev – Show results up to gmax in meV.

  • ph_modes – List of ph branch indices to show (start from 0). If None all modes are shown.

  • with_phbands – False if phonon bands should now be displayed.

  • with_ebands – False if electron bands should now be displayed.

  • ax_mat – List of matplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_g_kpath(band_range=None, which_g='avg', scale=1, gmax_mev=250, ph_modes=None, with_ebands=True, ax_mat=None, fontsize=8, **kwargs) Any[source]

Plot the averaged |g(k,q)| in meV units along the k-path

Parameters:
  • band_range – Band range that will be averaged over (python convention).

  • which_g – “avg” to plot the symmetrized |g|, “raw” for unsymmetrized |g|.”all” for both.

  • scale – Scaling factor for the marker size used when with_phbands is True.

  • gmax_mev – Show results up to gmax in meV.

  • ph_modes – List of ph branch indices to show (start from 0). If None all modes are show.

  • with_ebands – False if electron bands should now be displayed.

  • ax_mat – List of matplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.gpath.GpathReader(filepath: str | PathLike)[source]

Bases: BaseEphReader

Reads data from file and constructs objects.

Inheritance Diagram

Inheritance diagram of GpathReader
read_ebands_which_fixed(which_fixed: str)[source]

Overrides method of superclass as we cannot rely of the etsf-io file format, and we have to build the ebands manually.

read_phbands() PhononBands[source]

Read the phonon band structure along the q-path.

get_gnuq_average_spin(spin: int, band_range: list | tuple | None, eps_mev: float = 0.01) tuple[source]

Average e-matrix elements over phonon modes, and k- k+q electrons when the matrix elements have been computed along a q-path.

Parameters:
  • spin – spin index

  • band_range – Band range that will be averaged over (python convention).

  • eps_mev – Tolerance in meV used to detect degeneracies for phonons and electrons.

Returns:

tuple with two numpy array

get_gnuk_average_spin(spin: int, band_range: list | tuple | None, eps_mev: float = 0.01) tuple[source]

Average g elements over phonon modes, and k- k+q electrons when the matrix elements have been computed along a k-path.

Parameters:
  • spin – spin index

  • band_range – Band range that will be averaged over (python convention).

  • eps_mev – Tolerance in meV used to detect degeneracies for phonons and electrons.

Returns:

tuple with two numpy array

class abipy.eph.gpath.GpathRobot(*args)[source]

Bases: Robot, RobotWithEbands

This robot analyzes the results contained in multiple GPATH.nc files.

Usage example:

robot = GpathRobot.from_files([
    "t04o_GPATH.nc",
    "t05o_GPATH.nc",
    ])

Inheritance Diagram

Inheritance diagram of GpathRobot
EXT = 'GPATH'
plot_g_qpath(which_g='avg', gmax_mev=250, ph_modes=None, colormap='jet', **kwargs) Any[source]

Compare the g-matrix along a q-path.

Args

which_g: “avg” to plot the symmetrized |g|, “raw” for unsymmetrized |g|.”all” for both. gmax_mev: Show results up to gmax in me ph_modes: List of ph branch indices to show (start from 0). If None all modes are show. colormap: Color map. Have a look at the colormaps here and decide which one you like:

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user. Used in abiview.py to get a quick look at the results.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporary file in the current working directory is created. Return path to the notebook.

gstore Module

This module contains objects for postprocessing e-ph calculations using the results stored in the GSTORE.nc file.

For a theoretical introduction see [Giustino2017]

class abipy.eph.gstore.GstoreFile(filepath: str | PathLike)[source]

Bases: AbinitNcFile, Has_Header, Has_Structure, Has_ElectronBands

This file stores the e-ph matrix elements produced by the EPH code of Abinit and provides methods to analyze and plot results.

Usage example:

with GstoreFile("out_GSTORE.nc") as gstore:
    print(gstore)

    for spin in range(gstore.nsppol):
        # Extract the object storing the g for this spin.
        gqk = gstore.gqk_spin[spin]
        print(gqk)

        # Get a Dataframe with g(k, q) for all modes and bands.
        df = gqk.get_gdf_at_qpt_kpt([1/2, 0, 0], [0, 0, 0])
        print(df)

Inheritance Diagram

Inheritance diagram of GstoreFile
classmethod from_file(filepath: str | PathLike) GstoreFile[source]

Initialize the object from a netcdf file.

ebands()[source]

abipy.electrons.ebands.ElectronBands object.

property structure: Structure

abipy.core.structure.Structure object.

close() None[source]

Close the file.

gqk_spin()[source]
params()[source]

dict with the convergence parameters, e.g. nbsum.

to_string(verbose=0) str[source]

String representation with verbosiy level verbose.

check_unfilled_entries_in_gvals()[source]
class abipy.eph.gstore.Gqk(*, cplex: int, spin: int, nb: int, bstart: int, glob_nk: int, glob_nq: int, gstore: GstoreFile, gvals: ndarray | None, g2: ndarray | None, vk_cart_ibz: ndarray | None, vkmat_cart_ibz: ndarray | None)[source]

Bases: object

This object stores the e-ph matrix elements (g or g^2) and the matrix elements of the velocity operator for a given spin.

cplex: int
spin: int
nb: int
bstart: int
glob_nk: int
glob_nq: int
gstore: GstoreFile
gvals: ndarray | None
g2: ndarray | None
vk_cart_ibz: ndarray | None
vkmat_cart_ibz: ndarray | None
classmethod from_gstore(gstore: GstoreFile, spin: int) Gqk[source]

Build an istance from a GstoreFile and the spin index.

to_string(verbose=0) str[source]

String representation with verbosiy level verbose.

property structure
get_dataframe(what: str = 'g2') DataFrame[source]

Build and return a dataframe with all the |g(k,q)|^2 if what == “g2” or all |v_nk|^2 if what == “v2”.

get_g2q_interpolator_kpoint(kpoint, method='linear', check_mesh=1) BzRegularGridInterpolator[source]

Build and return an interpolator that can be used to interpolate g^2(q)

NB: Invoking the interpolation with an arbitrary q-point returns a numpy array of shape (nb, nb, natom3) with g_{m_kq n_k, nu}(q)

get_g_qpt_kpt(qpoint, kpoint, what) ndarray[source]

Return numpy array with e-ph matrix elements for the given (qpoint, kpoint) pair.

Parameters:

|g (what="g2" for) –

get_gdf_at_qpt_kpt(qpoint, kpoint, what='g2') DataFrame[source]

Build and return a dataframe with the |g(k,q)|^2 for the given (qpoint, kpoint) pair.

Parameters:

|g (what="g2" for) –

neq(other: Gqk, verbose: int) int[source]

Helper function to compare two GQK objects.

class abipy.eph.gstore.GstoreReader(filepath: str | PathLike)[source]

Bases: BaseEphReader

Reads data from file and constructs objects.

Inheritance Diagram

Inheritance diagram of GstoreReader
find_iq_glob_qpoint(qpoint, spin: int)[source]

Find the internal index of the qpoint needed to access the gvals array.

find_ik_glob_kpoint(kpoint, spin: int)[source]

Find the internal indices of the kpoint needed to access the gvals array.

path2group()[source]
class abipy.eph.gstore.GstoreRobot(*args)[source]

Bases: Robot, RobotWithEbands

This robot analyzes the results contained in multiple GSTORE.nc files.

Usage example:

robot = GstoreRobot.from_files([
    "t04o_GSTORE.nc",
    "t05o_GSTORE.nc",
    ])

robot.neq(verbose=1)

Inheritance Diagram

Inheritance diagram of GstoreRobot
EXT = 'GSTORE'
neq(ref_basename: str | None = None, verbose: int = 0) int[source]

Compare all GSTORE.nc files stored in the GstoreRobot

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user. Used in abiview.py to get a quick look at the results.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporary file in the current working directory is created. Return path to the notebook.

rta Module

RTA.nc file.

class abipy.eph.rta.RtaFile(filepath: str)[source]

Bases: AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter

classmethod from_file(filepath: str) RtaFile[source]

Initialize the object from a netcdf file.

property ntemp: int

Number of temperatures.

property tmesh: ndarray

Mesh with Temperatures in Kelvin.

assume_gap()[source]

True if we are dealing with a semiconductor. More precisely if all(sigma_erange) > 0.

has_ibte()[source]

True if file contains IBTE results.

ebands()[source]

abipy.electrons.ebands.ElectronBands object.

property structure: Structure

abipy.core.structure.Structure object.

params()[source]

dict with parameters that might be subject to convergence studies.

to_string(verbose=0) str[source]

String representation.

get_mobility_mu(eh, itemp, component='xx', ef=None, irta=0, spin=0)[source]

Get the mobility at the chemical potential Ef

Parameters:
  • eh – 0 for electrons, 1 for holes.

  • itemp – Index of the temperature.

  • component – Cartesian component to plot: “xx”, “yy” “xy” …

  • ef – Value of the doping in eV. The default None uses the chemical potential at the temperature item as computed by Abinit.

  • spin – Spin index.

plot_edos(ax=None, fontsize=8, **kwargs) Any[source]

Plot electron DOS

Parameters:
  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize (int) – fontsize for titles and legend

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_tau_isoe(ax_list=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot tau(e). Energy-dependent scattering rate defined by:

$tau(epsilon) = frac{1}{N_k} sum_{nk} tau_{nk},delta(epsilon - epsilon_{nk})$

Two differet subplots for SERTA and MRTA.

Parameters:
  • ax_list – List of matplotlib.axes.Axes or None if a new figure should be created.

  • colormap

  • fontsize (int) – fontsize for titles and legend

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_vvtau_dos(component='xx', spin=0, ax=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot (v_i * v_j * tau) DOS.

$frac{1}{N_k} sum_{nk} v_i v_j delta(epsilon - epsilon_{nk})$

Parameters:
  • component – Cartesian component to plot: “xx”, “yy” “xy” …

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib colormap.

  • fontsize (int) – fontsize for titles and legend

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_mobility(eh=0, irta=0, component='xx', spin=0, ax=None, colormap='jet', fontsize=8, yscale='log', **kwargs) Any[source]

Read the mobility from the netcdf file and plot it

Parameters:
  • component – Component to plot: “xx”, “yy” “xy” …

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib colormap.

  • fontsize (int) – fontsize for titles and legend

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_transport_tensors_mu(component='xx', spin=0, what_list=('sigma', 'seebeck', 'kappa', 'pi'), colormap='jet', fontsize=8, **kwargs) Any[source]

Plot selected Cartesian components of transport tensors as a function of the chemical potential mu at the given temperature.

Parameters:
  • ax_listmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_ibte_vs_rta_rho(component='xx', fontsize=8, ax=None, **kwargs) Any[source]

Plot resistivity computed with SERTA, MRTA and IBTE

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

Return figures plotting the transport data

close() None[source]

Close the file.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.rta.RtaRobot(*args)[source]

Bases: Robot, RobotWithEbands

This robot analyzes the results contained in multiple RTA.nc files.

Inheritance Diagram

Inheritance diagram of RtaRobot
EXT = 'RTA'
plot_mobility_kconv(eh=0, bte=('serta', 'mrta', 'ibte'), mode='full', component='xx', itemp=0, spin=0, fontsize=14, ax=None, **kwargs) Any[source]

Plot the convergence of the mobility as a function of the number of k-points, for different transport formalisms included in the computation.

Parameters:
  • eh – 0 for electrons, 1 for holes.

  • bte – list of transport formalism to plot (serta, mrta, ibte)

  • mode

    mode for the convergence plot. ‘full’: normal plot of the mobility ‘relative’: plot of the mobility relative to

    the value obtained with the densest grid

  • component – Cartesian component to plot (‘xx’, ‘xy’, …)

  • itemp – temperature index.

  • spin – Spin index.

  • fontsize – fontsize for legends and titles

  • axmatplotlib.axes.Axes or None if a new figure should be created.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

assume_gap()[source]

True if we are dealing with a semiconductor. More precisely if all(sigma_erange) > 0.

all_have_ibte()[source]

True if all files contain IBTE results.

get_same_tmesh()[source]

Check whether all files have the same T-mesh. Return common tmesh else raise RuntimeError.

plot_ibte_vs_rta_rho(component='xx', fontsize=8, **kwargs) Any[source]
plot_ibte_mrta_serta_conv(what='resistivity', fontsize=8, **kwargs) Any[source]
yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user. Used in abiview.py to get a quick look at the results.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

sigeph Module

This module contains objects for postprocessing e-ph calculations using the results stored in the SIGEPH.nc file.

For a theoretical introduction see [Giustino2017]

class abipy.eph.sigeph.QpTempState(spin, kpoint, band, tmesh, e0, qpe, ze0, fan0, dw, qpe_oms)[source]

Bases: QpTempState

Quasi-particle result for given (spin, kpoint, band).

Note

Energies are in eV.

qpeme0()[source]

E_QP[T] - E_0 (Real part)

re_qpe()[source]

Real part of the QP energy.

imag_qpe()[source]

Imaginay part of the QP energy.

property re_fan0

Real part of the Fan term at KS.

property imag_fan0

Imaginary part of the Fan term at KS.

re_sig0()[source]

Real part of the self-energy computed at the KS energy.

imag_sig0()[source]

Imaginary part of the self-energy computed at the KS energy.

skb()[source]

Tuple with (spin, kpoint, band)

classmethod get_fields(exclude=())[source]
to_string(verbose=0, title=None) str[source]

String representation with verbosity level verbose and optional title.

get_dataframe(index=None, with_spin=True, params=None) DataFrame[source]

Build pandas dataframe with QP results

Parameters:
  • index – dataframe index.

  • with_spin – False if spin index is not wanted.

  • params – Optional (Ordered) dictionary with extra parameters.

Return: pandas.DataFrame

classmethod get_fields_for_plot(vs, with_fields, exclude_fields)[source]

Return list of QpTempState fields to plot from input arguments.

Parameters:
  • ["temp" (vs in)

  • "e0"]

  • with_fields

  • exclude_fields

plot(with_fields='all', exclude_fields=None, ax_list=None, label=None, fontsize=8, **kwargs) Any[source]

Plot the QP results as function of temperature.

Parameters:
  • with_fields – The names of the QpTempState attributes to plot as function of e0. Accepts: List of strings or string with tokens separated by blanks. See QpTempState for the list of available fields.

  • exclude_fields – Similar to with_field but excludes fields.

  • ax_list – List of matplotlib axes for plot. If None, new figure is produced.

  • label – Label for plot.

  • fontsize – Fontsize for legend and title.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

class abipy.eph.sigeph.QpTempList(*args, **kwargs)[source]

Bases: list

A list of quasiparticle corrections (usually for a given spin).

property tmesh

Temperature mesh in Kelvin.

property ntemp: int

Number of temperatures.

to_string(verbose=0, title=None) str[source]

String representation.

sort_by_e0()[source]

Return a new QpTempList object with the E0 energies sorted in ascending order.

get_e0mesh()[source]

Return the E0 energies.

get_field_itemp(field, itemp)[source]

numpy.ndarray containing the values of field at temperature itemp

merge(other, copy=False)[source]

Merge self with other. Return new QpTempList object

Raise: ValueError if merge cannot be done.

plot_vs_e0(itemp_list=None, with_fields='all', reim='real', function=<function QpTempList.<lambda>>, exclude_fields=None, fermie=None, colormap='jet', ax_list=None, xlims=None, ylims=None, exchange_xy=False, fontsize=8, **kwargs) Any[source]

Plot QP results as a function of the initial KS energy.

Parameters:
  • itemp_list – List of integers to select a particular temperature. None for all

  • with_fields – The names of the QP attributes to plot as function of e0. Accepts: List of strings or string with tokens separated by blanks. See QPState for the list of available fields.

  • reim – Plot the real or imaginary part

  • function – Apply a function to the results before plotting

  • exclude_fields – Similar to with_field but excludes fields.

  • fermie – Value of the Fermi level used in plot. None for absolute e0s.

  • colormap – matplotlib color map.

  • ax_list – List of matplotlib.axes.Axes for plot. If None, new figure is produced.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • ylims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • exchange_xy – True to exchange x-y axis.

  • fontsize – Legend and title fontsize.

  • kwargs – linestyle, color, label, marker

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

class abipy.eph.sigeph.EphSelfEnergy(wmesh, qp, vals_e0ks, dvals_de0ks, dw_vals, vals_wr, spfunc_wr, frohl_vals_e0ks=None, frohl_dvals_de0ks=None, frohl_spfunc_wr=None)[source]

Bases: object

Electron self-energy due to phonon interaction \(\Sigma_{nk}(\omega,T)\) Actually this object stores the diagonal matrix elements in the KS basis set.

latex_symbol = {'im': '$\\Im{\\Sigma(\\omega)}$', 're': '$\\Re{\\Sigma(\\omega)}$', 'spfunc': '$A(\\omega)}$'}
to_string(verbose=0, title=None) str[source]

String representation.

plot_tdep(itemps='all', zero_energy='e0', colormap='jet', ax_list=None, what_list=('re', 'im', 'spfunc'), with_frohl=False, xlims=None, ylims=None, fontsize=8, **kwargs) Any[source]

Plot the real/imaginary part of self-energy as well as the spectral function for the different temperatures with a colormap.

Parameters:
  • itemps – List of temperature indices. “all” to plot’em all.

  • zero_energy

  • colormap – matplotlib color map.

  • ax_list – List of matplotlib.axes.Axes. If None, new figure is produced.

  • what_list – List of strings selecting the quantity to plot. “re” for real part, “im” for imaginary part, “spfunc” for spectral function A(omega).

  • with_frohl – Visualize Frohlich contribution (if present).

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • ylims – Set the data limits for the y-axis. Accept list ( for real, imaginary or spectral function) of tuples e.g. [(left, right)] or tuple e.g. (left, right) for all graphics or scalar e.g. left. If left (right) is None, default values are used for all graphics.

  • fontsize – legend and label fontsize.

  • kwargs – Keyword arguments passed to ax.plot

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot(itemps='all', zero_energy='e0', colormap='jet', ax_list=None, what_list=('re', 'im', 'spfunc'), with_frohl=False, xlims=None, ylims=None, fontsize=8, **kwargs) Any

Plot the real/imaginary part of self-energy as well as the spectral function for the different temperatures with a colormap.

Parameters:
  • itemps – List of temperature indices. “all” to plot’em all.

  • zero_energy

  • colormap – matplotlib color map.

  • ax_list – List of matplotlib.axes.Axes. If None, new figure is produced.

  • what_list – List of strings selecting the quantity to plot. “re” for real part, “im” for imaginary part, “spfunc” for spectral function A(omega).

  • with_frohl – Visualize Frohlich contribution (if present).

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • ylims – Set the data limits for the y-axis. Accept list ( for real, imaginary or spectral function) of tuples e.g. [(left, right)] or tuple e.g. (left, right) for all graphics or scalar e.g. left. If left (right) is None, default values are used for all graphics.

  • fontsize – legend and label fontsize.

  • kwargs – Keyword arguments passed to ax.plot

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpsolution(itemp=0, solve=False, with_int_aw=True, ax_list=None, xlims=None, fontsize=8, **kwargs) Any[source]

Graphical representation of the QP solution(s) along the real axis including the approximated solution obtained with the linearized equation and the on-the-mass-shell approach.

Produce two subplots:
  1. Re/Imag part and intersection with omega - eKs

  2. A(w) + int^w A(w’)dw’ + OTMS

Parameters:
  • itemp – Temperature index.

  • solve – If True, solve the non-linear QP equation. Requires shapely package.

  • with_int_aw – Plot cumulative integral of A(w).

  • ax_list – List of matplotlib.axes.Axes. If None, new figure is produced.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – legend and label fontsize.

  • kwargs – Keyword arguments passed to ax.plot

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

class abipy.eph.sigeph.SigEPhFile(filepath: str)[source]

Bases: AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter

This file contains the Fan-Migdal Debye-Waller self-energy, the abipy.electrons.ebands.ElectronBands on the k-mesh. Provides methods to analyze and plot results.

Usage example:

with SigEPhFile("out_SIGEPH.nc") as ncfile:
    print(ncfile)
    ncfile.ebands.plot()

Inheritance Diagram

Inheritance diagram of SigEPhFile
marker_spin = {0: '^', 1: 'v'}
color_spin = {0: 'k', 1: 'r'}
classmethod from_file(filepath: str) SigEPhFile[source]

Initialize the object from a netcdf file.

to_string(verbose: int = 0) str[source]

String representation with verbosity level verbose.

ebands()[source]

abipy.electrons.ebands.ElectronBands object.

property structure: Structure

abipy.core.structure.Structure object.

close() None[source]

Close the file.

has_spectral_function()[source]

True if file contains spectral function data.

has_eliashberg_function()[source]

True if file contains Eliashberg functions.

property sigma_kpoints

The K-points where QP corrections have been calculated.

property tmesh

Temperature mesh in Kelvin.

kcalc2ibz()[source]

Return a mapping of the kpoints at which the self energy was calculated and the ibz i.e. the list of k-points in the band structure used to construct the self-energy.

ibz2kcalc()[source]

Mapping IBZ –> K-points in self-energy. Set to -1 if IBZ k-point not present.

ks_dirgaps()[source]

numpy.ndarray of shape [nsppol, nkcalc] with the KS gaps in eV ordered as kcalc.

qp_dirgaps_t()[source]

numpy.ndarray of shape [nsppol, nkcalc, ntemp] with the QP direct gap in eV ordered as kcalc. QP energies are computed with the linearized QP equation (Z factor)

qp_dirgaps_otms_t()[source]

numpy.ndarray of shape [nsppol, nkcalc, ntemp] with the QP direct gap in eV ordered as kcalc. QP energies are computed with the on-the-mass-shell approximation

mu_e()[source]

mu_e[ntemp] chemical potential (eV) of electrons for the different temperatures.

edos()[source]

abipy.electrons.ebands.ElectronDos object computed by Abinit with the input WFK file without doping (if any). Since this field is optional, None is returned if netcdf variable is not present

sigkpt2index(kpoint)[source]

Returns the index of the self-energy k-point in sigma_kpoints Used to access data in the arrays that are dimensioned with [0:nkcalc]

find_qpkinds(qp_kpoints)[source]

Find kpoints for QP corrections from user input. Return list of (kpt, ikcalc) tuples where kpt is a abipy.core.kpoints.Kpoint and ikcalc is the index in the nkcalc array..

params()[source]

dict with the convergence parameters, e.g. nbsum.

get_sigeph_skb(spin, kpoint, band)[source]

“Return e-ph self-energy for the given (spin, kpoint, band).

get_dataframe(itemp=None, with_params=True, with_spin='auto', ignore_imag=False) DataFrame[source]

Returns pandas.DataFrame with QP results for all k-points, bands and spins included in the calculation.

Parameters:
  • itemp – Temperature index, if None all temperatures are returned.

  • with_params – False to exclude calculation parameters from the dataframe.

  • ignore_imag – only real part is returned if ignore_imag.

get_dirgaps_dataframe(kpoint, itemp=None, spin=0, with_params=False) DataFrame[source]

Returns pandas.DataFrame with QP direct gaps at the given k-point

Parameters:
  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • itemp – Temperature index, if None all temperatures are returned.

  • spin – Spin index

  • with_params – False to exclude calculation parameters from the dataframe.

get_dataframe_sk(spin, kpoint, itemp=None, index=None, with_params=False, with_spin='auto', ignore_imag=False) DataFrame[source]

Returns pandas.DataFrame with QP results for the given (spin, k-point).

Parameters:
  • spin – Spin index.

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • itemp – Temperature index, if None all temperatures are returned.

  • index – dataframe index.

  • with_params – False to exclude calculation parameters from the dataframe.

  • with_spin – True to add column with spin index. “auto” to add it only if nsppol == 2

  • ignore_imag – Only real part is returned if ignore_imag.

get_linewidth_dos(method='gaussian', e0='fermie', step=0.1, width=0.2)[source]

Calculate linewidth density of states

Parameters:
  • method – String defining the method for the computation of the DOS.

  • step – Energy step (eV) of the linear mesh.

  • width – Standard deviation (eV) of the gaussian.

Returns: abipy.electrons.ebands.ElectronDos object.

get_qp_array(ks_ebands_kpath=None, mode='qp', rta_type='mrta')[source]

Get the lifetimes in an array with spin, kpoint and band dimensions

Parameters:

rta_type – “serta” for SERTA linewidths or “mrta” for MRTA linewidths.

get_lifetimes_boltztrap(basename, rta_type='mrta', workdir=None)[source]

Produce basename.tau and basename.energy text files to be used in Boltztrap code for transport calculations.

Parameters:
  • basename – The basename of the files to be produced

  • workdir – Directory where files will be produced. None for current working directory.

interpolate(itemp_list=None, lpratio=5, mode='qp', ks_ebands_kpath=None, ks_ebands_kmesh=None, ks_degatol=0.0001, vertices_names=None, line_density=20, filter_params=None, only_corrections=False, verbose=0)[source]

Interpolated the self-energy corrections in k-space on a k-path and, optionally, on a k-mesh.

Parameters:
  • itemp_list – List of temperature indices to interpolate. None for all.

  • lpratio – Ratio between the number of star functions and the number of ab-initio k-points. The default should be OK in many systems, larger values may be required for accurate derivatives.

  • mode – Interpolation mode, can be ‘qp’ or ‘ks+lifetimes’

  • ks_ebands_kpath – KS abipy.electrons.ebands.ElectronBands on a k-path. If present, the routine interpolates the QP corrections and apply them on top of the KS band structure This is the recommended option because QP corrections are usually smoother than the QP energies and therefore easier to interpolate. If None, the QP energies are interpolated along the path defined by vertices_names and line_density.

  • ks_ebands_kmesh – KS abipy.electrons.ebands.ElectronBands on a homogeneous k-mesh. If present, the routine interpolates the corrections on the k-mesh (used to compute the QP DOS)

  • ks_degatol – Energy tolerance in eV. Used when either ks_ebands_kpath or ks_ebands_kmesh are given. KS energies are assumed to be degenerate if they differ by less than this value. The interpolator may break band degeneracies (the error is usually smaller if QP corrections are interpolated instead of QP energies). This problem can be partly solved by averaging the interpolated values over the set of KS degenerate states. A negative value disables this ad-hoc symmetrization.

  • vertices_names – Used to specify the k-path for the interpolated QP band structure when ks_ebands_kpath is None. It’s a list of tuple, each tuple is of the form (kfrac_coords, kname) where kfrac_coords are the reduced coordinates of the k-point and kname is a string with the name of the k-point. Each point represents a vertex of the k-path. line_density defines the density of the sampling. If None, the k-path is automatically generated according to the point group of the system.

  • line_density – Number of points in the smallest segment of the k-path. Used with vertices_names.

  • filter_params – TO BE DESCRIBED

  • only_corrections – If True, the output contains the interpolated QP corrections instead of the QP energies. Available only if ks_ebands_kpath and/or ks_ebands_kmesh are used.

  • verbose – Verbosity level

Returns: class:TdepElectronBands.

plot_qpgaps_t(qp_kpoints=0, qp_type='qpz0', ax_list=None, plot_qpmks=True, fontsize=8, **kwargs) Any[source]

Plot the KS and the QP(T) direct gaps for all the k-points available in the SIGEPH file.

Parameters:
  • qp_kpoints – List of k-points in self-energy. Accept integers (list or scalars), list of vectors, or None to plot all k-points.

  • qp_type – “qpz0” for linearized QP equation with Z factor at KS e0, “otms” for on-the-mass-shell results.

  • ax_list – List of matplotlib.axes.Axes or None if a new figure should be created.

  • plot_qpmks – If False, plot QP_gap, KS_gap else (QP_gap - KS_gap)

  • fontsize – legend and title fontsize.

  • kwargs – Passed to ax.plot method except for marker.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpdata_t(spin, kpoint, band_list=None, fontsize=8, **kwargs) Any[source]

Plot the QP results as function T for a given (spin, k-point) and all bands.

Parameters:
  • spin – Spin index

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • band_list – List of band indices to be included. If None, all bands are shown.

  • fontsize – legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

qplist_spin()[source]

Tuple of QpTempList objects indexed by spin.

plot_qps_vs_e0(itemp_list=None, with_fields='all', reim='real', function=<function SigEPhFile.<lambda>>, exclude_fields=None, e0='fermie', colormap='jet', xlims=None, ylims=None, ax_list=None, fontsize=8, **kwargs) Any[source]

Plot the QP results in the SIGEPH file as function of the initial KS energy.

Parameters:
  • itemp_list – List of integers to select a particular temperature. None means all

  • with_fields – The names of the qp attributes to plot as function of e0. Accepts: List of strings or string with tokens separated by blanks. See QPState for the list of available fields.

  • reim – Plot the real or imaginary part

  • function – Apply a function to the results before plotting

  • exclude_fields – Similar to with_field but excludes fields.

  • e0 – Option used to define the zero of energy. Possible values: - fermie: shift energies to have zero energy at the Fermi level. - Number e.g e0=0.5: shift all eigenvalues to have zero energy at 0.5 eV - None: Don’t shift energies, equivalent to e0=0

  • ax_list – List of matplotlib.axes.Axes for plot. If None, new figure is produced.

  • colormap – matplotlib color map.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • ylims – Similar to xlims but for y-axis.

  • fontsize – Legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpbands_ibzt(itemp_list=None, e0='fermie', colormap='jet', ylims=None, fontsize=8, **kwargs) Any[source]

Plot the KS band structure in the IBZ with the QP(T) energies.

Parameters:
  • itemp_list – List of integers to select a particular temperature. None for all

  • e0 – Option used to define the zero of energy in the band structure plot.

  • colormap – matplotlib color map.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – Legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_lws_vs_e0(rta_type='serta', itemp_list=None, ax=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot phonon-induced linewidths vs KS energy for different temperatures.

Parameters:
  • rta_type – “serta” for SERTA linewidths or “mrta” for MRTA linewidths.

  • itemp_list – List of temperature indices to interpolate. None for all.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib color map.

  • fontsize – fontsize for titles and legend.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_tau_vtau(rta_type='serta', itemp_list=None, ax_list=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot transport lifetimes, group velocities and mean free path (v * tau). as a function of the KS energy for a given relaxation time approximation.

Parameters:
  • rta_type – “serta” for SERTA linewidths or “mrta” for MRTA linewidths.

  • itemp_list – List of temperature indices to interpolate. None for all.

  • ax_list – List of matplotlib.axes.Axes for plot. If None, new figure is produced.

  • colormap – matplotlib color map.

  • fontsize – fontsize for titles and legend.

  • kwargs – Optional Keyword arguments.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_scratew_skb(spin, kpoint, band, rta_type='serta', ax=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot the spectral decomposition of the scattering rate for a single (spin, kpoint, state) as a function of the phonon energy for all temperatures.

Parameters:
  • spin – Spin index (C convention, i.e >= 0).

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or integer defining the k-point in the kcalc array

  • band – band index. C convention so decremented by -1 wrt Fortran index.

  • rta_type – “serta” for SERTA linewidths or “mrta” for MRTA linewidths.

  • itemp_list – List of integers to select a particular temperature. None means all

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib color map.

  • fontsize – legend and label fontsize.

  • kwargs – Keyword arguments passed to ax.plot

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_scratew(cbm_or_vbm, kt_fact=1.5, ewin_mev=1.0, spin=0, rta_type='serta', ax=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot the spectral decomposition of the scattering rate as a function of the phonon energy for all temperatures.

Parameters:
  • cbm_or_vbm

  • kt_fact

  • ewin_mev

  • spin – Spin index (C convention, i.e >= 0).

  • rta_type – “serta” for SERTA linewidths or “mrta” for MRTA linewidths.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib color map.

  • fontsize – legend and label fontsize.

  • kwargs – Keyword arguments passed to ax.plot

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpsolution_skb(spin, kpoint, band, itemp=0, with_int_aw=True, ax_list=None, xlims=None, fontsize=8, **kwargs) Any[source]

Graphical representation of the QP solution(s) along the real axis including the approximated solution obtained with the linearized equation and the on-the-mass-shell approach.

Produce two subplots:
  1. Re/Imag part and intersection with omega - eKs

  2. A(w) + int^w A(w’)dw’ + OTMS

Parameters:
  • spin – Spin index (C convention, i.e >= 0).

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or integer defining the k-point in the kcalc array

  • band – band index. C convention so decremented by -1 wrt Fortran index.

  • itemp – Temperature index.

  • with_int_aw – Plot cumulative integral of A(w).

  • ax_list – List of matplotlib.axes.Axes. If None, new figure is produced.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – legend and label fontsize.

  • kwargs – Keyword arguments passed to ax.plot

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpsolution_sk(spin, kpoint, itemp=0, with_int_aw=True, ax_list=None, xlims=None, fontsize=8, **kwargs) Any[source]

Produce grid of plots with graphical representation of the QP solution(s) along the real axis for all computed bands at given spin and kpoint. See also plot_qpsolution_skb

Parameters:
  • spin – Spin index (C convention, i.e >= 0).

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or integer defining the k-point in the kcalc array

  • band – band index. C convention so decremented by -1 wrt Fortran index.

  • itemp – Temperature index.

  • with_int_aw – Plot cumulative integral of A(w).

  • ax_list – List of matplotlib.axes.Axes. If None, new figure is produced.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – legend and label fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpsolution_sklineb(spin, kbounds, band, itemp=0, with_int_aw=True, dist_tol=1e-06, xlims=None, fontsize=8, **kwargs) Any[source]

Produce grid of plots with graphical representation of the QP solution(s) along the real axis given spin and band and all (computed) kpoints along the segment defined by kbounds. See also plot_qpsolution_skb

Parameters:
  • spin – Spin index (C convention, i.e >= 0).

  • kbounds – List of two items defining the segment in k-space. Accept two strings with the name of the k-points e.g. [“G”, “X”] where G stands for Gamma or two vectors with fractional coords e.g. [[0,0,0], [0.5,0,0]]

  • band – band index. C convention so decremented by -1 wrt Fortran index.

  • itemp – Temperature index.

  • with_int_aw – Plot cumulative integral of A(w).

  • dist_tol – A point is considered to be on the path if its distance from the line is less than dist_tol.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – legend and label fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2fw_skb(spin, kpoint, band, what='auto', ax=None, fontsize=12, units='meV', **kwargs) Any[source]

Plot the Eliashberg function a2F_{n,k,spin}(w) (gkq2/Fan-Migdal/DW/Total contribution) for a given (spin, kpoint, band)

Parameters:
  • spin – Spin index

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or integer defining the k-point in the kcalc array

  • band – band index. C convention so decremented by -1 wrt Fortran index.

  • what – fandw for FAN, DW. gkq2 for $|gkq|^2$. Auto for automatic selection based on imag_only

  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2fw_skb_sum(what='auto', ax=None, exchange_xy=False, fontsize=8, **kwargs) Any[source]

Plot the sum of the Eliashberg functions a2F_{n,k,spin}(w) (gkq2/Fan-Migdal/DW/Total contribution) over the k-points and bands for which self-energy matrix elements have been computed.

Note

This quantity is supposed to give a qualitative The value indeed is not an integral in the BZ, besides the absolute value depends on the number of bands in the self-energy.

Args:

what: fandw for FAN, DW. gkq2 for $|gkq|^2$. Auto for automatic selection based on imag_only ax: matplotlib.axes.Axes or None if a new figure should be created. exchange_xy: True to exchange x-y axis. fontsize: legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_a2fw_all(units='meV', what='auto', sharey=False, fontsize=8, **kwargs) Any[source]

Plot the Eliashberg function a2F_{n,k,spin}(w) (gkq2/Fan-Migdal/DW/Total contribution) for all k-points, spin and the VBM/CBM for these k-points.

Parameters:
  • units – Units for phonon plots. Possible values in (“eV”, “meV”, “Ha”, “cm-1”, “Thz”). Case-insensitive.

  • what – fandw for FAN, DW. gkq2 for $|gkq|^2$. Auto for automatic selection based on imag_only

  • sharey – True if Y axes should be shared.

  • fontsize – legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

get_panel(**kwargs)[source]

Build panel with widgets to interact with the abipy.eph.sigeph.SigEPhFile either in a notebook or in panel app.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user. Used in abiview.py to get a quick look at the results.

write_notebook(nbpath=None, title=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.sigeph.SigEPhRobot(*args)[source]

Bases: Robot, RobotWithEbands

This robot analyzes the results contained in multiple SIGEPH.nc files.

Inheritance Diagram

Inheritance diagram of SigEPhRobot
EXT = 'SIGEPH'
get_dataframe_sk(spin, kpoint, with_params=True, ignore_imag=False) DataFrame[source]

Return pandas.DataFrame with QP results for this spin, k-point

Parameters:
  • spin – Spin index

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • with_params – True to add convergence parameters.

  • ignore_imag – only real part is returned if ignore_imag.

get_dirgaps_dataframe(kpoint, itemp=None, spin=0, with_params=True) DataFrame[source]

Returns pandas.DataFrame with QP direct gaps at the given k-point for all the files in the robot

Parameters:
  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • itemp – Temperature index, if None all temperatures are returned.

  • spin – Spin index

  • with_params – False to exclude calculation parameters from the dataframe.

get_dataframe(with_params=True, with_spin='auto', ignore_imag=False) DataFrame[source]

Return pandas.DataFrame with QP results for all k-points, bands and spins present in the files treated by the robot.

Parameters:
  • with_params

  • with_spin – True to add column with spin index. “auto” to add it only if nsppol == 2

  • ignore_imag – only real part is returned if ignore_imag.

plot_selfenergy_conv(spin, kpoint, band, itemp=0, sortby=None, hue=None, colormap='viridis', xlims=None, fontsize=8, **kwargs) Any[source]

Plot the convergence of the EPH self-energy wrt to the sortby parameter. Values can be optionally grouped by hue.

Parameters:
  • spin – Spin index.

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • band – Band index.

  • itemp – Temperature index.

  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • colormap – matplotlib color map.

  • xlims – Set the data limits for the x-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • fontsize – Legend and title fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpgaps_t(qp_kpoints=0, qp_type='qpz0', plot_qpmks=True, sortby=None, hue=None, fontsize=8, **kwargs) Any[source]

Compare the QP(T) direct gaps for all the k-points available in the robot.

Parameters:
  • qp_kpoints – List of k-points in self-energy. Accept integers (list or scalars), list of vectors, or None to plot all k-points.

  • qp_type – “qpz0” for linearized QP equation with Z factor compute at KS e0, “otms” for on-the-mass-shell results.

  • plot_qpmks – If False, plot QP_gap, KS_gap else (QP_gap - KS_gap)

  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • fontsize – legend and label fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpgaps_convergence(qp_kpoints='all', itemp=0, qp_type='qpz0', sortby=None, hue=None, plot_qpmks=True, fontsize=8, **kwargs) Any[source]

Plot the convergence of the direct QP gaps at given temperature for all the k-points and spins treated by the robot.

Parameters:
  • qp_kpoints – List of k-points in self-energy. Accept integers (list or scalars), list of vectors, or “all” to plot all k-points.

  • itemp – Temperature index.

  • qp_type – “qpz0” for linear qp equation with Z factor computed at KS e0, “otms” for on-the-mass-shell values.

  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • plot_qpmks – If False, plot QP_gap, KS_gap else (QP_gap - KS_gap)

  • fontsize – legend and label fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpdata_conv_skb(spin, kpoint, band, itemp=0, sortby=None, hue=None, fontsize=8, **kwargs) Any[source]

Plot the convergence of the QP results at the given temperature for given (spin, kpoint, band)

Parameters:
  • spin – Spin index.

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • band – Band index.

  • itemp – Temperature index.

  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • fontsize – legend and label fontsize.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_qpfield_vs_e0(field, itemp=0, reim='real', function=<function SigEPhRobot.<lambda>>, sortby=None, hue=None, fontsize=8, colormap='jet', e0='fermie', **kwargs) Any[source]

For each file in the robot, plot one of the attributes of QpTempState at temperature itemp as a function of the KS energy.

Parameters:
  • field (str) – String defining the attribute to plot.

  • itemp (int) – Temperature index.

  • reim – Plot the real or imaginary part

  • function – Apply a function to the results before plotting

  • sortby – Define the convergence parameter, sort files and produce plot labels. Can be None, string or function. If None, no sorting is performed. If string and not empty it’s assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of sortby(abifile) is used.

  • hue – Variable that define subsets of the data, which will be drawn on separate lines. Accepts callable or string If string, it is assumed that the abifile has an attribute with the same name and getattr is invoked. If callable, the output of hue(abifile) is used.

  • colormap – matplotlib color map.

  • fontsize – legend and label fontsize.

  • e0 – Option used to define the zero of energy in the band structure plot.

Note

For the meaning of the other arguments, see other robot methods.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_lws_vs_e0(rta_type='serta', itemp_list=None, colormap='jet', fontsize=8, **kwargs) Any[source]

Plot phonon-induced linewidths vs KS energy for different temperatures for all files in the robot.

Parameters:
  • rta_type – “serta” for SERTA linewidths or “mrta” for MRTA linewidths.

  • itemp_list – List of temperature indices to interpolate. None for all.

  • colormap – matplotlib color map.

  • fontsize – fontsize for titles and legend.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user.

write_notebook(nbpath=None, title=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.sigeph.TdepElectronBands(tmesh, ks_ebands_kpath, qp_ebands_kpath_t, ks_ebands_kmesh, qp_ebands_kmesh_t, interpolators_t)[source]

Bases: object

A list of abipy.electrons.ebands.ElectronBands (T) with a real part renormalized by the E-PH sel-energy. Imaginary part is stored in a specialized array. This object is not supposed to be instantiated directly. It is usually constructed in SigEPhFile by interpolating the ab-initio results

Provides methods to plot renormalized band structures with linewidths.

has_kpath()[source]

True if interpolated bands on the k-path are available.

has_kmesh()[source]

True if interpolated bands on the k-mesh are available.

to_string(verbose=0) str[source]

String representation with verbosiy level verbose.

classmethod pickle_load(filepath: str)[source]

Loads the object from a pickle file.

pickle_dump(filepath=None)[source]

Save the status of the object in pickle format. If filepath is None, a temporary file is created.

Return: name of the pickle file.

plot_itemp_with_lws_vs_e0(itemp, ax_list=None, width_ratios=(2, 1), function=<function TdepElectronBands.<lambda>>, fact=10.0, **kwargs) Any[source]

Plot bandstructure with linewidth at temperature itemp and linewidth vs the KS energies.

Parameters:
  • itemp – Temperature index.

  • ax_list – The axes for the bandstructure plot and the DOS plot. If ax_list is None, a new figure is created and the two axes are automatically generated.

  • width_ratios – Defines the ratio between the band structure plot and the dos plot.

  • function – Apply this function to the values before plotting.

  • fact

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_itemp(itemp, ax=None, e0='fermie', ylims=None, fontsize=12, fact=2.0, **kwargs) Any[source]

Plot band structures with linewidth at temperature itemp.

Parameters:
  • itemp – Temperature index.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • e0 – Option used to define the zero of energy in the band structure plot.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • fontsize – Fontsize for title.

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot(e0='fermie', ylims=None, fontsize=8, **kwargs) Any[source]

Plot grid of band structures with linewidth (one plot for each temperature).

Parameters:
  • e0 – Option used to define the zero of energy in the band structure plot. Possible values: - fermie: shift all eigenvalues to have zero energy at the Fermi energy (self.fermie). - Number e.g e0=0.5: shift all eigenvalues to have zero energy at 0.5 eV - None: Don’t shift energies, equivalent to e0=0

  • fontsize – Fontsize for title.

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_lws_vs_e0(itemp_list=None, ax=None, e0='fermie', function=<function TdepElectronBands.<lambda>>, exchange_xy=False, colormap='jet', xlims=None, ylims=None, fontsize=8, **kwargs) Any[source]

Plot electron linewidths vs KS energy at temperature itemp

Parameters:
  • itemp_list – List of temperature indices to interpolate. None for all.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • e0 – Option used to define the zero of energy in the band structure plot. Possible values: - fermie: shift all eigenvalues to have zero energy at the Fermi energy (self.fermie). - Number e.g e0=0.5: shift all eigenvalues to have zero energy at 0.5 eV - None: Don’t shift energies, equivalent to e0=0

  • function – Apply this function to the values before plotting

  • exchange_xy – True to exchange x-y axis.

  • colormap – matplotlib color map.

  • xlims – Set the data limits for the x-axis or the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • ylims – Set the data limits for the x-axis or the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used

  • fontsize – fontsize for titles and legend.

Returns: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

get_ebands_plotter(edos_kwargs=None, with_edos=True) ElectronBandsPlotter[source]

Build and return abipy.electrons.ebands.ElectronBandsPlotter with KS and QP(T) results

Parameters:
  • edos_kwargs – optional dictionary with the options passed to get_edos to compute the electron DOS.

  • with_edos – False if DOSes are not wanted

get_edos_plotter(edos_kwargs=None) ElectronDosPlotter[source]

Build and return abipy.electrons.ebands.ElectronDosPlotter with KS and QP(T) results.

Parameters:

edos_kwargs – optional dictionary with the options passed to get_edos to compute the electron DOS.

class abipy.eph.sigeph.SigmaPhReader(path: str)[source]

Bases: BaseEphReader

Reads data from file and constructs objects.

Inheritance Diagram

Inheritance diagram of SigmaPhReader
get_sigma_skb_kpoint(spin, kpoint, band)[source]

This method receives in input easy-to-use indices/arguments such as the reduced coordinates of the k-point and/or the “global” band index the user would expect if all bands were treated and returns the indices needed to access the internal netcdf arrays. It also performs some basic consistency checks.

Raises: ValueError if invalid input.

Returns: (spin, ikcalc, band_kcalc, kpoint) where ikcalc and band_kcalc are the internal netcdf indices

sigkpt2index(sigma_kpoint)[source]

Returns the index of the self-energy k-point in sigma_kpoints Used to access data in the arrays that are dimensioned as [0:nkcalc]. sigma_kpoint can be either an integer or list with reduced coordinates.

read_qplist_sk(spin, kpoint, ignore_imag=False)[source]

Read and return QpTempList object for the given spin, kpoint.

Parameters:
  • spin – Spin index.

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • ignore_imag – Only real part is returned if ignore_imag.

read_sigeph_skb(spin, kpoint, band)[source]

Returns the e-ph self energy for the given (spin, k-point, band).

Parameters:
  • spin – Spin index

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • band – band index.

Return: EphSelfEnergy object.

read_a2feph_skb(spin, kpoint, band)[source]

Read and return the Eliashberg function for the given (spin, k-point, band).

Parameters:
  • spin – Spin index

  • kpoint – K-point in self-energy. Accepts abipy.core.kpoints.Kpoint, vector or index.

  • band – band index.

Return: A2feph object.

read_qp(spin, kpoint, band, ignore_imag=False)[source]

Return QpTempState for the given (spin, kpoint, band) (NB: band is a global index i.e. unshifted) Only real part is returned if ignore_imag.

read_allqps(ignore_imag=False)[source]

Return list with nsppol items. Each item is a QpTempList with the QP results.

Parameters:

ignore_imag – Only real part is returned if ignore_imag.

transportfile Module

TRANSPORT.nc file.

Warning: This fileformat is deprecated and will be removed when Abinit 9.2 is released

class abipy.eph.transportfile.TransportFile(filepath)[source]

Bases: AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter

classmethod from_file(filepath)[source]

Initialize the object from a netcdf file.

property ntemp

Number of temperatures.

ebands()[source]

abipy.electrons.ebands.ElectronBands object.

property structure

abipy.core.structure.Structure object.

params()[source]

OrderedDict with parameters that might be subject to convergence studies.

to_string(verbose=0)[source]

String representation

plot_edos(ax=None, **kwargs)[source]

Plot the electronic density of states

Parameters:

axmatplotlib.axes.Axes or None if a new figure should be created.

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_vvtau_dos(component='xx', ax=None, colormap='jet', fontsize=8, **kwargs)[source]

Plot velocity * lifetime density of states.

Parameters:
  • component – Component to plot: “xx”, “yy” “xy” …

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib colormap.

  • fontsize (int) – fontsize for titles and legend

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_mobility(component='xx', ax=None, colormap='jet', fontsize=8, **kwargs)[source]

Read the mobility from the netcdf file and plot it

Parameters:
  • component – Component to plot: “xx”, “yy” “xy” …

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • colormap – matplotlib colormap.

  • fontsize (int) – fontsize for titles and legend

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

get_mobility_mu(eh, itemp, component='xx', ef=None, spin=0)[source]

Get the value of the mobility at a chemical potential Ef

Parameters:
  • eh

  • itemp – Index of the temperature.

  • component – Component to plot: “xx”, “yy” “xy” …

  • ef – Value of the doping in eV. The default None uses the chemical potential at the temperature

  • spin – Spin index.

yield_figs(**kwargs)[source]

Return figures plotting the transport data

close()[source]

Close the file.

write_notebook(nbpath=None)[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

varpeq Module

This module contains objects for post-processing polaron calculations using the results stored in the VARPEQ.nc file.

For a theoretical introduction see …

class abipy.eph.varpeq.Entry(*, name: 'str', latex: 'str', info: 'str', utype: 'str')[source]

Bases: object

name: str
latex: str
info: str
utype: str
class abipy.eph.varpeq.VarpeqFile(filepath: str | PathLike)[source]

Bases: AbinitNcFile, Has_Structure, Has_ElectronBands, NotebookWriter

This file stores the results of a VARPEQ calculations: SCF cycle, A_nk, B_qnu coefficients It also provides methods to analyze and plot results.

Usage example:

from abipy.eph.varpeq import VarpeqFile
with VarpeqFile("out_VARPEQ.nc") as varpeq:
    print(varpeq)
    varpeq.plot_scf_cycle()

Inheritance Diagram

Inheritance diagram of VarpeqFile
classmethod from_file(filepath: str | PathLike) VarpeqFile[source]

Initialize the object from a netcdf file.

ebands()[source]

abipy.electrons.ebands.ElectronBands object.

property structure: Structure

abipy.core.structure.Structure object.

close() None[source]

Close the file.

polaron_spin()[source]

List of Polaron objects, one for each spin (if any).

params()[source]

dict with the convergence parameters, e.g. nbsum.

to_string(verbose: int = 0) str[source]

String representation with verbosiy level verbose.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

class abipy.eph.varpeq.Polaron(*, spin: int, nstates: int, nb: int, nk: int, nq: int, bstart: int, bstop: int, varpeq: VarpeqFile)[source]

Bases: object

This object stores the polaron coefficients A_kn, B_qnu for a given spin and all the nstate polaron states. Provides methods to plot |A_nk|^2 or |B_qnu|^2 together with the band structures (fatbands-like plots).

spin: int
nstates: int
nb: int
nk: int
nq: int
bstart: int
bstop: int
varpeq: VarpeqFile
classmethod from_varpeq(varpeq: VarpeqFile, spin: int) Polaron[source]

Build an istance from a VarpeqFile and the spin index.

property structure: Structure

Crystalline structure.

property ebands: ElectronBands

Electron bands.

kpoints()[source]

Reduced coordinates of the k-points.

qpoints()[source]

Reduced coordinates of the q-points.

a_kn()[source]

A_{pnk} coefficients for this spin.

b_qnu()[source]

B_{pqnu} coefficients for this spin.

scf_df_state()[source]

List of dataframes with the SCF iterations. One dataframe for each polaron. NB: Energies are converted from Ha to eV.

get_final_results_df(with_params: bool = False) DataFrame[source]

Return daframe with the last iteration for all polaronic states. NB: Energies are in eV.

to_string(verbose: int = 0) str[source]

String representation with verbosiy level verbose.

ngkpt_and_shifts()[source]

Return k-mesh divisions and shifts.

get_title(with_gaps: bool = True) str[source]

Return string with title for matplotlib plots.

insert_a_inbox(fill_value=None) tuple[source]

Return a_data, ngkpt, shifts where a_data is a (nstates, nb, nkx, nky, nkz)) array with A_{pnk} with p the polaron index.

insert_b_inbox(fill_value=None) tuple[source]

Return b_data, ngqpt, shifts where b_data is a (nstates, nb, nqx, nqy, nqz)) array with B_{pqnu} with p the polaron index.

get_a2_interpolator_state(interp_method) BzRegularGridInterpolator[source]

Build and return an interpolator for |A_nk|^2 for each polaronic state.

Parameters:

interp_method – The method of interpolation. Supported are “linear”, “nearest”, “slinear”, “cubic”, “quintic” and “pchip”.

get_b2_interpolator_state(interp_method) BzRegularGridInterpolator[source]

Build and return an interpolator for |B_qnu|^2 for each polaronic state.

Parameters:

interp_method – The method of interpolation. Supported are “linear”, “nearest”, “slinear”, “cubic”, “quintic” and “pchip”.

write_a2_bxsf(filepath: str | PathLike, fill_value: float = 0.0) None[source]

Export sum_n |A_{pnk}|^2 in BXSF format suitable for visualization with xcrysden (use xcrysden --bxsf FILE). Requires gamma-centered k-mesh.

Parameters:

filepath – BXSF filename.

write_b2_bxsf(filepath: str | PathLike, fill_value: float = 0.0) None[source]

Export sum_{nu} |B_{qnu}|^2 in BXSF format suitable for visualization with xcrysden (use xcrysden --bxsf FILE).

Parameters:

filepath – BXSF filename.

plot_scf_cycle(ax_mat=None, fontsize=8, **kwargs) Any[source]

Plot the SCF cycle.

Parameters:
  • ax_maxmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_ank_with_ebands(ebands_kpath, ebands_kmesh=None, lpratio: int = 5, with_ibz_a2dos=True, method='gaussian', step: float = 0.05, width: float = 0.1, nksmall: int = 20, normalize: bool = False, with_title=True, interp_method='linear', ax_mat=None, ylims=None, scale=10, marker_color='gold', fontsize=12, **kwargs) Any[source]

Plot electron bands with markers whose size is proportional to |A_nk|^2.

Parameters:
  • ebands_kpath – ElectronBands or netcdf file providing an electronic band structure along a k-path.

  • ebands_kmesh – ElectronBands or netcdf file providing an electronic band structure with k-points in the IBZ.

  • lpratio – Ratio between the number of star functions and the number of ab-initio k-points. The default should be OK in many systems, larger values may be required for accurate derivatives.

  • with_ibz_a2dos – True if A2_IBZ(E) should be computed.

  • method – Integration scheme for DOS

  • step – Energy step (eV) of the linear mesh for DOS computation.

  • width – Standard deviation (eV) of the gaussian for DOS computation.

  • nksmall – Number of divisions to sample the smallest reciprocal lattice vector when computing electron DOS

  • normalize – Rescale the DOSes to plot them on the same scale.

  • with_title – True to add title with chemical formula and gaps.

  • interp_method – Interpolation method.

  • ax_mat – Matrix matplotlib.axes.Axes or None if a new figure should be created.

  • ylims – Set the data limits for the y-axis. Accept tuple e.g. (left, right) or scalar e.g. left. If left (right) is None, default values are used.

  • scale – Scaling factor for |A_nk|^2.

  • marker_color – Color for markers.

  • fontsize – fontsize for legends and titles

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_bqnu_with_ddb(ddb, with_phdos=True, anaddb_kwargs=None, **kwargs) Any[source]

High-level interface to plot phonon energies with markers whose size is proportional to |B_qnu|^2. Similar to plot_bqnu_with_phbands but this function receives in input a DdbFile or a path to a ddb file and automates the computation of the phonon bands by invoking anaddb.

Parameters:
  • ddb – DdbFile or path to file.

  • with_phdos – True if phonon DOS should be computed and plotter.

  • anaddb_kwargs – Optional arguments passed to anaddb.

  • kwargs – Optional arguments passed to plot_bqnu_with_phbands.

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_bqnu_with_phbands(phbands_qpath, phdos_file=None, ddb=None, width=0.001, normalize: bool = True, verbose=0, anaddb_kwargs=None, with_title=True, interp_method='linear', ax_mat=None, scale=10, marker_color='gold', fontsize=12, **kwargs) Any[source]

Plot phonon energies with markers whose size is proportional to |B_qnu|^2.

Parameters:
  • phbands_qpath – PhononBands or nc file providing a phonon band structure.

  • phdos_file

  • ddb – DdbFile or path to file.

  • width – Standard deviation (eV) of the gaussian.

  • normalize – Rescale the two DOS to plot them on the same scale.

  • verbose

  • anaddb_kwargs – Optional arguments passed to anaddb.

  • with_title – True to add title with chemical formula and gaps.

  • interp_method – Interpolation method.

  • ax_mat – List of matplotlib.axes.Axes or None if a new figure should be created.

  • scale – Scaling factor for |B_qnu|^2.

  • marker_color – Color for markers.

  • fontsize – fontsize for legends and titles.

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

class abipy.eph.varpeq.VarpeqReader(filepath: str | PathLike)[source]

Bases: BaseEphReader

Reads data from file and constructs objects.

Inheritance Diagram

Inheritance diagram of VarpeqReader
class abipy.eph.varpeq.VarpeqRobot(*args)[source]

Bases: Robot, RobotWithEbands

This robot analyzes the results contained in multiple VARPEQ.nc files.

Usage example:

robot = VarpeqRobot.from_files([
    "out1_VARPEQ.nc",
    "out2_VARPEQ.nc",
    ])

print(robot)
df = robot.get_final_results_df()

Inheritance Diagram

Inheritance diagram of VarpeqRobot
EXT = 'VARPEQ'
to_string(verbose=0) str[source]

String representation with verbosiy level verbose.

get_final_results_df(spin=None, sortby=None, with_params: bool = True) DataFrame[source]

Return dataframe with the last iteration for all polaronic states. NB: Energies are in eV.

Parameters:
  • spin – Spin index, None if all spins should be included.

  • sortby – Name to sort by.

  • with_params – True if columns with convergence parameters should be added.

plot_kconv(colormap='jet', fontsize=12, **kwargs) Any[source]

Plot the convergence of the results wrt to the k-point sampling.

Parameters:
  • colormap – matplotlib color map.

  • fontsize – fontsize for legends and titles

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user. Used in abiview.py to get a quick look at the results.

write_notebook(nbpath=None) str[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporary file in the current working directory is created. Return path to the notebook.

v1sym Module

Object to analyze the results stored in the V1SYM.nc file (mainly for debugging purposes)

class abipy.eph.v1sym.V1symFile(filepath)[source]

Bases: AbinitNcFile, Has_Structure, NotebookWriter

structure()[source]

abipy.core.structure.Structure object.

pertsy_qpt()[source]

Determine the symmetrical perturbations. Meaning of pertsy:

0 for non-target perturbations. 1 for basis perturbations. -1 for perturbations that can be found from basis perturbations.

close()[source]

Close the file.

params()[source]

OrderedDict with parameters that might be subject to convergence studies.

to_string(verbose=0)[source]

String representation.

qpoints()[source]
read_v1_at_iq(key, iq, reshape_nfft_nspden=False)[source]
plot_diff_at_qpoint(qpoint=0, fontsize=8, **kwargs)[source]
Parameters:
  • qpoint

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

plot_pots_at_qpoint(qpoint=0, fontsize=8, **kwargs)[source]
Parameters:
  • qpoint

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user.

write_notebook(nbpath=None)[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.

wr Module

Object to analyze the results stored in the WR.nc file

class abipy.eph.wr.WrNcFile(filepath)[source]

Bases: AbinitNcFile, Has_Structure, NotebookWriter

create_xsf(iatom=0, red_dir=(1, 0, 0), u=1.0, ispden=0)[source]
structure()[source]

abipy.core.structure.Structure object.

close()[source]

Close the file.

params()[source]

OrderedDict with parameters that might be subject to convergence studies.

to_string(verbose=0)[source]

String representation.

plot_maxw(scale='semilogy', ax=None, fontsize=8, **kwargs)[source]

Plot the decay of max_{r,idir,ipert} |W(R,r,idir,ipert)| for the long-range and the short-range part.

Parameters:
  • scale – “semilogy”, “loglog” or “plot”.

  • axmatplotlib.axes.Axes or None if a new figure should be created.

  • fontsize – fontsize for legends and titles

Return: matplotlib.figure.Figure

Keyword arguments controlling the display of the figure:

kwargs

Meaning

title

Title of the plot (Default: None).

show

True to show the figure (default: True).

savefig

“abc.png” or “abc.eps” to save the figure to a file.

size_kwargs

Dictionary with options passed to fig.set_size_inches e.g. size_kwargs=dict(w=3, h=4)

tight_layout

True to call fig.tight_layout (default: False)

ax_grid

True (False) to add (remove) grid from all axes in fig. Default: None i.e. fig is left unchanged.

ax_annotate

Add labels to subplots e.g. (a), (b). Default: False

fig_close

Close figure. Default: False.

plotly

Try to convert mpl figure to plotly.

yield_figs(**kwargs)[source]

This function generates a predefined list of matplotlib figures with minimal input from the user.

write_notebook(nbpath=None)[source]

Write a jupyter notebook to nbpath. If nbpath is None, a temporay file in the current working directory is created. Return path to the notebook.