Skip to content

Commit

Permalink
Changing notebooks to Python 3 functionality (#105)
Browse files Browse the repository at this point in the history
* Changed Python 2 print statements into Python 3

* zip Function changed from Python 2 to Python 3.
  • Loading branch information
JRSuckert authored and ltalirz committed May 21, 2019
1 parent 44e1463 commit 9b12b84
Show file tree
Hide file tree
Showing 4 changed files with 956 additions and 37 deletions.
14 changes: 7 additions & 7 deletions docs/pages/2019_MARVEL_Psik_MaX/notebooks/bandstructure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@
"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",
"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())"
" **results['seekpath_parameters'].get_dict()))"
]
},
{
Expand All @@ -148,21 +148,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15rc1"
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"\n",
" # Sorting by formula:\n",
" sorted_results = sorted(results_dict.items())\n",
" formula_list = zip(*sorted_results)[0]\n",
" formula_list = next(zip(*sorted_results))\n",
" nr_of_results = len(formula_list)\n",
"\n",
" # Checks that I have not more than 3 pseudo families.\n",
Expand Down Expand Up @@ -318,7 +318,7 @@
"qb.append(StructureData)\n",
"qb.limit(5)\n",
"for structure, in qb.all():\n",
" print structure.get_formula()"
" print(structure.get_formula())"
]
},
{
Expand Down Expand Up @@ -353,7 +353,7 @@
"for class_name in class_list:\n",
" qb = QueryBuilder()\n",
" qb.append(class_name)\n",
" print '{:>15} | {:6}'.format(class_name.__name__, qb.count())\n"
" print('{:>15} | {:6}'.format(class_name.__name__, qb.count()))\n"
]
},
{
Expand Down Expand Up @@ -739,12 +739,13 @@
"metadata": {},
"source": [
"In this part of the tutorial, we will focus on how to systematically retrieve, query and analyze the results of\n",
"multiple calculations using AiiDA. We know you\u2019re able to do this yourself, but to save time, a set of calculations\n",
"multiple calculations using AiiDA. We know you’re able to do this yourself, but to save time, a set of calculations\n",
"have already been done with AiiDA for you on 57 perovskites, using three different pseudopotential families (LDA,\n",
"PBE and PBESOL, all from GBRV 1.2).\n\n",
"Note: if you are not following the tutorial on the official virtual machine that comes with this data, but you are working with your own database, you first have to import this archive (download it here: https://drive.google.com/open?id=1eqJaJr7q1VsYYvGxqHxmDN7gBMs534rz) using `verdi import`",
"\n\n",
"These calculations are spin-polarized (without spin-orbit coupling), use a Gaussian smearing and perform a variable-cell relaxation of the full unit cell. The idea of this part of the tutorial is to \u201cscreen\u201d for magnetic and metallic perovskites in a \u201chigh-throughput\u201d way. As you learned in the first part of the tutorial, AiiDA allows to organize calculations in groups. Once more check the list of groups in your database by typing:"
"PBE and PBESOL, all from GBRV 1.2).\n",
"\n",
"Note: if you are not following the tutorial on the official virtual machine that comes with this data, but you are working with your own database, you first have to import this archive (download it here: https://drive.google.com/open?id=1eqJaJr7q1VsYYvGxqHxmDN7gBMs534rz) using `verdi import`\n",
"\n",
"These calculations are spin-polarized (without spin-orbit coupling), use a Gaussian smearing and perform a variable-cell relaxation of the full unit cell. The idea of this part of the tutorial is to “screen” for magnetic and metallic perovskites in a “high-throughput” way. As you learned in the first part of the tutorial, AiiDA allows to organize calculations in groups. Once more check the list of groups in your database by typing:"
]
},
{
Expand Down Expand Up @@ -782,7 +783,7 @@
"# Appending the groups I care about:\n",
"qb.append(Group, filters={'label':{'like':'tutorial_%'}}, project='label', tag='group')\n",
"# Visualize:\n",
"print \"Groups:\", ', '.join([g for g, in qb.all()])\n",
"print(\"Groups:\", ', '.join([g for g, in qb.all()]))\n",
"generate_query_graph(qb.get_json_compatible_queryhelp(), 'query3.png')\n",
"Image(filename='query3.png')"
]
Expand Down Expand Up @@ -884,7 +885,7 @@
"source": [
"results = qb.all()\n",
"for item in results:\n",
" print ', '.join(map(str, item))"
" print(', '.join(map(str, item)))"
]
},
{
Expand All @@ -907,23 +908,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"\n",
" # Sorting by formula:\n",
" sorted_results = sorted(results_dict.items())\n",
" formula_list = zip(*sorted_results)[0]\n",
" formula_list = next(zip(*sorted_results))\n",
" nr_of_results = len(formula_list)\n",
"\n",
" # Checks that I have not more than 3 pseudo families.\n",
Expand Down Expand Up @@ -325,7 +325,7 @@
"qb.append(StructureData)\n",
"qb.limit(5)\n",
"for structure, in qb.all():\n",
" print structure.get_formula()"
" print(structure.get_formula())"
]
},
{
Expand Down Expand Up @@ -361,10 +361,10 @@
" qb = QueryBuilder()\n",
" qb.append(class_name)\n",
"#TUT_USER_START\n",
" print # Finish this line to print the results!\n",
" print() # Finish this line to print the results!\n",
"#TUT_USER_END\n",
"#TUT_SOLUTION_START\n",
" print '{:>15} | {:6}'.format(class_name.__name__, qb.count())\n",
" print('{:>15} | {:6}'.format(class_name.__name__, qb.count()))\n",
"#TUT_SOLUTION_END"
]
},
Expand Down Expand Up @@ -809,7 +809,7 @@
"# Appending the groups I care about:\n",
"qb.append(Group, filters={'label':{'like':'tutorial_%'}}, project='label', tag='group')\n",
"# Visualize:\n",
"print \"Groups:\", ', '.join([g for g, in qb.all()])\n",
"print(\"Groups:\", ', '.join([g for g, in qb.all()]))\n",
"generate_query_graph(qb.get_json_compatible_queryhelp(), 'query3.png')\n",
"Image(filename='query3.png')"
]
Expand Down Expand Up @@ -928,7 +928,7 @@
"source": [
"results = qb.all()\n",
"for item in results:\n",
" print ', '.join(map(str, item))"
" print(', '.join(map(str, item)))"
]
},
{
Expand All @@ -951,23 +951,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2.0
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
"nbformat_minor": 1
}
920 changes: 919 additions & 1 deletion docs/pages/2019_MARVEL_Psik_MaX/notebooks/querybuilder-tutorial.ipynb

Large diffs are not rendered by default.

0 comments on commit 9b12b84

Please sign in to comment.