BandStructure

This module 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(kpoints, bands, kpath=None, high_sym_points=None)[source]

Bases: object

Class to manage and plot the band structure.

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

Parameters:
  • kpoints (array) – array with the coordinates of the kpoints used to build the path. The coordinate used to express the kpoints are arbitrary, consistence with the high_sym_points parameter is required

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

  • kpath (array) – array with the value of the curvilinear abscissa along the path. If this parameter is not provided the curvilinear abscissa is computed by the class assuming that kpoints are expressed in cartesian coordinates, so that their distance is built with the euclidean formula

  • high_sym_points (dict) – dictionary with the names and coordinates of the high_sym_points of the path If this parameter is not provided the high symmetry points are not marked when the plot method of the class is called

classmethod from_Pw(results, high_sym_points=None, set_scissor=None, 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_scissor (float) – set the value of the scissor (in eV) that is added to the empty bands. If a scissor is provided the set_gap and set_direct_gap parameters are ignored

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

  • set_direct_gap (float) – set the value of the direct gap (in eV) of the system.

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

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

Parameters:
  • results (dict) – dictionary with the output of a Ypp computation

  • 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

classmethod from_Ypp_file(results, high_sym_points=None)[source]

Initialize the BandStructure class from the a o-file built by the Ypp postprocessing. The class make usage of the YamboParser of this package.

Parameters:
  • results (string) – name of the o-file built by the Ypp postprocessing

  • 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_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.

If the point ‘G’ is found its label is converted to r’$Gamma’ for a correct rendering of the plot

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

Return type:

(tuple)

get_kpath()[source]

Compute the curvilinear ascissa along the path.

Returns:

values of the curvilinear ascissa along the path

Return type:

array

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

Plot the band structure.

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

  • axes (matplotlib.pyplot.axes) – the matplotlib axes object. If provided the plot is performed on the given axes

  • 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

  • show_vertical_lines (bool) – if True add the vertical lines with the positions of the high symmetry points on the path (if the high_sym_points variable is not None)

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

mppi.Utilities.BandStructure.parse_Ypp_output(data)[source]

Extract the kpath, kpoints and bands from the dictionary results[‘output’][type] given by YamboParser.