materialsproject / api

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

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

Open chiang-yuan opened 10 months ago

chiang-yuan commented 10 months ago

Email (Optional)

No response

Version

0.33.3

Which OS(es) are you using?

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_elasticitytaskidget) 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

munrojm commented 9 months ago

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.

chiang-yuan commented 9 months ago

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