The Python Script "PLOT-dos.py"

by Pasquale Pavone

Purpose: The python script PLOT-dos.py is employed in several tutorials for producing plots of the electronic and phonon density of states (DOS). Here, we detail how this script works.

General description:

PLOT-dos.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. Please notice that in the case of spin-polarized system the electronic spin↓ DOS is represented by default by negative values. 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 DOS. If absent, the electronic DOS 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.
--dos_boundary -db One or two floats corresponding to the minimum and maximum density in the plot of the density of states (DOS) according to the units specified by --eunit. If the argument --phonon is present, the option values specify the minimum and maximum DOS, according to the units specified by --funit. If either the argument --dos_boundary is not present or no floats are given, the DOS boundaries are chosen correspondingly to the maximum and minimum of the full data to be plotted. Please notice that in the case of spin-polarized system the electronic spin↓ DOS is represented by default by negative values.
--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).
--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.
--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.
--grid -g If present, a grid is plotted in correspondence to the position of the major ticks.
--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.
--no_reverse_spin -nrs If present and a spin-polarized density of state is plotted, the spin-down DOS is represented by positive values instead of negative ones.
--no_fill -nf If present, plots are not filled.
--max_ticks_x -mtx Specifies the maximum number of ticks along the x-axis in the plot.
--max_ticks_y -mty Specifies the maximum number of ticks along the y-axis in the plot.

Examples:


☛ Tutorial: Electronic band-structure and density of states
$ PLOT-dos.py
ag-dos.png
☛ Tutorial: Spin-polarized calculations for bcc Fe
$ PLOT-dos.py -d noSPIN  -t 'Spin-unpolarized Fe-bcc'  -nl
fe-bcc-noSPIN-dos.png
$ PLOT-dos.py -d SPIN  -t 'Spin-polarized Fe-bcc'  -nl
fe-bcc-SPIN-dos.png
☛ Tutorial: Electronic band structure from GW
$ PLOT-dos.py -a KS GW
si-gw-dos-KS.GW.png
☛ Tutorial: Phonon properties of diamond-structure crystals
$ PLOT-dos.py -p
c-phonon-dos-conv.png
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License