NEB implementation in Aiida WOrkgraph for QE

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

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.

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.

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:

$ 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: