Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tutorial.md on links about "entry point" and "plugin" #6095

Merged
merged 12 commits into from
Aug 19, 2023
9 changes: 7 additions & 2 deletions docs/source/intro/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,22 +501,26 @@ class MultiplyAddWorkChain(WorkChain):
```

:::{note}
Besides WorkChain's, workflows can also be implemented as *work functions*.
Besides WorkChain's, workflows can also be implemented as {ref}`work functions <topics:workflows:concepts:workfunctions>`.
These are ideal for workflows that are not very computationally intensive and can be easily implemented in a Python function.
:::

Let's run the `WorkChain` above!

Start up the `verdi shell` and load the `MultiplyAddWorkChain` using the `WorkflowFactory`:

```{code-cell} ipython3
from aiida import plugins
MultiplyAddWorkChain = plugins.WorkflowFactory('core.arithmetic.multiply_add')
```

The `WorkflowFactory` is a useful and robust tool for loading workflows based on their *entry point*, e.g. `'core.arithmetic.multiply_add'` in this case.
The `WorkflowFactory` loads workflows based on their {ref}`entry point <topics:plugins:entrypoints>`, e.g. `'core.arithmetic.multiply_add'` in this case.
The entry point mechanism allows AiiDA to automatically discover workflows provided by `aiida-core` and {ref}`AiiDA plugins <how-to:plugins-install>`, and display them to the user, e.g. via `verdi plugin list aiida.workflows`. Pass the entry point as an argument to display detailed information, e.g. via `verdi plugin list aiida.workflows core.arithmetic.multiply_add`.

Similar to a `CalcJob`, the `WorkChain` input can be set up using a builder:

```{code-cell} ipython3
from aiida import orm
builder = MultiplyAddWorkChain.get_builder()
builder.code = orm.load_code(label='add')
builder.x = orm.Int(2)
Expand All @@ -528,6 +532,7 @@ builder
Once the `WorkChain` input has been set up, we run it with the AiiDA engine:

```{code-cell} ipython3
from aiida import engine
engine.run(builder)
```

Expand Down