Hi @lct,
Guessing you mean XAS not XRD, right? (the title)
The usability of the api docs that you linked as an actual data retrieval tool is pretty limited as that page is meant to be a reference to complement the mp_api
python client, so you might have a hard time getting the info you want efficiently.
I’ll provide some code here that would start get you started with the python client to get where you want to be (I’m assuming you want the plots? edit: re-reading I see you just want the values, the code below still gets you where you want to be). And just picking mp-22862
as a representative of the Na-Cl chemsys.
from mp_api.client import MPRester
import plotly.graph_objects as go
with MPRester(api_key="YOUR_API_KEY") as mpr:
xas_doc = mpr.materials.xas.search(material_ids=["mp-22862"], absorbing_element="Cl", spectrum_type="XANES")
traces = [
go.Scatter(
x=xas_doc[0].spectrum.x,
y=xas_doc[0].spectrum.y,
mode="lines",
fill="tozeroy",
)
]
go.Figure(traces)
If you run the above code in a Juptyer notebook the plot will render directly. You’ll have to consult Plotly’s documentation for further plot customization/exporting the plots.
Now, if you are strictly unable to use the mp_api
and you are okay with retrieving a few results at a time from the demo functionality in the api docs, try adding “spectrum” to the _fields
entry in the Materials XAS section, you’ll get the following json in that Response Body
section of the results (some data omitted for brevity):
data: [
{
spectrum: {
"@module": "pymatgen.analysis.xas.spectrum",
"@class": "XAS",
"@version": "2020.4.29",
x: [
2815.947, ...
],
y: [
0.0196335, ...
],
structure: ...
those x
and y
arrays are the same used in the above python code (and in the Material Explorer)