aiida-tutorials icon indicating copy to clipboard operation
aiida-tutorials copied to clipboard

Mention new feature of process functions accepting base Python types

Open sphuber opened this issue 2 years ago • 0 comments

AiiDA v2.1 added a feature where inputs of process functions are automatically serialized (https://github.com/aiidateam/aiida-core/pull/5688). See the docs. Essentially, what used to be written as:

from aiida.engine import calcfunction
from aiida.orm import Int

@calcfunction
def add(x, y):
    return x + y

add(Int(1), Int(2))

can now be written as

from aiida.engine import calcfunction

@calcfunction
def add(x, y):
    return x + y

add(1, 2)

We should update the tutorials to explain this. Probably still first show the original version, making it clear that the function is a process and requires inputs as nodes, but then showing that for base types, there is a shortcut.

sphuber avatar Oct 19 '22 08:10 sphuber