materialsproject / api

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

sort_by_e_above_hull can not be used in MPRester.get_entries #872

Closed goodwilling closed 7 months ago

goodwilling commented 7 months ago

-------------script starts------------------- from mp_api.client import MPRester

mpr = MPRester("32-digit API key") entries = mpr.get_entries("mp-149", inc_structure=None, property_data=["material_id", "composition", "energy_above_hull"], sort_by_e_above_hull=True, additional_criteria={"thermo_types": ["GGA_GGA+U"]}) ---------------script ends-----------------

The above script worked well previously, but now it gives error messages as follows:

mp_api.client.core.client.MPRestError: REST query returned with error status code 400 on URL https://api.materialsproject.org/materials/thermo/?_sort_fields=energy_above_hull&_fields=entries%2Cmaterial_id%2Ccomposition%2Cenergy_above_hull&material_ids=mp-149&_limit=1000 with message: Request contains query parameters which cannot be used: _sort_fields

goodwilling commented 7 months ago

According to the commit message, "Remove sort parameters from resters #864", this is a breaking change.