materialsproject / api

New API client for the Materials Project
https://materialsproject.github.io/api/
Other
108 stars 40 forks source link

Error during getting charge density #912

Closed cypark0411 closed 4 months ago

cypark0411 commented 4 months ago

When I tried to get the charge density of a material, I've got an error message, instead of getting the information.

I couldn't find similar issues, before. any idea how to solve it?

from mp_api.client import MPRester

mpr = MPRester(<mp key>)
charge_density = mpr.get_charge_density_from_material_id(material_id="mp-24338")

Error message

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 1047, in _convert_to_model
    if type(d['builder_meta']['build_date']) == dict:
KeyError: 'builder_meta'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/mprester.py", line 1329, in get_charge_density_from_material_id
    task_ids = self.get_task_ids_associated_with_material_id(
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/mprester.py", line 426, in get_task_ids_associated_with_material_id
    tasks = self.materials.search(material_ids=material_id, fields=["calc_types"])
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/routes/materials/materials.py", line 245, in search
    return super()._search(
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 1202, in _search
    return self._get_all_documents(
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 1275, in _get_all_documents
    results = self._query_resource(
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 565, in _query_resource
    data = self._submit_requests(
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 712, in _submit_requests
    initial_data_tuples = self._multi_thread(
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 934, in _multi_thread
    data, subtotal = future.result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 1006, in _submit_request_and_process
    data["data"] = self._convert_to_model(data["data"])
  File "/usr/local/lib/python3.10/site-packages/mp_api/client/core/client.py", line 1057, in _convert_to_model
    print(d['material_id'])
KeyError: 'material_id'