<jupyter_start><jupyter_text>This notebook shows some examples of methods on a BandStructureSymmLine object (gettting band gaps, vbm, etc...) and basic plotting. Written by <NAME> (<EMAIL>) We start by querying the MP database for a band structure object. Please note that you could get such an object from a run (VASP, ABINIT, ...) using the methods in pymatgen.io<jupyter_code>from pymatgen.matproj.rest import MPRester
from pymatgen.electronic_structure.core import Spin
#This initiliazes the Rest connection to the Materials Project db. Put your own API key.
a=MPRester("YOUR_API_KEY")
#load the band structure from mp-3748, CuAlO2 from the MP db
bs=a.get_bandstructure_by_material_id("mp-3748")<jupyter_output><empty_output><jupyter_text>We print some information about the band structure<jupyter_code>#is the material a metal (i.e., the fermi level cross a band)
print bs.is_metal()
#print information on the band gap
print bs.get_band_gap()
#print the energy of the 20th band and 10th kpoint
print bs.bands[Spin.up][20][10]
#print energy of direct band gap
print bs.get_direct_band_gap()
#print information on the vbm
print bs.get_vbm()<jupyter_output>False
{'energy': 1.7978000000000005, 'transition': u'(0.591,0.409,0.000)-\\Gamma', 'direct': False}
18.0201
2.6904
{u'kpoint': <pymatgen.electronic_structure.bandstructure.Kpoint object at 0x5192610>, u'kpoint_index': [123], u'energy': 6.1023, u'band_index': {1: [15]}, u'projections': {}}<jupyter_text>Here, we plot the bs object. By default for an insulator we have en energy limit of cbm+4eV and vbm-4 eV<jupyter_code>%matplotlib inline
from pymatgen.electronic_structure.plotter import BSPlotter
plotter=BSPlotter(bs)
plotter.get_plot().show()<jupyter_output><empty_output><jupyter_text>We plot the Brillouin zone with the path which was used for the band structure<jupyter_code>plotter.plot_brillouin()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10021097046413502, 'fraction_numerical': 0.04113924050632911, 'mean_word_length': 6.468503937007874, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '467258', 'license': 'MIT', 'n_tokens_mistral': 708, 'n_tokens_neox': 634, 'n_words': 207, 'path': 'examples/Analyze and plot band structures.ipynb', 'repo_name': 'adozier/pymatgen', 'size': '1928'}