Error in getting bandstructure by material id through pymatgen

Hello everyone. I am facing an error in calling the get_bandstructure_by_material_id for certain materials due to huge memory calls. I want to further get the Valence band and Conduction band energy values for these materials. Is there any other approach possible to get these values without procuring the bandstructure?

Can you post the error you are getting?

Another quick solution is to use get_dos_by_material_id:

from pymatgen.ext.matproj import MPRester
with MPRester() as mp:
    d = mp.get_dos_by_material_id(MP_ID_HERE)
cbm, vbm = d.get_cbm_vbm()
1 Like

MPRestError: REST query returned with error status code 504. Content: b"

504 Gateway Time-out

\nThe server didn’t respond in time.\n\n\n"

This is the error I got for material with id “mp-1259193”. The DOS method does work faster than procuring Bandstructures. However, both these approaches result in different values for the properties and the bandgaps. I would appreciate your advice on the reliability of these different values.

It looks to me like the size of the band structure object is very large for that material. It has a lot of atoms so that’s not surprising, and so that error shouldn’t show up for most systems.

As for the DOS, how different are the values? DOS and bandstructure might give slightly different results, but hopefully not too large.

@mkhorton Thoughts on which is more accurate, and how to pull the BS for this large object?

The values obtained are quite different for most of the materials. For eg. “mp-554278” the bandgap from mpquery is 2.694. When I use the bandstructure function it is 2.6843 and by DOS I get 2.6697.

While those are tiny differences, One of those numbers should match the number on the materials detail page. I’ll take a look at that material to see what could be the cause of the discrepancy. If your application is sensitive to such tiny changes in the band gap, then you really need calculations on a higher level than what MP computes. Even then the introduction of any sort of disorder: defects, interfaces, chemical inhomogeneity by processing conditions could easily alter the real-world bandgap by 10%.

As for not being able to get the bandstructure. This is a huge bug in our infrastructure that we don’t have the ability to fix without breaking everything. We’re working on a new API that will fix this, but it’s a long slog and not a quick fix. If you still need the actual bandstructure, Please email [email protected] and we can coordinate getting you that specific one.

1 Like

Yes, to offer more info on this, the content delivery network we’re using has a strict 30-second timeout, and our current API takes longer than that for larger objects.

Our next-generation API is designed to help with this. We have a sign-up sheet for anyone who would like to test it when we’re ready to open up for the next round of testing.

how can I the Fermi energy?