API access to info on task relaxation plots

Hi,
I’ve been looking around to find a way to access to the information (energy at each step) provided in relaxation plots in task pages through API, but so far I was not successful. I’m wondering if there is some hidden feature/trick in API which can help us to do so?
In the other wordings, I would like to retrive the energies at each ionic steps for materials possibly without going through checking whether vasprun.xml is accessible in NoMAD and consequently parsing it.
Any other solution is also highly appreciated.

Best regards,
Pezhman

Welcome to the forum, Pezhman!

I can’t find where this is documented, but if you have a URL for a task detail page, making sure that it is the URL for just the task and not keyed off the material, e.g.

https://materialsproject.org/tasks/mp-19770#mp-714977

is what you see when you navigate to task mp-714977 through its association with material mp-19770, but you want to change that URL to

https://materialsproject.org/tasks/mp-714977

, then you can append /json to the URL to get a JSON representation of the task detail (and you can access this programmatically of course):

import requests

task_doc = requests.get(
    "https://materialsproject.org/tasks/mp-714977/json"
).json()

. You can then dig into e.g. the “calcs_reversed” field (calculation details in reverse-chronological order), and within that the “output” field, which in turn has an “ionic_steps” array field, where each sub-document has an “electronic_steps” field, etc. The schema for task documents are implicitly documented by atomate workflows, so you can search through that code for greater clarity on the meaning and provenance of each field.

2 Likes

Hi Donny,
Thanks. It’s very useful forum. It feels good to be member after long-term using of tools.

Thanks for your reponse, much appreciated. It’s exactly what I was looking for. I’ll try to put the steps in a notebook at some point and share it via matgenb to be used by others as well.

Cheers,
Pezhman