AiiDA Tutorial Section - "Unstored" Issue

12 views
Skip to first unread message

Oytun CİBAROĞLU

unread,
Jun 19, 2021, 1:39:00 PM6/19/21
to aiidausers
Hi all;

I have a question about tutorials.

I'm new on AiiDA. After I run AiiDA via Quantum Mobile and downloaded all updates&upgrades, I have tried Tutorials section.

In the Data Node field, I've applied below commands;

"In [1]: from aiida.engine import calcfunction

In [2]: def multiply(x,y):
    ...: return x * y
    ...:

In [3]: x = load_node(pk=187) """at first try, pk was given as 187"""

In [4]: y = Int(3)

In [5]: multiply(x,y)

Out[5]: <Int: uuid: 394ccf0d-1a7a-4268-8811-1a6a4ab57574 (unstored) value: 3>"

As you see, the new variable is "unstored". 

But, this link states: "However, we can use a Python decorator provided by AiiDA to automatically make it part of the provenance graph" -- that means it should be stored such as """[Int: uuid: 394ccf0d-1a7a-4268-8811-1a6a4ab57574 (250) value: 3]""" bu no chance.

Then I checked and installed the aforementioned "decorator" with the command "sudo apt-get install -y python3-decorator". 

Then, after reboot, when I try again the function, the new (third) variance still not saved to the database as "stored".

Where did i do wrong? Does anybody know how I fix it?

Thanks.

Best Regards.

Sebastiaan Huber

unread,
Jun 21, 2021, 3:08:00 AM6/21/21
to aiida...@googlegroups.com
Dear Yasal,

I am not sure which tutorial you are following exactly, but this section of this tutorial is similar to what you are describing: https://aiida-tutorials.readthedocs.io/en/latest/pages/2020_Intro_Week/sections/basics.html#calculation-functions
As you can see there, you don't need to install any Python package to get decorators, they are built in to the language.
What is important here is that you need a specific decorator provided by AiiDA, called the `calcfunction` decorator.
As the snippet shows

from aiida.engine import calcfunction
@calcfunction
def multiply(x, y):
    return x * y

You can import it from the `aiida.engine` module and decorate your `multiply` function with it.
Now if you run the function again, the resulting node should be stored.

Hope that helps,

SPH
Yasal Uyarı

--
AiiDA is supported by the NCCR MARVEL (http://nccr-marvel.ch/), funded by the Swiss National Science Foundation, and by the European H2020 MaX Centre of Excellence (http://www.max-centre.eu/).
 
Before posting your first question, please see the posting guidelines at http://www.aiida.net/?page_id=356 .
---
You received this message because you are subscribed to the Google Groups "aiidausers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aiidausers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/141ef81b-d61d-4622-933d-a50dba97b8c1n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages