Inquiry about RedoxDoc - data availability and extraction steps

Dear developers and all,

I am a postgraduate student and new to data science. Currently, I am working on electroreduction reaction of metals. Is the data in the RedoxDoc (/molecules/redox) available currently, and if yes, can you assist me on how to extract it?

I have tried various ways to extract data i.e. reduction_potential and oxidation_potential within the MPRester but failed.
Notes that I got: MPRestError: REST query returned with error status code 404 on URL https://api.materialsproject.org/molecules/redox/?_fields=material_id%2Cformula%2Creduction_potential&chemsys=C&_limit=1000 with message:
Not Found.

I really appreciate your help and time.

Best regards.

The MoleculesRedoxRester should allow you to extract it via pymatgen via the mp-api Python client.

mp_api.client.routes.molecules.redox.MoleculesRedoxRester

You can find instructions on how to use mp-api at:

1 Like

Thank you for the prompt response.
I have been able to install the MoleculesRedoxRester. But, unfortunately still facing difficulty in extracting the data. Here is my code and the error.


Code:

from pymatgen.ext.matproj import MPRester

mpr = MPRester(“API KEY”) # use this line if you set up the configuration file

print(type(mpr)) # should be ‘mp_api.client.mprester.MPRester’

#--------

from mp_api.client.routes.molecules.redox import MoleculesRedoxRester

redoxdoc = MoleculesRedoxRester(“API KEY”)
print(type(redoxdoc))
available_fields = redoxdoc.available_fields
print(available_fields)

redoxdata = redoxdoc.search(elements=[“Pt”, “O”])
dfredoxdata = pd.DataFrame(redoxdata)
print(dfredoxdata)


Results:

<class ‘mp_api.client.mprester.MPRester’> <class ‘mp_api.client.routes.molecules.redox.MoleculesRedoxRester’> [‘builder_meta’, ‘charge’, ‘spin_multiplicity’, ‘natoms’, ‘elements’, ‘nelements’, ‘nelectrons’, ‘composition’, ‘composition_reduced’, ‘formula_alphabetical’, ‘formula_pretty’, ‘formula_anonymous’, ‘chemsys’, ‘symmetry’, ‘property_name’, ‘property_id’, ‘molecule_id’, ‘deprecated’, ‘deprecation_reasons’, ‘level_of_theory’, ‘solvent’, ‘lot_solvent’, ‘last_updated’, ‘origins’, ‘warnings’, ‘base_property_id’, ‘electron_affinity’, ‘ea_task_id’, ‘ionization_energy’, ‘ie_task_id’, ‘reduction_energy’, ‘reduction_free_energy’, ‘red_molecule_id’, ‘red_property_id’, ‘oxidation_energy’, ‘oxidation_free_energy’, ‘ox_molecule_id’, ‘ox_property_id’, ‘reduction_potential’, ‘oxidation_potential’]


MPRestError Traceback (most recent call last)

in <cell line: 14>() 12 print(available_fields) 13 —> 14 redoxdata = redoxdoc.search(elements=[“Pt”, “O”]) 15 dfredoxdata = pd.DataFrame(redoxdata) 16 print(dfredoxdata)


9 frames

/usr/local/lib/python3.10/dist-packages/mp_api/client/core/client.py in _submit_request_and_process(self, url, verify, params, use_document_model, timeout) 1029 message = str(data) 1030 → 1031 raise MPRestError( 1032 f"REST query returned with error status code {response.status_code} " 1033 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/redox/?elements=Pt%2CO&_all_fields=True&_limit=1000 with message: Not Found


Appreciate your assistance regarding this issue. Thank you.

It looks like there just aren’t any molecules in the database for those elements.