BandStructure

This file contains some useful functions and a class for dealing with bands structures. The module can be loaded in the notebook in one of the following way

>>> from mppi import Utilities as U
>>> U.build_kpath

or, for instance, to load only BandStructure

>>> from mppi.Utilities import BandStructure
>>> BandStructure
class mppi.Utilities.BandStructure.BandStructure(bands, kpoints, high_sym_points)[source]

Bases: object

Class to manage and plot the band structure.

The class can be initialized in various way. Specific classmethods to init using the output of both QuantumESPRESSO and Ypp are provided.

Parameters
  • kpoints (list) – list with the coordinates of the kpoints used to build the path

  • bands (numpy.array) – the element bands[i] contains the energies of the i-th band (in eV)

  • high_sym_points (dict) – dictionary with the names and coordinates of the high_sym_points of the path

classmethod from_Pw(results, high_sym_points, set_gap=None, set_direct_gap=None)[source]

Initialize the BandStructure class from the result of a QuantumESPRESSO computation performed along a path. The class makes usage of the PwParser of this package.

Parameters
  • results (string) – the data-file-schema.xml that contains the result of the QuantumESPRESSO computation

  • high_sym_points (dict) – dictionary with the names and the coordinates of the high_sym_points of the path

  • set_gap (float) – set the value of the gap (in eV) of the system

  • set_direct_gap (float) – set the value of the direct gap (in eV) of the system. If set_gap is provided this parameter is ignored

classmethod from_Ypp(results, high_sym_points, suffix='bands_interpolated')[source]

Initialize the BandStructure class from the result of a Ypp postprocessing. The class make usage of the YamboParser of this package.

Parameters
  • results (list) – list that contiains the o- file provided as the output of a Ypp computation. results is the key [‘output’][irun] of the run method of YamboCalculator

  • high_sym_points (dict) – dictionary with name and coordinates of the high_sym_points of the path

  • suffix (string) – specifies the suffix of the o- file use to build the bands

get_bands()[source]

Returns the band attribute of the class

get_high_sym_positions(atol=0.0001, rtol=0.0001)[source]

Compute the position of the high_sym_points along the path. The method uses the numpy.allclose function to establish if the coordinates of a point on the path matche with an high_sym_points

Parameters
  • atol (float) – absolute tolerance used by numpy.allclose

  • rtol (float) – relative tolerance used by numpy.allclose

Returns

tuple containing:

(list) : labels of the high symmetry points as found along the path

(list) : coordinate on the path of the high symmetry points

Return type

(tuple)

get_path()[source]

Compute the curvilinear ascissa along the path.

Returns

values of the curvilinear ascissa along the path

Return type

kpath(array)

plot(plt, selection=None, show_vertical_lines=True, **kwargs)[source]

Plot the band structure.

Parameters
  • plt (matplotlib.pyplot) – the matplotlib object

  • selection (list) – the list of bands that are plotted. If None all the bands computed by QuantumESPRESSO are plotted. The band index starts from zero

  • kwargs – further parameter to edit the line style of the plot