How to Plot DOS using pymatgen and python?

Hii users
I want to plot DOS similar to figure added below using pymatgen and python. Could anyone please help me how to do this? Also what is mean by get_spd_dos and get_element_dos? I am confused is in spd s orbital is the sum of all elements valence s orbital and in element dos is it total dos of individual element or valence orbital dos of individual element?
Screenshot 2024-02-19 172850

Hi Sakshi.

I think you got the meaning of those two functions correctly.
But, to get a plot like that one you showed, you need to use `get_element_spd_dos’ giving as argument the Element you’d like to have
the orbital-projected dos. For each element you’ll get a dictionary with the projections per each orbital, so you’ll need to remove those you do not need to show in the plot.

Hope this helps to get you started.
FR

HI,

the script you sent should plot the s,p,d dos for Cr and the total dos.
If you want to plot only specific orbitals, you need either to remove from the element_dos the keys you do not want or add to the plotter only those you want.

Supposing element_dos looks like this

element_dos
{<OrbitalType.s: 0>: <pymatgen.electronic_structure.dos.Dos at 0x7ff0da643100>,
 <OrbitalType.p: 1>: <pymatgen.electronic_structure.dos.Dos at 0x7ff0e7e0f2e0>,
 <OrbitalType.d: 2>: <pymatgen.electronic_structure.dos.Dos at 0x7ff0e7eaa940>}
from pymatgen.electronic_structure.plotter import OrbitalType

plotter.add_dos(OrbitalType.s.name,element_dos[OrbitalType.s])

alternatively

element_dos.pop(OrbitalType.s)

plotter.add_dos_dict(element_dos)

Hope this helps
FR

Yes it works. Thank you
Thank you so much.