File to be executed by IPython in order to register the line magic %aiida

This file can be put into the startup folder in order to have the line magic available at startup. The start up folder is usually at .ipython/profile_default/startup/

An IPython extension that provides a magic command to load basic aiida commands.

This makes it much easier to start.

Produces output in:

  • Plaintext (IPython [qt]console)

  • HTML (IPython notebook, nbconvert --to html, --to slides)

  • JSON (IPython notebook .ipynb files)

  • LaTeX (e.g. ipython nbconvert example.ipynb --to LaTeX --post PDF)

Notes on how to load it at start:


In [1]: %load_ext aiida_magic

In [2]: %aiida
class**kwargs: Any)[source]#

Bases: IPython.core.magic.Magics

AiiDA magic loader.

__module__ = ''#
_all_trait_default_generators: Dict[str, Any] = {'config': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'parent': <bound method TraitType.default of <traitlets.traitlets.Instance object>>}#
_cross_validation_lock: bool#
_descriptors = [<traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Instance object>]#
_instance_inits = [<bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>]#

Output in HTML format.


Output in JSON format.


Output in LaTeX format.

_repr_pretty_(pretty_print, cycle)[source]#

Output in text format.

_static_immutable_initial_values: Dict[str, Any] = {'parent': None}#
_trait_default_generators = {}#
_trait_notifiers: Dict[str, Any]#
_trait_validators: Dict[str, Any]#
_trait_values: Dict[str, Any]#
_traits: Dict[str, Any] = {'config': <traitlets.traitlets.Instance object>, 'parent': <traitlets.traitlets.Instance object>}#
aiida(line='', local_ns=None)[source]#

Load AiiDA in ipython (checking if it was already loaded), and inserts in the namespace the main AiiDA classes (the same that are loaded in verdi shell.


%aiida [optional parameters]
magics = {'cell': {}, 'line': {'aiida': 'aiida', 'verdi': 'verdi'}}#
registered = True#
verdi(line='', local_ns=None)[source]#

Run the AiiDA command line tool, using the currently loaded configuration and profile., name, obj)[source]#

Add a new variable with name name and value obj to the namespace local_ns, optionally showing a warning if we are hiding an existing variable.


# assuming that local_ns is a dictionary, e.g. from locals()
import sys
add_to_ns(local_ns, 'sys', sys)[source]#

Registers the %aiida IPython extension.

Deprecated since version v3.0.0: Use register_ipython_extension() instead.[source]#

Registers the %aiida IPython extension.

The %aiida IPython extension provides the same environment as the verdi shell.


ipython – InteractiveShell instance. If omitted, the global InteractiveShell is used.