Querying Elasticity Data by Firework ID

I’m having a lot of trouble querying the specific data that I need from an atomate workflow using mongoDB. I’m trying to get the elastic tensor from a particular atomate workflow. In the MongoDB database that I allocated for elastic tensor workflows, the following collections are present:

['Sample', 'elasticity', 'workflows', 'counter', 'fireworks', 'launches', 'fw_gridfs.files', 'fw_id_assigner', 'tasks']

The elastic tensor is located in the ‘elasticity’ collection, which has the following keys():

dict_keys(['_id', 'analysis', 'initial_structure', 'optimized_structure', 'tags', 'fitting_data', 'elastic_tensor', 'derived_properties', 'formula_pretty', 'fitting_method', 'order'])

There doesn’t seem to be any key in the collection category that can link an elastic tensor to the workflow/firework from which it came. I tried querying the elasticity collection by initial_structure and formula_pretty, but this presents problems when I have more than one elastic tensor calculation in the database with the same initial structure (which I do). I’m wondering how people manage to extract analyzed data from one particular workflow, regardless of if multiple workflows of the same type and with the same initial structure are present? In other words, how can you uniquely identify the elasticity collection from a specific atomate workflow? Is there a way to query the analyzed data from a workflow by firework ID? Thank you!

Hi there,

An easy way of querying duplicated data is to add tags to your workflows.
This way, when you query different batches which you may customize the incar settings, you can identify the results.

When you submit your wf, add this line before adding the wf to your lpad:
wf = add_tags(wf, [new_tag])

After your calculation is done, you can query this result by:
results = db.elasticity.find({‘tags’:{“$all”:[new_tag]}})

For your completed results, you can use lpad update_fws to add tags for existing fws manually.

Hope it would help with your questions.

Wow thank you so much! I didn’t realize you could add custom tags.