add_metadata_to_flow¶
- atomate2.common.powerups.add_metadata_to_flow(flow, additional_fields, class_filter)[source]¶
Add additional metadata fields to task documents in a flow.
This function updates the task document kwargs for jobs in the flow, allowing metadata to be added for easier querying of results from a database.
This function does not add metadata to the job themselves, only to the output generated upon job completion.
- Parameters:
flow (Flow) – The jobflow Flow object to modify.
additional_fields (dict) – Dictionary containing metadata fields and their values to add to task documents.
class_filter (type[Maker]) – The Maker class type to which additional metadata should be added. Only jobs created by this Maker type will be modified.
- Returns:
The modified flow with added metadata in the task documents.
- Return type:
Flow
Examples
>>> from atomate2.vasp.flows.core import RelaxBandStructureMaker >>> flow = RelaxBandStructureMaker().make(structure) >>> metadata = {"project": "battery_materials", "version": "2.0"} >>> flow = add_metadata_to_flow(flow, metadata, RelaxBandStructureMaker)