Hi there,
I am relatively new to computational material science and to using the MP API. I have been trying to access all the XANES K-edge spectra for zinc and the silver compounds. So far, I have tried using the ‘direct route’ (i.e., using the xas.search endpoint) but it seems I have to specify elements as in:
with MPRester(MP_API_KEY) as mpr:
XAS_doc = mpr.xas.search(edge = Edge.K,
absorbing_element = "Zn",
elements = ["Zn", "O"])
What I would like to do is more general, i.e., I would like to access all the Ag and Zn K-edge XANES spectra available in the database. Thus, I have attempted the following code:
from mp_api.client import MPRester
from emmet.core.summary import HasProps
req_fields = ["composition", "formula_pretty", "density_atomic", "symmetry", "structure","is_stable", "xas", "band_gap", "efermi", "bandstructure", "dos_energy_up"]
with MPRester(MP_API_KEY) as mpr:
docs = mpr.summary.search(
has_props = [HasProps.xas], fields = req_fields)
XAS_doc = [doc.xas for doc in docs]
Struct_doc = [doc.structure for doc in docs]
ch_formula = [doc.formula_pretty for doc in docs]
However, using this end point, I am not able to access the K-edge spectra at all. So far, this is what I have been able to do:
E_1 = D[0].absorbing_element
E_2 = D[0].edge.K
E = D[0].spectrum_type.XANES
Is there any way that I can access the spectra using this end point? Alternatively, is there a way I can parse the xas.search end point so that it can return all compounds containing Zn and all compounds containing Ag?