aiidateam / aiida-tutorials

AiiDA tutorials web site
http://aiida-tutorials.readthedocs.org
20 stars 37 forks source link

Mention new feature of process functions accepting base Python types #459

Open sphuber opened 1 year ago

sphuber commented 1 year ago

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.