Wrong DOS from MP

Dear all,
Screenshot from 2022-12-27 14-55-58

I have a question regarding data for DOS from MP. I found out that MP did not give back the correct DOS for some materials, for example, LiAg_mp-2426 (see the figure I attached here). DOS for this compound is not available on webpage of MP, however, I found the same one in Aflowlib

and this DOS curve is much smoother and makes sense. I think the DOS in MP was calculated from symmetry band structure instead of uniform one. I used the following query code

from pymatgen.ext.matproj import MPRester
rester = MPRester(“my_key”)
mp_id = “mp-2426”
dos = rester.get_dos_by_material_id(mp_id)

Thank you,

Dear @anhhv
Thank you for your question!
I checked our data and the DOS you showed in the figure was calculated by the uniform method with a k-point of 19x19x19 by VASP 5.4.4 (the calculation details page for these tasks will be available soon).
It appears that AFlow has a very similar DOS (see attached) in the static plot. In their interactive plot, if you scroll down 1-2 eV you will see the spike around -6 eV, just as the DOS from MP API. Please do notice there are differences in how the calculation was run (e.g. VASP version, k-points etc.)

May I ask how you plot the DOS? I was able to generate an API-queried, smooth DOS with pymatgen.electronic_structure.plotter.DosPlotter :
Screen Shot 2023-01-04 at 3.10.26 PM


Hi Rouxi,

Thank you very much for your useful support. As you said, the DOS calculated with dense k-mesh is already available in MP right?

If it’s true, can you tell me how to dig these DOSs?

Dens k-mesh DOSs are available for all materials?

Here is how I collected DOS and plot it.

import matplotlib.pyplot as plt
from pymatgen.ext.matproj import MPRester
import numpy as np
rester = MPRester(“my-api-key”)

mp_id = “mp-2426”
has_dos = False
dos = rester.get_dos_by_material_id(mp_id)
has_dos = True

if has_dos:
densities = dos.densities
energies = dos.energies
for idx, spin in enumerate(densities.keys()):
if idx == 0:
density_sum = densities[spin]
density_sum += densities[spin]
efermi = dos.efermi
plt.plot(energies - efermi, density_sum)
plt.xlabel(“E - E$_f$ (eV)”)

@anhhv please try to avoid posting your API key on a public forum. Thanks! Also, note that you’re using a legacy API key which will tell the pymatgen MPRester to connect to our legacy API serving an older version of our data. Our new website at materialsproject.org serves the latest data from our new API (api.materialsproject.org).

Thank you @tschaume. I forgot to remove my key.

Hi all,

I switched to mp_api, however, I could not dig the data, e. g.,

from mp_api.client import MPRester
rester = MPRester("my_key")
struct = rester.get_structure_by_material_id("mp-149")


dos = rester.get_dos_by_material_id("mp-149")
MPRestError                               Traceback (most recent call last)
<ipython-input-34-90ab3dc0fd0f> in <module>
----> 1 dos = rester.get_dos_by_material_id("mp-149")
~/anaconda3/lib/python3.7/site-packages/mp_api/client.py in get_dos_by_material_id(self, material_id)
    811         """
    812         return self.electronic_structure_dos.get_dos_from_material_id(  # type: ignore
--> 813             material_id=material_id
    814         )
~/anaconda3/lib/python3.7/site-packages/mp_api/routes/electronic_structure/client.py in get_dos_from_material_id(self, material_id)
    386         else:
    387             raise MPRestError(
--> 388                 "No density of states data found for {}".format(material_id)
    389             )
MPRestError: No density of states data found for mp-149

I wonder that mp_api is ready to be used?


Hi @anhhv,

We cannot reproduce your error – could you share the version of mp-api you have installed? Thank you!

Hi @mkhorton this is information I got

import mp_api

Hi all,

I fixed the problem after updating Pymatgen. Thank you so much for your help.


Hi MP,

I think there’s still problem with DOS for some metals, e. g., mp-15177. The DOS is not smooth in those examples, that raises a question of k-mesh. In addition, the energy step for DOS is very rough, around 0.1 eV.