Adding additional fileds in FireWorks docs with jobflow/atomate2

Hello everybody :slight_smile:

Is there a way to add additional fields to the FireWorks docs using jobflow and atomate2? I want to add the Materials Project ID to make it easier to rearrange and analyze the database output. I was thinking of something similar like update_dict in add_additional_fields_to_taskdocs from atomate/VASP-powerups is doing.

Thank you very much for your help in advance!

Hi,

Just to check, do you want to 1. add the data to the FireWorks spec or 2. add the data to the final output task document after the calculation has run?

For 1, you can set the metadata of the job which will get stored in the FireWork spec in the database. For example,


job = RelaxMaker().make(structure)
job.update_metadata({"mp_id": "mp-149"})

For 2, you have two options. Firstly, you can just set the metadata like I did above. This is probably the easiest option. This will get stored alongside but not in the task document. E.g., the output document is structured like:

{
    "uuid": uuid,
    "index": index,
    "output": output,   # containing the VaspTaskDocument
    "metadata": metadata,  # containing the job metadata
    ...
}

If you absolutely need the metadata to be inside the task document, you can do this by modifying the task_document_kwargs option of the VASP jobs. For example, to add the mp_id to all jobs you could run something like:

job.update_maker_kwargs(
    {"_set": {"task_document_kwargs->additional_fields": {"mp_id": "mp-149"}}},
    dict_mod=True,
}

This line should run on jobs or flows. If there is general interest for this, we could add it as a powerup. But Iā€™d suggest considering the metadata option first.

Best,
Alex

1 Like

Hi Alex,
thank you for the fast reply. I tried both suggestions and both are suitable to what I want to achieve. Having the entry in the metadata is basically as I imagined it to be.
Thank you so much :slight_smile: