Pymatgen Plotting DOS by Orbitals

Hello everyone,

I’m new in this world. I’m running some VASP calculations and I couldn’t find a guide that could help me to plot the DOS file by orbital.

I was able to plot the complete DOS and partial DOS for each atom. However, I would like to see each orbital. Is there a way that I could do that?

Thank you!

To get the overall orbitals dos:

dos_dict = my_complete_dos.get_spd_dos()
for orbital, dos in dos_dict.items():
    plotter.add_dos(dos, label=''{}".format(str(orbital)))

To get the orbitals for each atom type:

dos_dict = my_complete_dos.get_element_spd_dos()
for species in dos_dict:
    for orbital, dos in dos_dict[species].items():
        plotter.add_dos(dos, label=''{}:{}".format(str(species), str(orbital)))

To get the orbitals for 1 site (since all sites at once would probably get very messy)

dos_dict = my_complete_dos.get_site_spd_dos(YOUR_SITE_OF_INTEREST)
for orbital, dos in dos_dict.items():
    plotter.add_dos(dos, label=''{}:{}".format(str(YOUR_SITE_OF_INTEREST), str(orbital)))

Hopefully this gets you started

import matplotlib.pyplot as plt
from import Vasprun
from pymatgen.electronic_structure.plotter import BSDOSPlotter,\

# read vasprun.xml,get band and dos information
bs_vasprun = Vasprun("./vasprun.xml",parse_projected_eigen=True)
bs_data = bs_vasprun.get_band_structure(line_mode=True)


# set figure parameters, draw figure
pbandpdos_fig = BSDOSPlotter(bs_projection='elements', dos_projection='elements',\
                             vb_energy_range=5, fixed_cb_energy=5)
pbandpdos_fig.get_plot(bs=bs_data, dos=dos_data)
plt.savefig('pbandpdos_fig.png', img_format='png')

from this website:
(pymatgen画能带图方法-高通量计算初探 | 世事如棋)