Skip to content

Commit

Permalink
fixes for running through basics section (#236)
Browse files Browse the repository at this point in the history
* fixes for running through basics- verdi cli section
* add comment on file downloading
* move code/computer commands to "running"
* fix wrong label
* Update docs/pages/2020_Intro_Week/sections/basics.rst

Co-authored-by: Sebastiaan Huber <[email protected]>
  • Loading branch information
ltalirz and sphuber authored Jul 1, 2020
1 parent 176ced1 commit 25e8df3
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 75 deletions.
4 changes: 2 additions & 2 deletions docs/pages/2019_MARVEL_Psik_MaX/sections/verdi_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ the command itself:
!some bash command
.. _2020_virtual_loadnode:
.. _2019_EPFL_loadnode:

Loading a node
--------------
Expand Down Expand Up @@ -298,7 +298,7 @@ In that case two duplicate structures are found for 'Si'.
Accessing inputs and outputs
----------------------------

Load again the calculation node used in Section :ref:`2020_virtual_loadnode`:
Load again the calculation node used in Section :ref:`2019_EPFL_loadnode`:

.. code:: python
Expand Down
109 changes: 41 additions & 68 deletions docs/pages/2020_Intro_Week/sections/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ From now on, all ``verdi`` commands will apply to the ``quicksetup`` profile.
To quickly perform a single command on a profile that is not the default, use the ``-p/--profile`` option:
For example, ``verdi -p generic code list`` will display the codes for the ``generic`` profile, despite it not being the current default profile.

.. _2020_virtual_importing_data:

Importing data
--------------
Expand All @@ -90,7 +91,7 @@ Let's import one from the web:

.. code:: bash
verdi import https://object.cscs.ch/v1/AUTH_b1d80408b3d340db9f03d373bbde5c1e/marvel-vms/tutorials/aiida_tutorial_2019_05_perovskites_v0.3.aiida
verdi import https://object.cscs.ch/v1/AUTH_b1d80408b3d340db9f03d373bbde5c1e/marvel-vms/tutorials/aiida_tutorial_2020_07_perovskites_v0.9.aiida
Contrary to most databases, AiiDA databases contain not only *results* of calculations but also their inputs and information on how a particular result was obtained.
This information, the *data provenance*, is stored in the form of a *directed acyclic graph* (DAG).
Expand Down Expand Up @@ -151,7 +152,13 @@ To do so, if you are using Linux/Mac OS X, you can type in your *local* machine:
scp aiidatutorial:<path_with_the_graph_pdf> <local_folder>
and then open the file.
Alternatively, you can use graphical software to achieve the same, for instance: on Windows: WinSCP; on a Mac: Cyberduck; on Linux Ubuntu: using the 'Connect to server' option in the main menu after clicking on the desktop.

.. note::

You can also use the ``jupyter notebook`` setup explained :ref:`here <2020_virtual_intro:setup:jupyter>` to download files.
Note that while Firefox will display the PDF directly in the browser `Chrome and Safari block viewing PDFs from jupyter notebook servers <https://stackoverflow.com/a/55264795/1069467>`_ - with these browsers, you will need to tick the checkbox next to the PDF and download the file.

Alternatively, you can use graphical software to achieve the same, for instance: on Windows: WinSCP; on a Mac: Cyberduck; on Linux Ubuntu: using the 'Connect to server' option in the main menu after clicking on the desktop.


The provenance browser
Expand Down Expand Up @@ -292,39 +299,39 @@ Producing the output:

.. code:: bash
Property Value
------------- ------------------------------------
type CalcJobNode
pk 828
uuid ce81c420-7751-48f6-af8e-eb7c6a30cec3
Property Value
----------- ------------------------------------
type PwCalculation
state Finished [0]
pk 630
uuid ce81c420-7751-48f6-af8e-eb7c6a30cec3
label
description
ctime 2014-10-27 17:51:21.781045+00:00
mtime 2019-05-09 14:10:09.307986+00:00
process state Finished
exit status 0
computer [1] daint
ctime 2014-10-27 17:51:21.781045+00:00
mtime 2019-05-09 14:10:09.307986+00:00
computer [1] daint
Inputs PK Type
---------- ---- -------------
pseudos
Ba 611 UpfData
O 661 UpfData
Ti 989 UpfData
code 825 Code
kpoints 811 KpointsData
parameters 829 Dict
settings 813 Dict
structure 27 StructureData
Ba 1092 UpfData
O 1488 UpfData
Ti 1855 UpfData
code 631 Code
kpoints 498 KpointsData
parameters 629 Dict
settings 500 Dict
structure 1133 StructureData
Outputs PK Type
----------------------- ---- -------------
output_kpoints 1894 KpointsData
output_parameters 62 Dict
output_structure 61 StructureData
output_trajectory_array 63 ArrayData
remote_folder 357 RemoteData
retrieved 60 FolderData
output_kpoints 1455 KpointsData
output_parameters 789 Dict
output_structure 788 StructureData
output_trajectory_array 790 ArrayData
remote_folder 1811 RemoteData
retrieved 787 FolderData
You can use the PKs shown for the inputs and outputs to get more information about those nodes.

Expand Down Expand Up @@ -408,41 +415,6 @@ Then, you can then copy ``<IDENTIFIER>.xsf`` from the Amazon machine to your loc
xcrysden --xsf <IDENTIFIER>.xsf
Codes and computers
~~~~~~~~~~~~~~~~~~~

Let us focus now on the nodes of type ``Code``.
A code represents (in the database) the actual executable used to run the calculation.
Find the identifier of such a node in the graph (e.g. the input code of the calculation you were inspecting earlier) and type:

.. code:: bash
verdi code show <IDENTIFIER>
The command prints information on the plugin used to interface the code to AiiDA, the remote machine on which the code is executed, the path of its executable, etc.
To show a list of all available codes type:

.. code:: bash
verdi code list
If you want to show all codes, including hidden ones and those created by other users, use ``verdi code list -a -A``.
Now, among the entries of the output you should also find the code just shown.

Similarly, the list of computers on which AiiDA can submit calculations is accessible by means of the command:

.. code:: bash
verdi computer list -a
The ``-a`` flag shows all computers, also the one imported in your database but that you did not configure, i.e. to which you don't have access.
Details about each computer can be obtained by the command:

.. code:: bash
verdi computer show <COMPUTERNAME>
Now you have the tools to answer the question: what is the scheduler installed on the computer where the calculations of the graph have run?
Calculation results
~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -598,20 +570,20 @@ the command itself:
!verdi process list
.. _loadnode:
.. _2020_virtual_loadnode:

Loading a node
--------------

Most AiiDA objects are represented by nodes, identified in the database by its
``PK`` (an integer). You can access a node using the following command
*PK* (an integer). You can access a node using the following command
in the shell:

.. code:: python
node = load_node(PK)
Load a node using the ``PK`` of one of the calculations visible in the graph you displayed in the previous section of the tutorial.
Load a node using the *PK* of one of the calculations visible in the graph you displayed in the previous section of the tutorial.
Then get the energy of the calculation with the command:

.. code:: python
Expand All @@ -632,12 +604,12 @@ Loading specific kinds of nodes
Pseudopotentials
~~~~~~~~~~~~~~~~

From the graph you generated in section :ref:`2020_virtual_aiidagraph`, find the ``PK`` of the pseudopotential file (LDA).
From the graph you generated in section :ref:`2020_virtual_aiidagraph`, find the UUID of the pseudopotential file (LDA).
Load it and show what elements it corresponds to by typing:

.. code:: python
upf = load_node(PK)
upf = load_node('<UUID>')
upf.element
All methods of ``UpfData`` are accessible by typing ``upf.`` and then pressing ``TAB``.
Expand All @@ -650,6 +622,7 @@ Choose one from the graph of produced in section :ref:`2020_virtual_aiidagraph`,

.. code:: python
kpoints = load_node("<UUID>")
kpoints.get_kpoints_mesh()
Then get the full (explicit) list of k-points belonging to this mesh using
Expand Down Expand Up @@ -694,12 +667,12 @@ Parameters
~~~~~~~~~~

Dictionaries with various parameters are represented in AiiDA by ``Dict`` nodes.
Get the PK and load the input parameters of a calculation in the graph produced in section :ref:`2020_virtual_aiidagraph`.
Get the UUID and load the input parameters of a calculation in the graph produced in section :ref:`2020_virtual_aiidagraph`.
Then display its content by typing

.. code:: python
params = load_node('<IDENTIFIER>')
params = load_node('<UUID>')
YOUR_DICT = params.get_dict()
YOUR_DICT
Expand Down
8 changes: 8 additions & 0 deletions docs/pages/2020_Intro_Week/sections/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Your ``localhost`` computer should now show up in
verdi computer list
.. note::

AiiDA export archives like the one we imported :ref:`in the very beginning <2020_virtual_importing_data>` can also contain computers set up by other AiiDA users (without the private *configuration* information).
Use ``verdi computer list -a`` to list both configured and unconfigured computers.

Before proceeding, test that it works:

.. code:: bash
Expand Down Expand Up @@ -101,6 +106,9 @@ You can always check the configuration details of an existing code using:
The ``generic`` profile has already a number of other codes configured.
See ``verdi -p generic code list``.

In order to also show codes created by other users (e.g. from imported archives), use ``verdi code list -A``.



The AiiDA daemon
================
Expand Down
17 changes: 12 additions & 5 deletions docs/pages/2020_Intro_Week/sections/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,18 @@ Troubleshooting
virtual environment with ``workon aiida`` before launching ``python``,
``ipython`` or the ``jupyter`` notebook server.

- If, while connecting to your VM, you get a warning similar to::

bind [127.0.0.1]:8888: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 8888

your local port 8888 is already occupied - likely because you are running a ``jupyter notebook`` server locally.
We suggest you stop any locally running jupyter notebook servers before connecting to the VM.
If necessary, you can start them again *after* you have connected (``jupyter notebook`` will then realize that port 8888 is already taken and simply serve the notebook on a different port).

- If your browser cannot connect to the jupyter notebook server, check that
you have correctly configured SSH tunneling/forwarding as described
above.
Keep in mind that you need to start the jupyter server from the
terminal connected to the VM, while the web browser should be opened locally
on your laptop.
you have configured SSH tunneling/forwarding as described above.
Keep in mind that you need to start the jupyter server from the terminal connected to the VM, while opening the web browser locally on your laptop.


- See the `jupyter notebook documentation <https://jupyter-notebook.readthedocs.io/en/stable/notebook.html#browser-compatibility>`_ for compatibility of jupyter with various web browsers.

0 comments on commit 25e8df3

Please sign in to comment.