There is a DOS difference between showing in MP website and obtaining by python code

Hi, i try to download the dos data through MPRester. While the dos plot is very different to the MP website,

. , I am wandering if i made something wrong for the code?

Hi chaohong,

Most of the code looks correct. The only issue is that the energies should be referenced to the Fermi level by subtracting dos.efermi.

energies = dos.energies - dos.efermi
density = dos.densities[Spin.up]
plt.plot(energies, density)
plt.axvline(0, color='black', linestyle='--' )
plt.xlim(-5, 8)
plt.ylim(0, 3.5)

to add on to Min-Hsueh’s answer, if you are also looking to plot the projected elemental dos just add load_projections to your client call, the call will just be a bit longer:

dos = mpr.get_dos_by_material_id("mp-10686", load_projections=True)

and here is a good gist about how to plot the different dos components using pymatgen’s plotting tools: plot DOS, pDOS, and COHP with pymatgen