Task Type Query


For a project I am working on, I need to either query structures for a specific task type or from a list of task ids identify and sort out a specific task type. For example, for what I am working on, I need to gather tasks with types: “GGA Static” and “GGA+U Static”. Is there a method for doing this? Currently, I am obtaining a list of task ids through the following code excerpt:

tasks = m.query({'material_id': 'mp-36447'}, properties=['task_ids'])[0]['task_ids']

Thank you for your help!

The blessed_tasks sub-document in material documents include such task-type labels as keys. So, you could use that in filters. For example:

from pymatgen.ext.matproj import MPRester

mpr = MPRester()

with_gga_static = mpr.query({
    "blessed_tasks.GGA Static": {"$exists": True}
}, ["material_id", "blessed_tasks"]) # 98758 results

with_ggau_static = mpr.query({
    "blessed_tasks.GGA+U Static": {"$exists": True}
}, ["material_id", "blessed_tasks"]) # 36134 results