---
# System prepended metadata

title: AiiDA-WorkTree
tags: [' aiida', worktree]

---


# Navigating the Workflow Landscape in AiiDA: Unlocking Flexibility with AiiDA-WorkTree

In the realm of AiiDA, workflows have been traditionally orchestrated using two chief components: [`workfunction`](https://aiida.readthedocs.io/projects/aiida-core/en/latest/topics/workflows/concepts.html#work-functions) and [`WorkChain`](https://aiida.readthedocs.io/projects/aiida-core/en/latest/topics/workflows/concepts.html#work-chains). Both these components come with their distinct attributes and limitations. The `workfunction` shines in simplicity but lacks automatic checkpointing, a crucial feature for long-running calculations. Conversely, `WorkChain` embodies resilience with automatic checkpointing but demands a more intricate implementation and lacks flexibility.

## Enter AiiDA-WorkTree: The Game-Changer

Addressing the gaps left by its predecessors, AiiDA-WorkTree introduces a new component: `WorkTree`. This feature simplifies implementation and embraces automatic checkpointing, all while maintaining a high degree of flexibility suitable for designing sophisticated workflows.

## Journey Through a Workflow: A Train Analogy

Imagine planning a train journey. Traditionally, using a WorkChain resembles creating a new train line for every unique journey. Traveling from Bern to Zurich? That's one line (ICE10). Heading from Zurich to Milano? That's another (ICE11). Combining journeys, say from Bern to Milano, would entail the creation of yet another train line (ICE12), despite the redundancy.

However, a more optimized approach exists. A WorkTree allows for a journey where one could travel from Bern to Zurich on ICE10 and then switch to ICE11 from Zurich to Milano. This method eliminates the need for creating a superfluous train line, optimizing resources and improving workflow efficiency.

## Unpacking the Benefits of WorkTree

#### Flexibility in Inputs

WorkChains typically require the aggregation of all input parameters at the commencement of the process. Using our train analogy, it is like boarding all passengers in Bern, irrespective of their actual starting point. AiiDA-WorkTree, however, allows for a more nuanced approach, enabling inputs to join at different stages of the workflow.

#### User-Developer Distinction:

The advent of WorkTree amplifies the distinction between the AiiDA users and developers. It allows developers to focus on creating foundational WorkChains, likened to establishing essential train routes. Users, on the other hand, can effortlessly utilize and connect these foundational elements to tailor workflows that cater to their specific needs, without delving deep into development.

## Conclusion: The AiiDA-WorkTree Vision

AiiDA-WorkTree does not seek to eclipse the existing workflow components like WorkChain, calcfunction, or calcjob. Instead, it envisions enriching the workflow ecosystem, enabling users to craft flexible, resilient, and user-specific workflows with ease. By doing so, AiiDA-WorkTree heralds a new era of workflow management, fostering creativity, efficiency, and precision in the AiiDA community.
