Skip to content

Commit

Permalink
AiiDA tutorial at ISSP Univ. Tokyo, Japan (#195)
Browse files Browse the repository at this point in the history
* Add pages of ISSP Univ. Tokyo
  • Loading branch information
atztogo authored and ltalirz committed Dec 4, 2019
1 parent eae8ce8 commit b5a8d54
Show file tree
Hide file tree
Showing 59 changed files with 12,194 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Where to start
---------------------

- short demo: the :ref:`Ljubljana 2019 tutorial <Ljubljana 2019 Homepage>`.
- in-depth tutorial: the :ref:`EPFL 2019 tutorial <EPFL 2019 Homepage>`, including `lecture videos <https://www.youtube.com/playlist?list=PL19kfLn4sO_-QtPaHAA8KByFluT2vvlG0>`_
- in-depth tutorial: the :ref:`EPFL 2019 tutorial <EPFL 2019 Homepage>`, including `lecture videos <https://www.youtube.com/playlist?list=PL19kfLn4sO_-QtPaHAA8KByFluT2vvlG0>`_
- `AiiDA cheatsheet <https://github.com/aiidateam/aiida-tutorials/raw/master/docs/pages/2019_MARVEL_Psik_MaX/cheatsheet/cheatsheet.pdf>`_ with class hierarchy and common commands


Expand All @@ -30,6 +30,7 @@ links inside the respective sections.
:maxdepth: 1
:caption: Tutorial materials

2019, ISSP University of Tokyo, Chiba, Japan (aiida-core 1.0.0b6)<./pages/2019_ISSP_Chiba_Japan/index>
2019, IIT Mandi, Mandi, India (aiida-core 1.0.0b6)<./pages/2019_IIT_Mandi_India/index>
2019, SINTEF, Oslo, Norway (aiida-core 1.0.0b6)<./pages/2019_SINTEF/index>
2019, Jožef Stefan Institute, Ljubljana, Slovenia (aiida-core 1.0.0b6)<./pages/2019_Ljubljana/index>
Expand Down
89 changes: 89 additions & 0 deletions docs/pages/2019_ISSP_Chiba_Japan/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.. _Chiba 2019 Homepage:

2019, ISSP University of Tokyo, Chiba, Japan
=============================================

+-----------------+--------------------------------------------------------------------------------+
| Related resources |
+=================+================================================================================+
| Virtual Machine | `Quantum Mobile 19.09.0`_ |
+-----------------+--------------------------------------------------------------------------------+
| python packages | `aiida-core 1.0.0b6`_, `aiida-quantumespresso 3.0.0a5`_, `aiidalab 19.08.0a1`_ |
+-----------------+--------------------------------------------------------------------------------+
| codes | `Quantum Espresso 6.4.1`_ |
+-----------------+--------------------------------------------------------------------------------+

.. _Quantum Mobile 19.09.0: https://github.com/marvel-nccr/quantum-mobile/releases/tag/19.09.0
.. _aiida-core 1.0.0b6: https://pypi.org/project/aiida-core/1.0.0b6
.. _aiida-quantumespresso 3.0.0a5: https://pypi.org/project/aiida-quantumespresso/3.0.0a5
.. _aiidalab 19.08.0a1: https://pypi.org/project/aiidalab/19.8.0a1
.. _Quantum Espresso 6.4.1: https://github.com/QEF/q-e/releases/tag/qe-6.4.1

These are the hands-on materials from the 2-day AiiDA tutorial
|tutorial_name| from December 19-20, 2019.

Participants of the tutorial use the Quantum Mobile VirtualBox image
linked above or from `this mirror
<http://phonondb.mtl.kyoto-u.ac.jp/quantum_mobile_19.09.0.ova>`_ on
their own computer. The image already contains all the required
software.

Getting started
---------------

.. toctree::
:maxdepth: 1
:numbered:

./sections/setup
./sections/first_taste

Sections
--------

.. toctree::
:maxdepth: 1
:numbered:

./sections/verdi_cmdline
./sections/verdi_shell
./sections/calculations
./sections/querybuilder
./sections/workflows

Appendices
----------

.. toctree::
:maxdepth: 1
:numbered:

./sections/appendix_computer_code_setup
./sections/appendix_structure_data
./sections/appendix_upf_data
./sections/appendix_input_validation
./sections/appendix_restarting_calculations
./sections/appendix_queries
./sections/appendix_workflow_logic

Acknowledgements
----------------

The |tutorial_name| was made possible by support from ISSP
Univ. Tokyo, MARVEL, and kindly hosted by ISSP Univ. Tokyo.

.. image:: sponsors/issplogo_en.jpg
:target: http://www.issp.u-tokyo.ac.jp/index_en.html
:width: 120px

.. image:: sponsors/marvel.png
:target: http://nccr-marvel.ch
:width: 105px

.. image:: sponsors/epfl.png
:target: https://epfl.ch
:width: 105px

.. |tutorial_name| raw:: html

<a href="https://atztogo.github.io/AiiDA-tutorial-ISSP/" target="_blank">Workshop on Writing reproducible workflows for computational materials science using AiiDA</a>
221 changes: 221 additions & 0 deletions docs/pages/2019_ISSP_Chiba_Japan/notebooks/bandstructure.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A real world workchain example: electronic band structure"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"*Import statements - make sure to execute the cell below this one (it may be hidden)*"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": false
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%aiida\n",
"\n",
"from datetime import datetime, timedelta\n",
"\n",
"from aiida.tools.dbimporters.plugins.cod import CodDbImporter\n",
"from aiida.engine import launch\n",
"\n",
"PwBandStructureWorkChain = WorkflowFactory('quantumespresso.pw.band_structure')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Calculating the electronic band structure with an AiiDA workchain\n",
"This tutorial will show how useful a workchain can be in performing a well defined task, such as computing and visualizing the electronic band structure for a simple crystal structure. The goal of this tutorial is not to show you the intricacies of the actual workchain itself, but rather to serve as an example that workchains can simplify standard workflows in computational materials science. The workchain that we will use here will employ Quantum Espresso's pw.x code to calculate the charge densities for several crystal structures and compute a band structure from those. Many choices that normally face the researcher before being able to perform this calculation, such as the selection of suitable pseudo potentials, energy cutoff values, k-point grids and k-point paths along high symmetry points, are now performed automatically by the workchain. All that remains for the user to do is to simply define a structure, pass it to the workchain and sit back!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Below, we import the crystal structure of Al as an example, and run the PwBandStructureWorkChain for that structure. The estimated run time is noted in a comment in the calculation cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Loading the COD importer so we can directly import structure from COD id's\n",
"importer = CodDbImporter()\n",
"# Make sure here to define the correct codename that corresponds to the pw.x code installed on your machine of choice\n",
"codename = 'qe-6.4.1-pw@localhost'\n",
"code = Code.get_from_string(codename)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Importing example crystal structures from COD to AiiDA structure objects"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Al COD ID='9008460'\n",
"structure_Al = importer.query(id='9008460')[0].get_aiida_structure()\n",
"\n",
"structure_Al.get_formula()\n",
"\n",
"# The following structure can be used instead of Al, but will take much longer on the AWS machine.\n",
"# CaF2 COD ID='1000043' -- approximately 1/2 hour to run\n",
"# h-BN COD ID='9008997' -- approximately 45 mins to run\n",
"# GaAs COD ID='9008845' -- approximately 2 hours to run "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Now we run the bandstructure workchain for the selected structures"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The bandstructure workchain follows the following protocol:\n",
"* Determine the primitive cell of the input structure\n",
"* Run a vc-relax to relax the structure\n",
"* Refine the symmetry of the relaxed structure to ensure the primitive cell is used and run a self-consistent field calculation on it\n",
"* Run a non self-consistent field band structure calculation along a path of high symmetry k-points determined by [seekpath](http://materialscloud.org/tools/seekpath)\n",
"\n",
"Numerical parameters for the default 'theos-ht-1.0' protocol are determined as follows: \n",
"* Suitable pseudopotentials and energy cutoffs are automatically searched from the [SSSP library](http://materialscloud.org/sssp) installed on your machine (it uses the efficiency version 1.1).\n",
"* K-point mesh is selected to have a minimum k-point density of 0.2 Å<sup>-1</sup>\n",
"* A Marzari-Vanderbilt smearing of 0.02 Ry is used for the electronic occupations\n",
"\n",
"In case the pseudopotentials are not installed, they can be downloaded in a terminal as:\n",
"\n",
" wget https://archive.materialscloud.org/file/2018.0001/v3/SSSP_efficiency_pseudos.tar.gz\n",
" tar -zxvf SSSP_efficiency_pseudos.tar.gz\n",
" \n",
"The protocol looks for a UPF file with a specific hash code, that is unique for each different file. \n",
"You can check that you have the right\n",
"one by performing a search in the database:\n",
"\n",
" qb=QueryBuilder()\n",
" qb.append(UpfData, filters={'attributes.md5':{'==':'cfc449ca30b5f3223ec38ddd88ac046d'}})\n",
" len(qb.all())\n",
"\n",
"'md5' is a searchable attribute of the pseudopotential data object."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# This will take approximately 6 minutes on the tutorial AWS (for Al)\n",
"results = launch.run(\n",
" PwBandStructureWorkChain,\n",
" code=code,\n",
" structure=structure_Al\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fermi_energy = results['scf_parameters'].dict.fermi_energy\n",
"results['band_structure'].show_mpl(y_origin=fermi_energy, plot_zero_axis=True)\n",
"\n",
"print(\"\"\"Final crystal symmetry: {spacegroup_international} (number {spacegroup_number})\n",
"Extended Bravais lattice symbol: {bravais_lattice_extended}\n",
"The system has inversion symmetry: {has_inversion_symmetry}\"\"\".format(\n",
" **results['seekpath_parameters'].get_dict()))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you want to use a different pseudopotential family (or version of the family) (for instance [SSSP v1.0](https://archive.materialscloud.org/file/2018.0001/v1/SSSP_efficiency_pseudos.tar.gz) instead of the default SSSP v1.1) you can pass an additional parameter when calling the WorkChain, as follows:\n",
" \n",
" protocol = Dict(dict={\n",
" 'name':'theos-ht-1.0', \n",
" 'modifiers': {\n",
" 'pseudo' : 'SSSP-efficiency-1.0'\n",
" }\n",
" })\n",
"\n",
"(note that only some values are accepted for pseudo, that you can find [here](https://github.com/aiidateam/aiida-quantumespresso/blob/b02250146576eb573ccb45d05047075f54853f9d/aiida_quantumespresso/utils/protocols/pw.py#L24))."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# This will take approximately 6 minutes on the tutorial AWS (for Al)\n",
"results = launch.run(\n",
" PwBandStructureWorkChain,\n",
" code=code,\n",
" structure=structure_Al,\n",
" protocol=Dict(dict={\n",
" 'name':'theos-ht-1.0',\n",
" 'modifiers': {\n",
" 'pseudo':'SSSP-efficiency-1.0'\n",
" }\n",
" })\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit b5a8d54

Please sign in to comment.