The Python Script "PLOT-band-structure.py"

by Pasquale Pavone

Purpose: The python script PLOT-band-structure.py is employed in several tutorials for producing plots of the electronic and phonon band-structure along high-symmetry lines in the Brillouin zone of a crystal. Here, we detail how this script works.

General description:

PLOT-band-structure.py can be used basically to plot data from one or more files in the same directory or in different ones. The script generates the PNG output PLOT.png. The different cases are triggered by optional arguments, which are described in the following.

Optional arguments:

Argument Shortcut Default Description
--help -h Show the help message and exit.
--phonon -p If present, it tags the plotting of the phonon-dispersion curves. If absent, the electronic band-structure is plotted.
--eboundary -e One or two floats corresponding to the minimum and maximum energy, respectively, in the plot of the electronic band-structure in the units specified by --eunit. If the argument --phonon is present, the option values specify the minimum and maximum frequency, respectively, in the phonon-dispersion plot in the units specified by --funit. If either the argument --eboundary is not present or no floats are given, the energy (frequency) boundaries are chosen correspondingly to the maximum and minimum of the full data to be plotted.
--scale_box -s 1.0 1.0 One or two floats corresponding to the scaling factor in the horizontal and vertical size of the plot appearence, respectively.
--kboundary -k 0.0 1.0 One or two floats in the interval [0,1] corresponding to the minimum and maximum relative coordinate along the path in reciprocal space, respectively. The value 0 correspond to the initial point in the path, the value 1 to the last one.
--kpoint_boundary -kp One or two integers indicating the initial and final special k-point in the horizontal path.
--directory -d './' List of the directories in which the data to be plotted have to be found. If only one or no directory is specified, the data for the plots are taken from the same directory.
--assign_type -a List of the description keys for each plot of the electronic band-structure. Possible choices are 'KS' (standard Kohn-Sham calculation), 'GW' (G0W0 calculation), and 'WA' (data are interpolated by using Wannier functions). If not present, the option 'KS' is assumed for all plots. Not used if the argument --phonon is present.
--eunit -eu 'eV' Set the units of the energy appearing in the plot of the electronic band-structure. Possible choices are 'eV' (electronvolt) and 'Ha' (Hartree).
--funit -fu 'icm' Set the units of the frequency appearing in the plot of the phonon band-structure. Possible choices are 'icm' (inverse centimeter, cm-1, default), 'meV' (millielectronvolt), and 'THz' (terahertz).
--ezero -z 'Ef' Set the energy zero in the plot to either 'Ef' (Fermi energy, default) or 'vbM' (valence-band maximum).
--legend_label -ll Specifies the labels to appear in the legend for each plot.
--legend_position -l 'best' The location of the legend. The strings 'upper left', 'upper right', 'lower left', 'lower right' place the legend at the corresponding corner of the axes/figure. The strings 'upper center', 'lower center', 'center left', 'center right' place the legend at the center of the corresponding edge of the axes/figure. The string 'center' places the legend at the center of the axes/figure. The string 'best' places the legend at the location, among the nine locations defined so far, with the minimum overlap with other drawn artists. This option can be quite slow for plots with large amounts of data; your plotting speed may benefit from providing a specific location. For back-compatibility, 'center right' (but no other location) can also be spelled 'right', and each string locations can also be given as the corresponding numeric value (see here for more details).
--title -t mmmmmmm Used as --title 'String as a title' assign a title to the plot.
--no_title -nt If present, it disables the writing of the title.
--no_legend -nl If present, it disables the plotting of the legend.
--reverse_colors -rc If present, the order of the sequence of colors of the plots is reversed.
--reverse_plots -rp If present, the order of appearance of the plots is reversed.
--max_ticks_y -mty Specifies the maximum number of ticks along the y-axis in the plot.
--different_volumes -dv If present, in the case of calculations performed at different volumes, rescales the horizontal axes to the first calculation in the list.

Examples:


☛ Tutorial: Electronic band-structure and density of states
$ PLOT-band-structure.py
bandstructure_1.png
$ PLOT-band-structure.py -e -10 20
bandstructure_2.png
☛ Tutorial: Spin-polarized calculations for bcc Fe
$ PLOT-band-structure.py -d SPIN  -e -10 40  -t 'Spin-polarized Fe-bcc'  -l 'center left'
fe-bcc-SPIN-bs.png
☛ Tutorial: Electronic band structure from GW
$ PLOT-band-structure.py -a KS GW  -e -15 10  -z vbM
si-gw-vbm.png
☛ Tutorial: Spin-orbit coupling
$ PLOT-band-structure.py -d GaAs-noSOC GaAs-SOC  -e -5 3  -z vbM
gaas-noSOC+SOC.png
☛ Tutorial: Lattice dynamics of diamond and zincblende-structure crystals
$ PLOT-band-structure.py -p
c-phonon-dispersion-conv.png
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License