Adding additional fileds in FireWorks docs with jobflow/atomate2

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