# NEB implementation in Aiida WOrkgraph for QE

**URL:** <https://aiida.discourse.group/t/neb-implementation-in-aiida-workgraph-for-qe/535>\
**Category:** General Usage\
**Tags:** question, aiida, plugin\
**Created:** [January 31, 2025, 2:34pm UTC](https://aiida.discourse.group/t/neb-implementation-in-aiida-workgraph-for-qe/535 "2025-01-31T14:34:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrea](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Andrea](https://aiida.discourse.group/u/Andrea)\
**Post date:** [January 31, 2025, 2:34pm UTC](https://aiida.discourse.group/t/neb-implementation-in-aiida-workgraph-for-qe/535/1 "2025-01-31T14:34:59Z")

</div>

Hi everyone,

I have recently started to adopt Aiida in my research and so far i am blasted by its many functionalities. Kudos for the great work!  
Currently i am using the workgraph logic paired within the Quantum Espresso plugin. So far my workflow runs smoothly on tens of cases and i am able to retrive the required results easily. I would now like to extend it by adding some NEB calculations to the relaxed structured. However it seems that i can store results only as Dictonaries and not Structures (which will be taken as input for some NEB calculations). Now my question is, do i have to convert my workgraph to a classic PW\_relax\_Workchain/PW\_base\_Workchain or is there any workaround to produce structure nodes as workgraph outputs? Or am i simply just missing something?

Thanks in advance for the clarification

---

<div class="post-metadata">

**Author:** ![Xing](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/xing/32/10_2.png) [@Xing](https://aiida.discourse.group/u/Xing)\
**Post date:** [January 31, 2025, 4:10pm UTC](https://aiida.discourse.group/t/neb-implementation-in-aiida-workgraph-for-qe/535/2 "2025-01-31T16:10:30Z")

</div>

Are you using a `calcfunction`? Could you share the code that stores the results? As far as I know, WorkGraph does not impose any constraints on the format of the results. It is built on top of AiiDA’s core components, which require inputs and outputs to be AiiDA nodes. This means that if the code does not work within WorkGraph, it is likely to encounter the same issue in a WorkChain. Sharing your implementation might help identify the specific cause of the problem.

---

<div class="post-metadata">

**Author:** ![Andrea](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Andrea](https://aiida.discourse.group/u/Andrea)\
**Post date:** [February 3, 2025, 9:40am UTC](https://aiida.discourse.group/t/neb-implementation-in-aiida-workgraph-for-qe/535/3 "2025-02-03T09:40:09Z")

</div>

Hi Xing,  
Thanks for the prompt reply. I will past some relevant part of the code below. We are actually using the workgraph to orchestrate multiple PwCalculation tasks, each one is a relax. However we only ever see an output\_structure placeholder (type `SocketAny`) instead of the actual StructureData for such relax jobs.  
When i try to retrive the final relaxed structure to pass it for the NEBs i try something like this:

# [.. code creating tasks like `pw_ads_task = wg.add_task(PwCalculation, name=ads_task_name)` ..]

from aiida\_quantumespresso.calculations.neb import NebCalculation

neb\_task = wg.add\_task(NebCalculation, name=neb\_task\_name)  
neb\_inputs = {  
‘initial\_structure’: pw\_ads\_task.outputs.output\_structure, # fails: “SocketAny”

# [.. rest of code ..]

wg.submit(wait=False)

I was expecting that `"calculation": "relax"` in `PwCalculation` would yield a final geometry as `output_structure`, but it seems the default `PwCalculation` parser for `'relax'` does not store a final `StructureData`. Instead, the parser only provides an `output_parameters` `Dict` with energies and iteration data. In our `aiida_workgraph` environment, that results in the `'output_structure'` socket being a type `SocketAny` rather than a real `StructureData`.  
This then trigger the fact that our NEB logic can’t read a legitimate `StructureData`.

I’d prefer to keep using this simple “calcjob approach” if possible, but I haven’t found a direct way to make `PwCalculation` parse the final positions.

---

<div class="post-metadata">

**Author:** ![Xing](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/xing/32/10_2.png) [@Xing](https://aiida.discourse.group/u/Xing)\
**Post date:** [February 3, 2025, 12:15pm UTC](https://aiida.discourse.group/t/neb-implementation-in-aiida-workgraph-for-qe/535/4 "2025-02-03T12:15:01Z")

</div>

Thanks for sharing the codes and the details.

> default `PwCalculation` parser for `'relax'` does not store a final `StructureData`

If the calculation is finished successfully, it will have an `output_structure` output. Could you check if there is any non-zero exit code for your PwCalculation. You can see it in `verdi process show pk`.  
here is an example:

```auto
$ verdi process show 6903
Property Value
----------- ------------------------------------
type PwCalculation
state Finished [0] <<=============== here!

```

or even better, `verdi process report pk`, and share the report.

> In our `aiida_workgraph` environment, that results in the `'output_structure'` socket being a type `SocketAny` rather than a real `StructureData` .  
> This then trigger the fact that our NEB logic can’t read a legitimate `StructureData` .

The socket type is only used to check if two sockets can be connected, and it will not affect the usage of the node. For the moment, In my test, `SocketAny` is used for almost all the data type, but in the future, we may add socket type for each AiiDA data type.

In my test, I can link the output of the `relax_task` to the `neb_task`, as shown below:

 ![Screenshot from 2025-02-03 13-11-50](https://global.discourse-cdn.com/free1/uploads/aiida/original/1X/3c3e2531dfc7b4ca92cf688ad99b38b078eeeeb8.png)
