Hi everyone,
I am trying to retrieve thermodynamic data for Boron Carbide (B4C) from the Materials Project API using the molecules.thermo.search endpoint. I’ve been running the following Python code, but it’s returning a 404 Not Found error.
I have already updated my mp_api library to the latest version (0.45.9) based on a previous discussion, but the error persists.
Code I am using:
with MPRester(api_key) as mpr:
# Step 1: Get the material_id for B4C from summary
summary_results = mpr.materials.summary.search(formula="B4C", fields=["material_id"])
material_ids = [r.material_id for r in summary_results]
print("Found material IDs for B4C:", material_ids)
# Step 2: Use those IDs to query absorption
fields = mpr.molecules.thermo.available_fields
print("Number of fields available in:", len(fields))
results = mpr.molecules.thermo.search(
formula = "B4C",
#precursor_formula="B4C",
#fields = ['database_Ids'],
fields=fields
)
Error Message:
---------------------------------------------------------------------------
MPRestError Traceback (most recent call last)
/tmp/ipython-input-649663158.py in <cell line: 0>()
18 print("Number of fields available in:", len(fields))
19
---> 20 results = mpr.molecules.thermo.search(
21 #material_ids=material_ids,
22 #task_ids = material_ids,
9 frames
/usr/local/lib/python3.12/dist-packages/mp_api/client/core/client.py in _submit_request_and_process(self, url, verify, params, use_document_model, timeout)
1036 message = str(data)
1037
-> 1038 raise MPRestError(
1039 f"REST query returned with error status code {response.status_code} "
1040 f"on URL {response.url} with message:\n{message}"
MPRestError: REST query returned with error status code 404 on URL https://api.materialsproject.org/molecules/thermo/?_fields=builder_meta%2Ccharge%2Cspin_multiplicity%2Cnatoms%2Celements%2Cnelements%2Cnelectrons%2Ccomposition%2Ccomposition_reduced%2Cformula_alphabetical%2Cformula_pretty%2Cformula_anonymous%2Cchemsys%2Csymmetry%2Cspecies_hash%2Ccoord_hash%2Cproperty_name%2Cproperty_id%2Cmolecule_id%2Cdeprecated%2Cdeprecation_reasons%2Clevel_of_theory%2Csolvent%2Clot_solvent%2Clast_updated%2Corigins%2Cwarnings%2Celectronic_energy%2Ccorrection%2Cbase_level_of_theory%2Cbase_solvent%2Cbase_lot_solvent%2Ccorrection_level_of_theory%2Ccorrection_solvent%2Ccorrection_lot_solvent%2Ccombined_lot_solvent%2Czero_point_energy%2Crt%2Ctotal_enthalpy%2Ctotal_entropy%2Ctranslational_enthalpy%2Ctranslational_entropy%2Crotational_enthalpy%2Crotational_entropy%2Cvibrational_enthalpy%2Cvibrational_entropy%2Cfree_energy&formula=B4C&_limit=1000 with message:
Not Found
Could someone please help me understand why this endpoint is returning a 404 error and how I can correctly access the thermodynamic data for B4C?
Thank you for your help!