api icon indicating copy to clipboard operation
api copied to clipboard

[Bug]: Mismatch between MP website and mp elasticity route

Open chiang-yuan opened this issue 2 years ago • 2 comments

Email (Optional)

No response

Version

0.33.3

Which OS(es) are you using?

  • [ ] MacOS
  • [ ] Windows
  • [X] Linux

What happened?

I am attempting to access ElasticityDoc by material_id that is bound to the computed entry on MP database. Following the example in the Elastic Constant section on MP website will give error of unexpected keyword argument.

Is there specific reason why we can only access Elasticity Doc by task_id but not material_id? (get_by_key_materials_elasticity__task_id___get) Accessing it through task_id is also not straightforward since we need to go through all the task_ids bound to certain materials and examine which is the one used for creating ElasticityDoc.

It would be extremely helpful if we can access multiple ElasticityDoc through material_id or material_ids.

Code snippet

from mp_api.client import MPRester

with MPRester(api_key="<enter your api key>") as mpr:
    elasticity_doc = mpr.elasticity.search(material_ids=["mp-22862"])

Log output

TypeError: ElasticityRester.search() got an unexpected keyword argument 'material_ids'

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

chiang-yuan avatar Sep 17 '23 01:09 chiang-yuan

Unfortunately, this has not been implemented yet. Since it is not a ton of data, I would suggest just pulling it all and filtering locally for now. Note that this endpoint is going to get overhauled very soon with a batch of new data.

munrojm avatar Sep 21 '23 16:09 munrojm

Thanks @munrojm ! Actually get_data_from_id endpoint works (at least for one entry retrieval), by feeding material_id into document_id argument.

chiang-yuan avatar Sep 21 '23 17:09 chiang-yuan