A Jupyter widget to plot the bandstructure and density of states (DOS)¶
This is a Jupyter widget, which plots the bandstructure and density of states from given json files.
Input json files¶
On the left, it plots the bandstructures. One can input several bandstructure json files as a list. The figure on the right shows the density of states, which can only show one DOS plot. The json files for the bandstructures can be generated from AiiDA with the verdi command:
verdi data bands export --format json <IDENTIFIER>
The json format for the DOS can be checked in the github repository.
https://raw.githubusercontent.com/osscar-org/widget-bandsplot/develop/example/data/Si_dos.json
Here, one needs to use the json package to load the json file and pass it to the widget.
with open('./data/Co_bands.json', 'r') as file:
data1 = json.load(file)
with open('./data/Co_dos.json', 'r') as file:
data2 = json.load(file)
Fermi energy¶
The Fermi energy is reading from the bands and DOS json files. And bandstructure and density of states plots are aligned to the Fermi energy (shift the Fermi energy to zero).
In the default plot for the DOS, there is a horizontal line to highlight the Fermi level. One can turn it off by setting plot_fermilevel = False. The legend of the DOS can be turned off by set show_legend = False.
Usage of the widget¶
Remeber to pass the bandstructure data as a list of json objects. "energy_range" sets the energy range for the plots.
Plot both bandstructure and DOS¶
w1 = BandsPlotWidget(bands=[data1], dos=data2, plot_fermilevel = True, energy_range = {"ymin": -13.0, "ymax": 10.0})
display(w1)