Skip to content

Commit

Permalink
CLI: add install --from-download for sssp and pseudo-dojo
Browse files Browse the repository at this point in the history
Our workaround for installing an "established" family like a `SsspFamily` or
`PseudoDojoFamily` required using the `install family` command, but this is
explicitly forbidden since we do not want the user to be able to install an
arbitrary set of pseudopotentials as one of these classes.

This means there is currently no way to install the archive and metadata
obtained with the `--download-only` option of the automated install commands as
a proper `SsspFamily` or `PseudoDojoFamily`.

Here, we add the `--from-download` option to the automated install commands to
allow the user to install the downloaded pseudopotentials and set the
recommended cutoffs automatically for an `SsspFamily` or `PseudoDojoFamily`.
The `--download-only` option now also produces a single `.aiida_pseudo` archive
that contains:

* The archive containing the pseudos
* The corresponding metadata
* The configuration in JSON format

The user can pass such an archive to the `--from-download` option to install the
corresponding pseudopotential family.
  • Loading branch information
mbercx authored Sep 8, 2023
1 parent 9c7740d commit ea1cca9
Show file tree
Hide file tree
Showing 6 changed files with 339 additions and 146 deletions.
9 changes: 7 additions & 2 deletions docs/source/howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ Similar to the `SSSP`_ pseudopotential family, the options can be used to set ve
Moreover, the format of the pseudopotentials can be specified, as well as the default stringency.
Use ``aiida-pseudo install pseudo-dojo --help`` for more information.

.. note::

In case you are unable to use these automated commands because of connection issues, please consult the :ref:`troubleshooting section <troubleshooting:automated-fail>`.

.. _how-to:install_archive:

Installing from archive or folder
=================================

In case the automated install commands fail, or the pseudopotential family you want to use is not supported, you can install the pseudopotential family manually with the following command:
In case the pseudopotential family you want to use is not supported, you can install the pseudopotential family manually with the following command:

.. code-block:: console
Expand All @@ -53,7 +57,7 @@ If this fails, you can specify the format manually with the ``--archive-format/-
$ aiida-pseudo install family <ARCHIVE> <LABEL> -f gztar
The valid archive formats are those [defined by the ``shutil.unpack_archive`` function](https://docs.python.org/3/library/shutil.html#shutil.unpack_archive) of the standard Python library.
The valid archive formats are those defined by the `shutil.unpack_archive <https://docs.python.org/3/library/shutil.html#shutil.unpack_archive>`_ function of the standard Python library.

Pseudopotential format
----------------------
Expand Down Expand Up @@ -93,6 +97,7 @@ The available pseudopotential family classes can be listed with the command:
.. important::

The ``pseudo.family.sssp`` and ``pseudo.family.pseudo_dojo`` family types are blacklisted since they have their own :ref:`dedicated install commands <how-to:install_automated>` in ``aiida-pseudo install sssp`` and ``aiida-pseudo install pseudo-dojo``, respectively.
In case you are unable to use these commands because of connection issues, please consult the :ref:`troubleshooting section <troubleshooting:automated-fail>`.

Adding recommended cutoffs
--------------------------
Expand Down
22 changes: 20 additions & 2 deletions docs/source/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,27 @@
Troubleshooting
###############

.. _troubleshooting:automated-fail:

The automated install commands fail
===================================

These failures are often due to unstable internet connections causing the download of the pseudopotential archive from the web to fail.
In this case, it is possible to install the family manually from an archive that is already available on the local file system.
You can read more on this in the :ref:`how-to section <how-to:install_archive>`.
In this case, it is possible to download an ``.aiida_pseudo`` archive of the established family on a machine with a stable internet connection, transfer it to the machine where the pseudopotentials need to be installed and install directly from the archive.
To download the archive, use the ``--download-only`` option:

.. code-block:: console
$ aiida-pseudo install sssp --download-only
Report: downloading patch versions information... [OK]
Report: downloading selected pseudopotentials archive... [OK]
Report: downloading selected pseudopotentials metadata... [OK]
Success: Pseudopotential archive written to: SSSP_1.1_PBE_efficiency.aiida_pseudo
The downloaded archive can be installed through the ``--from-download`` option of the corresponding install command:

.. code-block:: console
$ aiida-pseudo install sssp --from-download SSSP_1.1_PBE_efficiency.aiida_pseudo
Report: unpacking archive and parsing pseudos... [OK]
Success: installed `SSSP/1.1/PBE/efficiency` containing 85 pseudopotentials.
Loading

0 comments on commit ea1cca9

Please sign in to comment.