materialsproject / api

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

`SummaryRester.search` does not support formulae for `chemsys` any longer? #859

Open e-kwsm opened 8 months ago

e-kwsm commented 8 months ago

mp-api version: 0.37.5

According to the docstring of SummaryRester.search, chemsys argument may be formulae.

https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/materials/summary.py#L93-L94

However it does not work—the following prints 0 26:

import warnings
from pymatgen.ext.matproj import MPRester

warnings.filterwarnings("ignore")

MP_API_KEY = ...  # key for new API
with MPRester(MP_API_KEY) as mpr:
    r_c = mpr.summary.search(chemsys="Fe2O3")
    r_f = mpr.summary.search(formula="Fe2O3")
    print(len(r_c), len(r_f))  # 0 26
    # chemical system works as expected
    r_c_cs = mpr.summary.search(chemsys="Fe-O")
    # print(len(r_c_cs))  # 136

Is the docstring outdated?

munrojm commented 8 months ago

Yes, it should specify that only formula will accept single formula entries.

e-kwsm commented 8 months ago

The same goes for the followings? https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/bonds.py#L58-L59 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/molecules.py#L122-L123 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/orbitals.py#L87-L88 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/partial_charges.py#L52-L53 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/partial_spins.py#L52-L53 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/redox.py#L60-L61 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/summary.py#L54-L55 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/thermo.py#L82-L83 https://github.com/materialsproject/api/blob/47fc6087da8253f55adb101b5df3251b6347b2ac/mp_api/client/routes/molecules/vibrations.py#L67-L68