I try to download band gap data of materials from NOMAD library with API python code.
I use the online tutorial but it get error in cell of download and create DataFrame:
It looks like at least one of the calculations is missing a piece of information (results[entry].workflow[0].calculation_result_ref is undefined), which makes the query fail in query_nomad_archive.ipynb. A simple solution might be to ignore AttributeErrors in the code. We can see how to fix this in the original tutorial.
But maybe we can help you more directly to formulate the query you are interested in. The example query you linked about querying band gap values in NOMAD does seem to work as expected: it returns a list of band gap values and types for the 10 first entries with a band gap between 0-5 eV, ordered by the entry_id. Maybe you could tell us more about what type of information you are interested in?
Hi Lauri Himanen,
Thanks for your response.
I need to set a dataframe of materials band gap information. For this, I need to have some data such as material’s name, space group, band gap value and so on.
I installed nomad-lab, and tested this example too. But I did not succeed.
Thank you if you can help me solve this problem.
There are several things you should take into account in this example:
These search results correspond to individual calculations, not unique materials. This means that the results will contain band gaps measured with different programs and approximations for the same material.
You should modify the query part to fit your needs: currently, it only makes sure that you get bulk structures where the band gap has been reported. You probably want to add several other filters (level of theory, program name, etc.).
This script only returns the 1000 first search hits. Depending on how many results your query results in, you may have to paginate through them in a loop to retrieve all.
Hi @laurih
I want to apply a filter to the band gap values for use in NOMAD AIP. I used to use this code, but now I am getting incorrect results, which seem related to the filter part of the code. When I remove the part related to the gap value filter the code runs correctly, but there are also materials in the output that do not have their band gap reported which is not what I need.
Has there been any specific change to the API?