<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yambo-code.eu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alejandro</id>
	<title>The Yambo Project - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yambo-code.eu/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alejandro"/>
	<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Special:Contributions/Alejandro"/>
	<updated>2026-05-17T14:33:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5678</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5678"/>
		<updated>2022-04-04T16:04:05Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 1. BN (semiconductor). Band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px | center |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | center | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial the example of using the Classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py to check an example. Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy is used mainly to run Yambo and QE calculations. Nevertheless, there are classes to analyse the results of Yambo and deals with the database generated by Yambo. In the case of GW quasi-particle calculations we can use the class YamboQPDB to find the scissor operator, plot the GW bands and to interpolated the GW bands in a smoother k-path. The example runs by doing:&lt;br /&gt;
&lt;br /&gt;
 python plot-qp.py&lt;br /&gt;
&lt;br /&gt;
See below for an explanation of the tutorial. As usual, we can import the qepy and yambopy libraries:&lt;br /&gt;
&lt;br /&gt;
  from qepy import *&lt;br /&gt;
  from yambopy import *&lt;br /&gt;
  import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
We define the k-points path.&lt;br /&gt;
  npoints = 10&lt;br /&gt;
  path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
                [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
                [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&lt;br /&gt;
Importantly, the number of points is a free choice. We can increase the variable npoints as we wish, just the interpolation will take more time. In order to analyse GW results we need to have the file related to the basic data of our Yambo calculation (&#039;&#039;&#039;SAVE/ns.db1&#039;&#039;&#039;) and the netcdf file with the quasi-particle resutls (&#039;&#039;&#039;ndb.QP&#039;&#039;&#039;). We load the data calling the respective classes:&lt;br /&gt;
&lt;br /&gt;
 # Read Lattice information from SAVE&lt;br /&gt;
 lat  = YamboSaveDB.from_db_file(folder=&#039;SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
 # Read QP database&lt;br /&gt;
 ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;qp-gw&#039;)&lt;br /&gt;
&lt;br /&gt;
The first option is to plot and calculate the scissor operator. We need to select the index of the top valence band:&lt;br /&gt;
&lt;br /&gt;
 n_top_vb = 4&lt;br /&gt;
 ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&lt;br /&gt;
Yambopy displays the fitting and also the data of the slope of each fitting. Notice that this is also a test if the GW calculations are running well. &#039;&#039;&#039;If the dependence is not linear would be very rare and you should double-check your results!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
In this case the slope is:&lt;br /&gt;
&lt;br /&gt;
 valence bands:&lt;br /&gt;
 slope:     1.0515886598785766&lt;br /&gt;
 conduction bands:&lt;br /&gt;
 slope:     1.026524081134514&lt;br /&gt;
 scissor list (shift,c,v) [eV,adim,adim]: [1.8985204833551723, 1.026524081134514, 1.0515886598785766]&lt;br /&gt;
&lt;br /&gt;
In addition to the scissor operator, we can plot the GW (and DFT) band structure, in the path. The first choice would be to plot exact GW calculations, without interpolation, to check that the results are meaningfull (or not). This plot is independent of the number of k-points (&#039;&#039;&#039;npoints&#039;&#039;&#039;) that we want to plot in the interpolation. The class YamboQPDB finds the calculated points that belong to the path and plot them. Be aware that if we use coarse grids the class would not find any point and the function will not work.&lt;br /&gt;
&lt;br /&gt;
 ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
 ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
The interplation of the DFT and GW band structures has a similar aspect:&lt;br /&gt;
&lt;br /&gt;
 ks_bs, qp_bs = ydb.interpolate(lat,path,what=&#039;QP+KS&#039;,lpratio=20)&lt;br /&gt;
 ks_bs.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;lpratio&#039;&#039;&#039; can be increase if the interpolation does not work. The interpolation is the one implemented by abipy.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Finally, we can compare the calculated GW eigenvalues with the interpolation.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5677</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5677"/>
		<updated>2022-04-04T16:03:42Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial the example of using the Classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py to check an example. Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy is used mainly to run Yambo and QE calculations. Nevertheless, there are classes to analyse the results of Yambo and deals with the database generated by Yambo. In the case of GW quasi-particle calculations we can use the class YamboQPDB to find the scissor operator, plot the GW bands and to interpolated the GW bands in a smoother k-path. The example runs by doing:&lt;br /&gt;
&lt;br /&gt;
 python plot-qp.py&lt;br /&gt;
&lt;br /&gt;
See below for an explanation of the tutorial. As usual, we can import the qepy and yambopy libraries:&lt;br /&gt;
&lt;br /&gt;
  from qepy import *&lt;br /&gt;
  from yambopy import *&lt;br /&gt;
  import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
We define the k-points path.&lt;br /&gt;
  npoints = 10&lt;br /&gt;
  path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
                [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
                [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&lt;br /&gt;
Importantly, the number of points is a free choice. We can increase the variable npoints as we wish, just the interpolation will take more time. In order to analyse GW results we need to have the file related to the basic data of our Yambo calculation (&#039;&#039;&#039;SAVE/ns.db1&#039;&#039;&#039;) and the netcdf file with the quasi-particle resutls (&#039;&#039;&#039;ndb.QP&#039;&#039;&#039;). We load the data calling the respective classes:&lt;br /&gt;
&lt;br /&gt;
 # Read Lattice information from SAVE&lt;br /&gt;
 lat  = YamboSaveDB.from_db_file(folder=&#039;SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
 # Read QP database&lt;br /&gt;
 ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;qp-gw&#039;)&lt;br /&gt;
&lt;br /&gt;
The first option is to plot and calculate the scissor operator. We need to select the index of the top valence band:&lt;br /&gt;
&lt;br /&gt;
 n_top_vb = 4&lt;br /&gt;
 ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&lt;br /&gt;
Yambopy displays the fitting and also the data of the slope of each fitting. Notice that this is also a test if the GW calculations are running well. &#039;&#039;&#039;If the dependence is not linear would be very rare and you should double-check your results!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
In this case the slope is:&lt;br /&gt;
&lt;br /&gt;
 valence bands:&lt;br /&gt;
 slope:     1.0515886598785766&lt;br /&gt;
 conduction bands:&lt;br /&gt;
 slope:     1.026524081134514&lt;br /&gt;
 scissor list (shift,c,v) [eV,adim,adim]: [1.8985204833551723, 1.026524081134514, 1.0515886598785766]&lt;br /&gt;
&lt;br /&gt;
In addition to the scissor operator, we can plot the GW (and DFT) band structure, in the path. The first choice would be to plot exact GW calculations, without interpolation, to check that the results are meaningfull (or not). This plot is independent of the number of k-points (&#039;&#039;&#039;npoints&#039;&#039;&#039;) that we want to plot in the interpolation. The class YamboQPDB finds the calculated points that belong to the path and plot them. Be aware that if we use coarse grids the class would not find any point and the function will not work.&lt;br /&gt;
&lt;br /&gt;
 ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
 ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
The interplation of the DFT and GW band structures has a similar aspect:&lt;br /&gt;
&lt;br /&gt;
 ks_bs, qp_bs = ydb.interpolate(lat,path,what=&#039;QP+KS&#039;,lpratio=20)&lt;br /&gt;
 ks_bs.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;lpratio&#039;&#039;&#039; can be increase if the interpolation does not work. The interpolation is the one implemented by abipy.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Finally, we can compare the calculated GW eigenvalues with the interpolation.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5676</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5676"/>
		<updated>2022-04-04T16:01:04Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial the example of using the Classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py to check an example. Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy is used mainly to run Yambo and QE calculations. Nevertheless, there are classes to analyse the results of Yambo and deals with the database generated by Yambo. In the case of GW quasi-particle calculations we can use the class YamboQPDB to find the scissor operator, plot the GW bands and to interpolated the GW bands in a smoother k-path. The example runs by doing:&lt;br /&gt;
&lt;br /&gt;
 python plot-qp.py&lt;br /&gt;
&lt;br /&gt;
See below for an explanation of the tutorial. As usual, we can import the qepy and yambopy libraries:&lt;br /&gt;
&lt;br /&gt;
  from qepy import *&lt;br /&gt;
  from yambopy import *&lt;br /&gt;
  import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
We define the k-points path.&lt;br /&gt;
  npoints = 10&lt;br /&gt;
  path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
                [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
                [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&lt;br /&gt;
Importantly, the number of points is a free choice. We can increase the variable npoints as we wish, just the interpolation will take more time. In order to analyse GW results we need to have the file related to the basic data of our Yambo calculation (&#039;&#039;&#039;SAVE/ns.db1&#039;&#039;&#039;) and the netcdf file with the quasi-particle resutls (&#039;&#039;&#039;ndb.QP&#039;&#039;&#039;). We load the data calling the respective classes:&lt;br /&gt;
&lt;br /&gt;
 # Read Lattice information from SAVE&lt;br /&gt;
 lat  = YamboSaveDB.from_db_file(folder=&#039;SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
 # Read QP database&lt;br /&gt;
 ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;qp-gw&#039;)&lt;br /&gt;
&lt;br /&gt;
The first option is to plot and calculate the scissor operator. We need to select the index of the top valence band:&lt;br /&gt;
&lt;br /&gt;
 n_top_vb = 4&lt;br /&gt;
 ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&lt;br /&gt;
Yambopy displays the fitting and also the data of the slope of each fitting. Notice that this is also a test if the GW calculations are running well. &#039;&#039;&#039;If the dependence is not linear would be very rare and you should double-check your results!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
In this case the slope is:&lt;br /&gt;
&lt;br /&gt;
 valence bands:&lt;br /&gt;
 slope:     1.0515886598785766&lt;br /&gt;
 conduction bands:&lt;br /&gt;
 slope:     1.026524081134514&lt;br /&gt;
 scissor list (shift,c,v) [eV,adim,adim]: [1.8985204833551723, 1.026524081134514, 1.0515886598785766]&lt;br /&gt;
&lt;br /&gt;
In addition to the scissor operator, we can plot the GW (and DFT) band structure, in the path. The first choice would be to plot exact GW calculations, without interpolation, to check that the results are meaningfull (or not).&lt;br /&gt;
&lt;br /&gt;
 ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
 ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
The interplation of the DFT and GW band structures has a similar aspect:&lt;br /&gt;
&lt;br /&gt;
 ks_bs, qp_bs = ydb.interpolate(lat,path,what=&#039;QP+KS&#039;,lpratio=20)&lt;br /&gt;
 ks_bs.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
 qp_bs.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;lpratio&#039;&#039;&#039; can be increase if the interpolation does not work. The interpolation is the one implemented by abipy.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Finally&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5675</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5675"/>
		<updated>2022-04-04T15:53:30Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial the example of using the Classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py to check an example. Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy is used mainly to run Yambo and QE calculations. Nevertheless, there are classes to analyse the results of Yambo and deals with the database generated by Yambo. In the case of GW quasi-particle calculations we can use the class YamboQPDB to find the scissor operator, plot the GW bands and to interpolated the GW bands in a smoother k-path. As usual, we can import the qepy and yambopy libraries.&lt;br /&gt;
&lt;br /&gt;
  from qepy import *&lt;br /&gt;
  from yambopy import *&lt;br /&gt;
  import matplotlib.pyplot as plt&lt;br /&gt;
&lt;br /&gt;
We define the k-points path.&lt;br /&gt;
  npoints = 10&lt;br /&gt;
  path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
                [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
                [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&lt;br /&gt;
Importantly, the number of points is a free choice. We can increase the variable npoints as we wish, just the interpolation will take more time. In order to analyse GW results we need to have the file related to the basic data of our Yambo calculation (&#039;&#039;&#039;SAVE/ns.db1&#039;&#039;&#039;) and the netcdf file with the quasi-particle resutls (&#039;&#039;&#039;ndb.QP&#039;&#039;&#039;). We load the data calling the respective classes:&lt;br /&gt;
&lt;br /&gt;
 # Read Lattice information from SAVE&lt;br /&gt;
 lat  = YamboSaveDB.from_db_file(folder=&#039;SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
 # Read QP database&lt;br /&gt;
 ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;qp-gw&#039;)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5674</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5674"/>
		<updated>2022-04-04T15:45:03Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial the example of using the Classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py to check an example. Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
Yambopy is used mainly to run Yambo and QE calculations. Nevertheless, there are classes to analyse the results of Yambo and deals with the database generated by Yambo. In the case of GW quasi-particle calculations we can use the class YamboQPDB to find the scissor operator, plot the GW bands and to interpolated the GW bands in a smoother k-path.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5673</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5673"/>
		<updated>2022-04-04T15:42:14Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2. Iron. Ferromagnetic metalic material */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have included in the tutorial the example of using the Classes Tasks and Flows developed in yambopy. You can check the file flow-iron.py to check an example. Yambopy includes basic predefined workflows to run the common QE and Yambo calculations. In this case we are using the class &#039;&#039;&#039;PwBandsTasks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 python flow-iron.py&lt;br /&gt;
&lt;br /&gt;
In order to plot the spin-polarized bands. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5672</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5672"/>
		<updated>2022-04-04T15:38:30Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 1. BN (semiconductor). Band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below running the script:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
We can run now the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-orbitals.py&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial). The colormap can be represented in many ways and qepy does not include a particular function for this. An example is:&lt;br /&gt;
&lt;br /&gt;
 import matplotlib as mpl&lt;br /&gt;
 cmap=plt.get_cmap(&#039;viridis&#039;)&lt;br /&gt;
 bx  = fig.add_axes( [ 0.88, 0.10, 0.05, 0.80 ])&lt;br /&gt;
 norm = mpl.colors.Normalize(vmin=0.,vmax=1.)&lt;br /&gt;
 cb1 = mpl.colorbar.ColorbarBase(bx, cmap=cmap, norm=norm,orientation=&#039;vertical&#039;,ticks=[0,1])&lt;br /&gt;
 cb1.set_ticklabels([&#039;B&#039;, &#039;N&#039;])&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5671</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5671"/>
		<updated>2022-04-04T15:36:15Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2. Iron. Ferromagnetic metalic material */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. We have to run the file:&lt;br /&gt;
&lt;br /&gt;
 python plot-qe-bands.py&lt;br /&gt;
&lt;br /&gt;
The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
The analysis of the projected atomic orbitals is also implemented. In this case the results are more cumbersome because the projection is separated in spin up and down channels. In the case of representing the size as a function of the weight of the orbitals, we have represented exclusively the &#039;&#039;d&#039;&#039; orbitals:&lt;br /&gt;
&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,selected_orbitals=atom_d,color=&#039;red&#039;,color_2=&#039;blue&#039;)&lt;br /&gt;
&lt;br /&gt;
If we run the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-size.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
From the plot is clear that &#039;&#039;d&#039;&#039; orbitals are mainly localized around the Fermi energy.&lt;br /&gt;
&lt;br /&gt;
Another option is to plot the orbital composition as a colormap running the file:&lt;br /&gt;
&lt;br /&gt;
 plot-qe-orbitals-colormap.py&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we have added the p and d orbitals in the analysis:&lt;br /&gt;
&lt;br /&gt;
 atom_p = [0,1,2]&lt;br /&gt;
 atom_d = [3,4,5,6,7]&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,cmap2=&#039;rainbow&#039;,selected_orbitals=atom_p,selected_orbitals_2=atom_d)&lt;br /&gt;
&lt;br /&gt;
The colormap bar is added in the same way as in Tutorial 1 (see script).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5670</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5670"/>
		<updated>2022-04-04T15:25:13Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2. Iron. Ferromagnetic metalic material */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 600 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5669</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5669"/>
		<updated>2022-04-04T15:24:42Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2. Iron. Ferromagnetic metalic material */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue. In the case of iron we have selected this path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 1.0 ],&#039;H&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2.],&#039;N&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0 ],&#039;G&#039;],&lt;br /&gt;
                       [[1./2, 1./2, 1./2 ],&#039;P&#039;],&lt;br /&gt;
                       [[1./2,0.0,1./2. ],&#039;N&#039;]], [npoints,npoints,npoints,npoints,npoints])&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;pw&#039;,path=&#039;bands/t0&#039;)&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5668</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5668"/>
		<updated>2022-04-04T15:22:43Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2. Iron. Ferromagnetic metalic material==&lt;br /&gt;
&lt;br /&gt;
In the case of spin-polarized calculations we can plot the spin up and down band structures. The class PwXML automatically detects the spin polarized case (nspin=2 in QE input file). The spin up channel is displayed with red and the spin down channel with blue.&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5667</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5667"/>
		<updated>2022-04-04T15:14:54Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px | center |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5666</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5666"/>
		<updated>2022-04-04T15:14:21Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 1. BN (semiconductor). Band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
We have chosen the colormap &#039;viridis&#039; (variable cmap). We can also plot the bands varying the size. In this case we pass only the variable selected_orbitals (see next tutorial).&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5665</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5665"/>
		<updated>2022-04-04T15:02:05Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 1. BN (semiconductor). Band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
===Plot Band structure===&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
===Plot atomic orbital projected Band structure===&lt;br /&gt;
&lt;br /&gt;
In addition to the band structure, useful information regarding the atomic orbital nature of the electronic bands can be displayed using the class ProjwfcXML. Before we need to use the QE function projwfc.x to create the file &#039;&#039;&#039;atomic_proj.xml&#039;&#039;&#039;. The function projects wavefunctions onto orthogonalized atomic wavefunctions, among others functionalities. The orbital order is explained in the input documentation of the projwfc.x function (https://www.quantum-espresso.org/Doc/INPUT_PROJWFC.html#idm94). To run projwf.x we can use the class ProjwfcIn:&lt;br /&gt;
&lt;br /&gt;
 proj = ProjwfcIn(prefix=&#039;bn&#039;)&lt;br /&gt;
 proj.run(folder=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
Be aware that this can take a while in a large system with many k-points. As in the class PwXML, we define the path_kpoints and also the selected atomic orbitals to project our bands. We have chosen to represent the projection weight onto the boron and nitrogen orbitals&lt;br /&gt;
&lt;br /&gt;
 atom_1 = list(range(16))&lt;br /&gt;
 atom_2 = list(range(16,32)) &lt;br /&gt;
&lt;br /&gt;
The full list of orbitals is written in the file &#039;&#039;&#039;bands/prowfc.log&#039;&#039;&#039;. We have also defined the figure box&lt;br /&gt;
&lt;br /&gt;
 import matplotlib.pyplot as plt&lt;br /&gt;
 fig = plt.figure(figsize=(5,7))&lt;br /&gt;
 ax  = fig.add_axes( [ 0.12, 0.10, 0.70, 0.80 ])&lt;br /&gt;
&lt;br /&gt;
The colormap chosen is &#039;viridis&#039; and the class ProjwfcXML runs with this example:&lt;br /&gt;
&lt;br /&gt;
 band = ProjwfcXML(prefix=&#039;bn&#039;,path=&#039;bands&#039;,qe_version=&#039;7.0&#039;)&lt;br /&gt;
 band.plot_eigen(ax,path_kpoints=path_kpoints,cmap=&#039;viridis&#039;,selected_orbitals=atom_1,selected_orbitals_2=atom_2)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5664</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5664"/>
		<updated>2022-04-04T14:45:31Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
Alternatively we can use the function plot_eigen_ax. This functions requires as input the figure object and with given axes, as in the next example. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5663</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5663"/>
		<updated>2022-04-04T14:41:28Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
In order to plot we do:&lt;br /&gt;
&lt;br /&gt;
 xml.plot_eigen(path_kpoints)&lt;br /&gt;
&lt;br /&gt;
This function will automaticall plot the bands as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5662</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5662"/>
		<updated>2022-04-04T14:31:18Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. The full qepy library is imported by simply doing:&lt;br /&gt;
&lt;br /&gt;
 from qepy import *&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
 xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path. Previously to plot the bands, we define the k-points path using the function Path:&lt;br /&gt;
&lt;br /&gt;
 npoints = 50&lt;br /&gt;
 path_kpoints = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
                       [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
                       [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
                       [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)])&lt;br /&gt;
&lt;br /&gt;
It is worth to note that the path should coincide with the selected path for the QE calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5660</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5660"/>
		<updated>2022-04-04T14:21:24Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1. BN (semiconductor). Band structure==&lt;br /&gt;
&lt;br /&gt;
The qepy classes are useful not only to execute Quantum Espresso but also to analyze the results. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. The class is initiated doing:&lt;br /&gt;
&lt;br /&gt;
$xml = PwXML(prefix=&#039;bn&#039;, path=&#039;bands&#039;)&lt;br /&gt;
&lt;br /&gt;
The variable prefix corresponds to the same variable of the QE input. The folder location is indicated by variable path.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5658</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5658"/>
		<updated>2022-04-04T10:34:49Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The classes hosted in the qepy folder are useful not only to execute Quantum Espresso but also to analyze the results. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The class &#039;&#039;&#039;PwXML&#039;&#039;&#039; reads the data file generated by Quantum Espresso and post-process the data. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* Back to [[ICTP 2022#Tutorials]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5629</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5629"/>
		<updated>2022-04-02T20:37:51Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 6-slope-scissor.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 7-GW-band-structure-non-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-interpolated.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 8-GW-band-structure-comparison.png|400px|center]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_8-GW-band-structure-interpolated.png&amp;diff=5628</id>
		<title>File:Figure 8-GW-band-structure-interpolated.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_8-GW-band-structure-interpolated.png&amp;diff=5628"/>
		<updated>2022-04-02T20:37:01Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;interpolated&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_8-GW-band-structure-comparison.png&amp;diff=5627</id>
		<title>File:Figure 8-GW-band-structure-comparison.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_8-GW-band-structure-comparison.png&amp;diff=5627"/>
		<updated>2022-04-02T20:36:02Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GW band interpolated&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_7-GW-band-structure-non-interpolated.png&amp;diff=5626</id>
		<title>File:Figure 7-GW-band-structure-non-interpolated.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_7-GW-band-structure-non-interpolated.png&amp;diff=5626"/>
		<updated>2022-04-02T20:35:30Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GW band non-interpolated&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_6-slope-scissor.png&amp;diff=5625</id>
		<title>File:Figure 6-slope-scissor.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_6-slope-scissor.png&amp;diff=5625"/>
		<updated>2022-04-02T20:34:39Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Slope&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5624</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5624"/>
		<updated>2022-04-02T20:21:52Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 5-iron-bands-colormap.png|400px|center]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_5-iron-bands-colormap.png&amp;diff=5623</id>
		<title>File:Figure 5-iron-bands-colormap.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_5-iron-bands-colormap.png&amp;diff=5623"/>
		<updated>2022-04-02T20:21:02Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Projected iron bands&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5622</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5622"/>
		<updated>2022-04-02T20:16:07Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 4-iron-bands-size-d-orbitals.png|400px|center|Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_4-iron-bands-size-d-orbitals.png&amp;diff=5621</id>
		<title>File:Figure 4-iron-bands-size-d-orbitals.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_4-iron-bands-size-d-orbitals.png&amp;diff=5621"/>
		<updated>2022-04-02T20:15:29Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Iron band structure. Size is proportional to the weights of the projection on atomic d-orbitals. Red (blue) is up (down) spin polarization.&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5620</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5620"/>
		<updated>2022-04-02T19:59:51Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
==Tutorial 1==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 400 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 400 px | Atomic orbital projected band structure of monolayer BN]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial 2==&lt;br /&gt;
&lt;br /&gt;
[[File:Figure 3-iron-bands.png| 400 px |Spin polarized band structure of iron calculated by DFT]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tutorial 3==&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_3-iron-bands.png&amp;diff=5619</id>
		<title>File:Figure 3-iron-bands.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Figure_3-iron-bands.png&amp;diff=5619"/>
		<updated>2022-04-02T19:58:18Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Spin polarized band structure of Iron&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5585</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5585"/>
		<updated>2022-04-01T19:37:19Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The full tutorial, including the Quantum espresso and Yambo databases that we will read, can be downloaded and extracted from the yambo website:&lt;br /&gt;
 $wget www.yambo-code.org/educational/tutorials/files/databases_qepy.tar&lt;br /&gt;
 $tar -xvf databases_qepy.tar&lt;br /&gt;
 $cd databases_qepy&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png| 500 px |Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png| 500 px | Atomic orbital projected band structure of monolayer BN]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5522</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5522"/>
		<updated>2022-03-31T20:38:18Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png|Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands AOP BN 1.png|0.5px|frame|center]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands_AOP_BN_1.png&amp;diff=5521</id>
		<title>File:Bands AOP BN 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands_AOP_BN_1.png&amp;diff=5521"/>
		<updated>2022-03-31T20:37:59Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Atomic-projected band structure&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5520</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5520"/>
		<updated>2022-03-31T20:37:20Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png|Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5519</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5519"/>
		<updated>2022-03-31T20:37:05Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Tutorial 1. BN (semiconductor). Band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&#039;&#039;&#039;Tutorial 1. BN (semiconductor). Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
[[File:Bands BN 1.png|Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5518</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5518"/>
		<updated>2022-03-31T20:36:43Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutorial 1. BN (semiconductor). Band structure ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
[[File:Bands BN 1.png|Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5517</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5517"/>
		<updated>2022-03-31T20:36:08Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutorial 1. BN (semiconductor). Band structure ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&#039;Plot Band structure&#039;&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
[[File:Bands BN 1.png|Band structure of BN calculated at the level of DFT-LDA]]&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039; ===&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5516</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5516"/>
		<updated>2022-03-31T20:35:00Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Tutorial 1. BN (semiconductor). Band structure ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&#039;Plot Band structure&#039;&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039; ===&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5515</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5515"/>
		<updated>2022-03-31T20:34:12Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Tutorial 1. BN (semiconductor). Band structure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands BN 1.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands_BN_1.png&amp;diff=5514</id>
		<title>File:Bands BN 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands_BN_1.png&amp;diff=5514"/>
		<updated>2022-03-31T20:33:24Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Band structure of BN&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5513</id>
		<title>Yambopy tutorial: band structures</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Yambopy_tutorial:_band_structures&amp;diff=5513"/>
		<updated>2022-03-31T20:31:50Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: Created page with &amp;quot;Tutorial 1. BN (semiconductor). Band structure   &amp;#039;&amp;#039;&amp;#039;Plot Band structure&amp;#039;&amp;#039;&amp;#039;  &amp;lt;gallery&amp;gt; Bands_BN_1.png|Caption1 &amp;lt;/gallery&amp;gt;  &amp;#039;&amp;#039;&amp;#039;Plot atomic orbital projected Band structure&amp;#039;&amp;#039;&amp;#039;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tutorial 1. BN (semiconductor). Band structure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot Band structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Bands_BN_1.png|Caption1&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plot atomic orbital projected Band structure&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3763</id>
		<title>GW tutorial. Convergence and approximations (BN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3763"/>
		<updated>2020-01-31T08:45:39Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
We have selected 2D hexagonal boron nitride to explain the use of yambopy. Throughout this tutorial we show how to use yambopy to make efficient convergence tests, to compare different approximations and to analyse the results.&lt;br /&gt;
&lt;br /&gt;
=== Initial steps with Quantum Espresso ===&lt;br /&gt;
&lt;br /&gt;
Yambopy includes qepy, a module to handle QE-DFT calculations necessary to run Yambo.&lt;br /&gt;
&lt;br /&gt;
The initial step consists of a self-consistent (scf) ground state calculation together with a non-self-consistent (nscf) calculation with QE using the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py&lt;br /&gt;
python gs_bn.py -sn&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here you will be using a predefined lattice parameter for the calculations. You can, however, run a geometry optimisation calculation with &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py -rsn&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which at the end will update the input files for &amp;lt;code&amp;gt;pw.x&amp;lt;/code&amp;gt; with the relaxed lattice parameters and atomic coordinates. &lt;br /&gt;
&lt;br /&gt;
A quick note: almost all python scripts in this tutorial can be run without any options, but they will only print out the help message. In the case of &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; it will print:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py &lt;br /&gt;
usage: gs_bn.py [-h] [-r] [-s] [-n] [-n2] [-b] [-l] [-o] [-p] [-d]&lt;br /&gt;
                [-t NTHREADS]&lt;br /&gt;
&lt;br /&gt;
Test the yambopy script.&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  -r, --relax           Structural relaxation&lt;br /&gt;
  -s, --scf             Self-consistent calculation&lt;br /&gt;
  -n, --nscf            Non-self consistent calculation&lt;br /&gt;
  -n2, --nscf_double    Non-self consistent calculation for the double grid&lt;br /&gt;
  -b, --bands           Calculate band-structure&lt;br /&gt;
  -l, --plot            Plot band-structure&lt;br /&gt;
  -o, --orbitals        Plot atomic orbital projected band-structure&lt;br /&gt;
  -p, --phonon          Phonon calculation&lt;br /&gt;
  -d, --dispersion      Phonon dispersion&lt;br /&gt;
  -t NTHREADS, --nthreads NTHREADS&lt;br /&gt;
                        Number of threads&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the non-self-consistent run with a wave-function cutoff of &#039;&#039;&#039;60 Ry, 70 bands and a k-grid of &amp;lt;code&amp;gt;12x12x1&amp;lt;/code&amp;gt;&#039;&#039;&#039; for Yambo calculations.&lt;br /&gt;
&lt;br /&gt;
In addition, we can check if we get a reasonable band structure for our many-body calculations. We can define a path, for instance, in an hexagonal Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
p = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
           [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
           [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
           [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(10*2),int(10),int(sqrt(5)*10)])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We obtain the band structure by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py -b&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Plot-bn-band.png|BN Band Structure|500px]]&lt;br /&gt;
&lt;br /&gt;
The horizontal line marks the top of the valence band. The electronic bandgap has a value of 4.73 eV. In the next sections, we will show how to calculate the GW correction and the excitonic effects with BSE using Yambo in an automatic way.&lt;br /&gt;
&lt;br /&gt;
=== GW convergence of the bandgap ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a) Calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We converge the main parameters of a GW calculation independently. In addition, we make use of the plasmon pole approximation for the dielectric function, and the Newton solver to find the GW correction to the LDA eigenvalues. We converge the band gap of BN (difference in energy of the bottom of the conduction and top of the valence band at the K point of the Brillouin zone). We have designed the script &#039;&#039;&#039;gw_conv_bn.py&#039;&#039;&#039; (folder ~/tutorial/bn) for this purpose.&lt;br /&gt;
&lt;br /&gt;
We can select the GW calculation by calling the &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; with the corresponding arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;python gw_conv_gw.py -c &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;y = YamboIn.from_runlevel(&#039;yambo -d -p p -g n -V all&#039;,folder=&#039;gw_conv&#039;)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main variables of a GW calculation are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;EXXRLvcs&amp;lt;/code&amp;gt;: Exchange self-energy cutoff&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NGsBlkXp&amp;lt;/code&amp;gt;: Cutoff of the dielectric function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;BndsRnXp&amp;lt;/code&amp;gt;: Number of bands in the calculation of the dielectric function (PPA).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GbndRnge&amp;lt;/code&amp;gt;: Self-energy. The number of bands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We define a dictionary with all the parameters that we want to converge. Be aware of setting the right units and format for each parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;conv = { &#039;EXXRLvcs&#039;: [[10,10,20,30,40,50,60,70,80,90,100],&#039;Ry&#039;],&lt;br /&gt;
         &#039;NGsBlkXp&#039;: [[0,0,1,2,3,4,5,6], &#039;Ry&#039;],&lt;br /&gt;
         &#039;BndsRnXp&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] ,&lt;br /&gt;
         &#039;GbndRnge&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The class &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; includes the function &amp;lt;code&amp;gt;optimize&amp;lt;/code&amp;gt;, which is called here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
y.optimize(conv,folder=&#039;gw_conv&#039;,run=run,ref_run=False)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function optimize has two main arguments: the convergence dictionary, and a function &#039;&#039;&#039;run&#039;&#039;&#039; with the instructions to run&lt;br /&gt;
the calculation, defined in our case like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
    def run(filename):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; Function to be called by the optimize function &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        folder = filename.split(&#039;.&#039;)[0]&lt;br /&gt;
        print(filename,folder)&lt;br /&gt;
        shell = bash() &lt;br /&gt;
        shell.add_command(&#039;cd gw_conv&#039;)&lt;br /&gt;
        shell.add_command(&#039;rm -f *.json %s/o-*&#039;%folder) #cleanup&lt;br /&gt;
        shell.add_command(&#039;%s -F %s -J %s -C %s 2&amp;gt; %s.log&#039;%(yambo,filename,folder,folder,folder))&lt;br /&gt;
        shell.run()&lt;br /&gt;
        shell.clean()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have defined interactive run, in the folder &amp;lt;code&amp;gt;gw_conv&amp;lt;/code&amp;gt;. We have also defined the name for each job, associated with the variable and its value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b) Analysis&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once all the calculations are finished it&#039;s time to analyse them. At this point yambopy will facilitate the analysis. Besides &lt;br /&gt;
the python module, &amp;lt;code&amp;gt;yambopy&amp;lt;/code&amp;gt; can also be called in the terminal to perform some post-analysis tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
     $ yambopy&lt;br /&gt;
     analysebse -&amp;gt;     Using ypp, you can study the convergence of BSE calculations in 2 ways:&lt;br /&gt;
       plotem1s -&amp;gt;     Plot em1s calculation&lt;br /&gt;
      analysegw -&amp;gt;     Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
        mergeqp -&amp;gt;     Merge QP databases&lt;br /&gt;
           test -&amp;gt;     Run yambopy tests&lt;br /&gt;
   plotexcitons -&amp;gt;     Plot excitons calculation&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calling &amp;lt;code&amp;gt;yambopy analysegw&amp;lt;/code&amp;gt; will display the help of the function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
&lt;br /&gt;
    The script reads from &amp;lt;folder&amp;gt; all results from &amp;lt;variable&amp;gt; calculations and display them.&lt;br /&gt;
&lt;br /&gt;
    Use the band and k-point options according to the size of your k-grid&lt;br /&gt;
    and the location of the band extrema.&lt;br /&gt;
&lt;br /&gt;
        Mandatory arguments are:&lt;br /&gt;
            folder   -&amp;gt; Folder containing SAVE and convergence runs.&lt;br /&gt;
            var      -&amp;gt; Variable tested (e.g. FFTGvecs)&lt;br /&gt;
&lt;br /&gt;
        Optional variables are:&lt;br /&gt;
            -bc, --bandc   (int)  -&amp;gt; Lowest conduction band number&lt;br /&gt;
            -kc, --kpointc (int)  -&amp;gt; k-point index for conduction band&lt;br /&gt;
            -bv, --bandv   (int)  -&amp;gt; Highest valence band number&lt;br /&gt;
            -kv, --kpointv (int)  -&amp;gt; k-point index for valence band&lt;br /&gt;
            -np, --nopack  (flag) -&amp;gt; Do not call &#039;pack_files_in_folder&#039;&lt;br /&gt;
            -nt, --notext  (flag) -&amp;gt; Do not print a text file&lt;br /&gt;
            -nd, --nodraw  (flag) -&amp;gt; Do not draw (plot) the result&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the function selecting the bands and k-points, together with the parameter of convergence we will obtain the convergence plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv EXXRLvcs &lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv NGsBlkXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv BndsRnXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv GbndRnge&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the convergence plots, we can choose the set of converged parameters and repeat the calculation for finer k-grids until we reach convergence with the k-points. We have&lt;br /&gt;
intentionally used non-converged parameters. Nevertheless, along this week&lt;br /&gt;
you should have gotten enough expertise to push the convergence of the parameters&lt;br /&gt;
and determine the correct convergence set of parameters.&lt;br /&gt;
We invite you to enter in the python script, increase the parameters and check&lt;br /&gt;
again the convergence for larger values!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:EXXRLvcs.png|FFTGvecs|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:NGsBlkXp.png|NGsBlkXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:BndsRnXp.png|BndsRnXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:GbndRnge2.png|GbndRnge|300px]]&lt;br /&gt;
&lt;br /&gt;
In general, the convergence with the &#039;&#039;&#039;k-grid&#039;&#039;&#039; is done after these variables are converged and, in principle, it is also independent of them. We invite you to change the number of k-points in the file &#039;&#039;&#039;gs_bn.py&#039;&#039;&#039; using the variable &#039;&#039;&#039;kpoints_nscf&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== GW calculation in regular k-grid ===&lt;br /&gt;
&lt;br /&gt;
From the bandgap convergence study made above for a &#039;&#039;&#039;k-grid&#039;&#039;&#039; we can decide reasonable parameters. Another option is to decide a convergence threshold to establish&lt;br /&gt;
the accuracy of the convergence. In this tutorial, in order to make calculations lighter, we have chosen the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EXXRLvcs = 60 Ry&lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp =  3  Ry&lt;br /&gt;
GbndRnge = 30 bands&lt;br /&gt;
QPkrange = [1,19,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can change the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; scripts to calculate a non self-consistent run for a larger &#039;&#039;&#039;k-grid&#039;&#039;&#039; (12x12x1 will do the job). We can also change the number of bands to 40 in order to speed up a bit the QE calculation.&lt;br /&gt;
&lt;br /&gt;
We can just simply run the code to calculate the GW corrections for all the points of the Brillouin zone by setting the converged parameters in the script &amp;lt;code&amp;gt;gw_bn.py&amp;lt;/code&amp;gt;. If we enter in the script we can check that we define a scheduler (the default is bash):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
scheduler = Scheduler.factory&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just need to define the run level and the variables we are going to chang:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
y = YamboIn.from_runlevel(&#039;%s -p p -g n -V all&#039;%yambo,folder=&#039;gw&#039;)&lt;br /&gt;
    &lt;br /&gt;
y[&#039;EXXRLvcs&#039;] = [60,&#039;Ry&#039;]       # Self-energy. Exchange&lt;br /&gt;
y[&#039;BndsRnXp&#039;] = [1,40]          # Screening. Number of bands&lt;br /&gt;
y[&#039;NGsBlkXp&#039;] = [3,&#039;Ry&#039;]        # Cutoff Screening&lt;br /&gt;
y[&#039;GbndRnge&#039;] = [1,30]          # Self-energy. Number of bands&lt;br /&gt;
y[&#039;QPkrange&#039;] = [kpoint_start,kpoint_end,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now run the script and obtain the GW in the full &#039;&#039;&#039;k-grid&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python gw_bn.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we will have inside the folder &amp;lt;code&amp;gt;gw/yambo&amp;lt;/code&amp;gt; the netCDF file &amp;lt;code&amp;gt;ndb.QP&amp;lt;/code&amp;gt; with the results of the GW calculation. We can analyze the results and/or use them in BSE calculations.&lt;br /&gt;
&lt;br /&gt;
=== Plotting GW calculations. Scissor operator and GW band structure  ===&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we can start using the yambopy analysis tools. For this purpose, we have created the script &amp;lt;code&amp;gt;plot-qp.py&amp;lt;/code&amp;gt;. Using this &lt;br /&gt;
script we will be able to read the Yambo databases and plot the results. Notice that we use matplotlib to make the plots. For all the plots we define a figure and axis by&lt;br /&gt;
doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fig = plt.figure(figsize=(6,4))&lt;br /&gt;
ax  = fig.add_axes( [ 0.20, 0.20, 0.70, 0.70 ])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file is structured as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A. Define a path&#039;&#039;&#039;. Using qepy we can define a path to plot the band structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
npoints = 10&lt;br /&gt;
path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
              [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
              [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
              [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;B. Read Yambo lattice and QP databases.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lat  = YamboSaveDB.from_db_file(folder=&#039;gw/SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;gw/yambo&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;C. Plot all QP eigenvalues.&#039;&#039;&#039; A very typical plot when analyzing GW calculations is the plot of the GW eigenvalues versus LDA eigenvalues. You just need to indicate which band index corresponds to the&lt;br /&gt;
top of the valence band.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
n_top_vb = 4&lt;br /&gt;
ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Scissor-gw.png|GW results (dots) and linear fitting (solid lines) |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;D. Plot exact QP-GW eigenvalues in a path.&#039;&#039;&#039; We can also plot the band structure of calculated points (not interpolated). Yambopy &lt;br /&gt;
will find which k-points belong to a given path. We can add the LDA results for comparison.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands-LDA-GW.png|GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;E. Plot interpolated QP-GW eigenvalues in a path.&#039;&#039;&#039; In order to obtain results ready for publication or presentation, we can interpolate the GW calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands-LDA-GW-interpolated.png| Interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;F. Comparison non-interpolated and interpolated results.&#039;&#039;&#039; It is convenient to check how good is the interpolation of GW results.&lt;br /&gt;
&lt;br /&gt;
[[File:Lda-gw-comparison.png| Exact and interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
=== GW convergence for all k-points ===&lt;br /&gt;
&lt;br /&gt;
If we want to perform GW convergence in all the band states, we can check the &lt;br /&gt;
script &amp;lt;code&amp;gt;plot-gw-conv.py&amp;lt;/code&amp;gt;. Here we plot the band structure for all the k-points. For this, we pack the results in json files and then use the analyzer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pack_files_in_folder(&#039;gw_conv&#039;)&lt;br /&gt;
ya = YamboAnalyser(&#039;gw_conv&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the case of the variable NGsBlkXs, we have set:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ya.plot_gw_all_kpoints_convergence(tag=&#039;NGsBlkXs&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Chi-cutoff-kpoints.png||500px]]&lt;br /&gt;
&lt;br /&gt;
=== Approximations of the dielectric function (COHSEX, PPA) ===&lt;br /&gt;
&lt;br /&gt;
We can use yambopy to examine different run levels. For instance, the approximations used to obtain the screening are the: (i) static screening or COHSEX, (ii) plasmon-pole approximations (PPA), or (iii) real axis integration. We have set the same parameters for the first two options, just changing the variable name for the number of bands and the cut-off of the screening.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
COHSEX&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXs = 40 bands&lt;br /&gt;
NGsBlkXs = 3 Ry&lt;br /&gt;
&lt;br /&gt;
PPA&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp = 3 Ry&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the converged parameters and the function works by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -x&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We plot the band structure using the analyzer explained above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -xp&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We observe a difference between COHSEX and PPA.&lt;br /&gt;
&lt;br /&gt;
[[File:Gw-chi-s.png|GW bands calculated with the COHSEX and PPA|300px]]&lt;br /&gt;
&lt;br /&gt;
You are welcome to refine the calculations using better parameters and check how this difference changes. In the next tutorial,  [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]], you can use the scissor operator computed in section [[#GW_calculation_in_regular_k-grid|GW calculation in regular k-grid]].&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3631</id>
		<title>GW tutorial. Convergence and approximations (BN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3631"/>
		<updated>2020-01-23T16:46:47Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Plotting GW calculations. Scissor operator and GW band structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
We have selected 2D hexagonal boron nitride to explain the use of yambopy. Throughout this tutorial we show how to use yambopy to make efficient convergence tests, to compare different approximations and to analyse the results.&lt;br /&gt;
&lt;br /&gt;
=== Initial steps with Quantum Espresso ===&lt;br /&gt;
&lt;br /&gt;
Yambopy includes qepy, a module to handle QE-DFT calculations necessary to run Yambo.&lt;br /&gt;
&lt;br /&gt;
The initial step consists of a self-consistent (scf) ground state calculation together with a non-self-consistent (nscf) calculation with QE using the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py&lt;br /&gt;
python gs_bn.py -sn&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the non-self-consistent run with a wave-function cutoff of &#039;&#039;&#039;60 Ry, 70 bands and a k-grid of &amp;lt;code&amp;gt;12x12x1&amp;lt;/code&amp;gt;&#039;&#039;&#039; for Yambo calculations.&lt;br /&gt;
&lt;br /&gt;
In addition, we can check if we get a reasonable band structure for our many-body calculations. We can define a path, for instance, in an hexagonal Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
p = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
           [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
           [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
           [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(10*2),int(10),int(sqrt(5)*10)])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We obtain the band structure by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py -b&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Plot-bn-band.png|BN Band Structure|500px]]&lt;br /&gt;
&lt;br /&gt;
The horizontal line marks the top of the valence band. The electronic bandgap has a value of 4.73 eV. In the next sections, we will show how to calculate the GW correction and the excitonic effects with BSE using Yambo in an automatic way.&lt;br /&gt;
&lt;br /&gt;
=== GW convergence of the bandgap ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a) Calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We converge the main parameters of a GW calculation independently. In addition, we make use of the plasmon pole approximation for the dielectric function, and the Newton solver to find the GW correction to the LDA eigenvalues. We converge the band gap of BN (difference in energy of the bottom of the conduction and top of the valence band at the K point of the Brillouin zone). We have designed the script &#039;&#039;&#039;gw_conv_bn.py&#039;&#039;&#039; (folder ~/tutorial/bn) for this purpose.&lt;br /&gt;
&lt;br /&gt;
We can select the GW calculation by calling the &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; with the corresponding arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;y = YamboIn.from_runlevel(&#039;yambo -d -p p -g n -V all&#039;,folder=&#039;gw_conv&#039;)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main variables of a GW calculation are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;EXXRLvcs&amp;lt;/code&amp;gt;: Exchange self-energy cutoff&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NGsBlkXp&amp;lt;/code&amp;gt;: Cutoff of the dielectric function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;BndsRnXp&amp;lt;/code&amp;gt;: Number of bands in the calculation of the dielectric function (PPA).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GbndRnge&amp;lt;/code&amp;gt;: Self-energy. The number of bands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We define a dictionary with all the parameters that we want to converge. Be aware of setting the right units and format for each parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;conv = { &#039;EXXRLvcs&#039;: [[10,10,20,30,40,50,60,70,80,90,100],&#039;Ry&#039;],&lt;br /&gt;
         &#039;NGsBlkXp&#039;: [[0,0,1,2,3,4,5,6], &#039;Ry&#039;],&lt;br /&gt;
         &#039;BndsRnXp&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] ,&lt;br /&gt;
         &#039;GbndRnge&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The class &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; includes the function &amp;lt;code&amp;gt;optimize&amp;lt;/code&amp;gt;, which is called here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
y.optimize(conv,folder=&#039;gw_conv&#039;,run=run,ref_run=False)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function optimize has two main arguments: the convergence dictionary, and a function &#039;&#039;&#039;run&#039;&#039;&#039; with the instructions to run&lt;br /&gt;
the calculation, defined in our case like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
    def run(filename):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; Function to be called by the optimize function &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        folder = filename.split(&#039;.&#039;)[0]&lt;br /&gt;
        print(filename,folder)&lt;br /&gt;
        shell = bash() &lt;br /&gt;
        shell.add_command(&#039;cd gw_conv&#039;)&lt;br /&gt;
        shell.add_command(&#039;rm -f *.json %s/o-*&#039;%folder) #cleanup&lt;br /&gt;
        shell.add_command(&#039;%s -F %s -J %s -C %s 2&amp;gt; %s.log&#039;%(yambo,filename,folder,folder,folder))&lt;br /&gt;
        shell.run()&lt;br /&gt;
        shell.clean()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have defined interactive run, in the folder &amp;lt;code&amp;gt;gw_conv&amp;lt;/code&amp;gt;. We have also defined the name for each job, associated with the variable and its value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b) Analysis&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once all the calculations are finished it&#039;s time to analyse them. At this point yambopy will facilitate the analysis. Besides &lt;br /&gt;
the python module, &amp;lt;code&amp;gt;yambopy&amp;lt;/code&amp;gt; can also be called in the terminal to perform some post-analysis tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
     $ yambopy&lt;br /&gt;
     analysebse -&amp;gt;     Using ypp, you can study the convergence of BSE calculations in 2 ways:&lt;br /&gt;
       plotem1s -&amp;gt;     Plot em1s calculation&lt;br /&gt;
      analysegw -&amp;gt;     Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
        mergeqp -&amp;gt;     Merge QP databases&lt;br /&gt;
           test -&amp;gt;     Run yambopy tests&lt;br /&gt;
   plotexcitons -&amp;gt;     Plot excitons calculation&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calling &amp;lt;code&amp;gt;yambopy analysegw&amp;lt;/code&amp;gt; will display the help of the function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
&lt;br /&gt;
    The script reads from &amp;lt;folder&amp;gt; all results from &amp;lt;variable&amp;gt; calculations and display them.&lt;br /&gt;
&lt;br /&gt;
    Use the band and k-point options according to the size of your k-grid&lt;br /&gt;
    and the location of the band extrema.&lt;br /&gt;
&lt;br /&gt;
        Mandatory arguments are:&lt;br /&gt;
            folder   -&amp;gt; Folder containing SAVE and convergence runs.&lt;br /&gt;
            var      -&amp;gt; Variable tested (e.g. FFTGvecs)&lt;br /&gt;
&lt;br /&gt;
        Optional variables are:&lt;br /&gt;
            -bc, --bandc   (int)  -&amp;gt; Lowest conduction band number&lt;br /&gt;
            -kc, --kpointc (int)  -&amp;gt; k-point index for conduction band&lt;br /&gt;
            -bv, --bandv   (int)  -&amp;gt; Highest valence band number&lt;br /&gt;
            -kv, --kpointv (int)  -&amp;gt; k-point index for valence band&lt;br /&gt;
            -np, --nopack  (flag) -&amp;gt; Do not call &#039;pack_files_in_folder&#039;&lt;br /&gt;
            -nt, --notext  (flag) -&amp;gt; Do not print a text file&lt;br /&gt;
            -nd, --nodraw  (flag) -&amp;gt; Do not draw (plot) the result&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the function selecting the bands and k-points, together with the parameter of convergence we will obtain the convergence plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv EXXRLvcs &lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv NGsBlkXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv BndsRnXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv GbndRnge&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the convergence plots, we can choose the set of converged parameters and repeat the calculation for finer k-grids until we reach convergence with the k-points. We have&lt;br /&gt;
intentionally used non-converged parameters. Nevertheless, along this week&lt;br /&gt;
you should have gotten enough expertise to push the convergence of the parameters&lt;br /&gt;
and determine the correct convergence set of parameters.&lt;br /&gt;
We invite you to enter in the python script, increase the parameters and check&lt;br /&gt;
again the convergence for larger values!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:EXXRLvcs.png|FFTGvecs|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:NGsBlkXp.png|NGsBlkXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:BndsRnXp.png|BndsRnXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:GbndRnge2.png|GbndRnge|300px]]&lt;br /&gt;
&lt;br /&gt;
In general, the convergence with the &#039;&#039;&#039;k-grid&#039;&#039;&#039; is done after these variables are converged and, in principle, it is also independent of them. We invite you to change the number of k-points in the file &#039;&#039;&#039;gs_bn.py&#039;&#039;&#039; using the variable &#039;&#039;&#039;kpoints_nscf&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== GW calculation in regular k-grid ===&lt;br /&gt;
&lt;br /&gt;
From the bandgap convergence study made above for a &#039;&#039;&#039;k-grid&#039;&#039;&#039; we can decide reasonable parameters. Another option is to decide a convergence threshold to establish&lt;br /&gt;
the accuracy of the convergence. In this tutorial, in order to make calculations lighter, we have chosen the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EXXRLvcs = 60 Ry&lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp =  3  Ry&lt;br /&gt;
GbndRnge = 30 bands&lt;br /&gt;
QPkrange = [1,19,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can change the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; scripts to calculate a non self-consistent run for a larger &#039;&#039;&#039;k-grid&#039;&#039;&#039; (12x12x1 will do the job). We can also change the number of bands to 40 in order to speed up a bit the QE calculation.&lt;br /&gt;
&lt;br /&gt;
We can just simply run the code to calculate the GW corrections for all the points of the Brillouin zone by setting the converged parameters in the script &amp;lt;code&amp;gt;gw_bn.py&amp;lt;/code&amp;gt;. If we enter in the script we can check that we define a scheduler (the default is bash):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
scheduler = Scheduler.factory&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just need to define the run level and the variables we are going to chang:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
y = YamboIn.from_runlevel(&#039;%s -p p -g n -V all&#039;%yambo,folder=&#039;gw&#039;)&lt;br /&gt;
    &lt;br /&gt;
y[&#039;EXXRLvcs&#039;] = [60,&#039;Ry&#039;]       # Self-energy. Exchange&lt;br /&gt;
y[&#039;BndsRnXp&#039;] = [1,40]          # Screening. Number of bands&lt;br /&gt;
y[&#039;NGsBlkXp&#039;] = [3,&#039;Ry&#039;]        # Cutoff Screening&lt;br /&gt;
y[&#039;GbndRnge&#039;] = [1,30]          # Self-energy. Number of bands&lt;br /&gt;
y[&#039;QPkrange&#039;] = [kpoint_start,kpoint_end,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now run the script and obtain the GW in the full &#039;&#039;&#039;k-grid&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python gw_bn.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we will have inside the folder &amp;lt;code&amp;gt;gw/yambo&amp;lt;/code&amp;gt; the netCDF file &amp;lt;code&amp;gt;ndb.QP&amp;lt;/code&amp;gt; with the results of the GW calculation. We can analyze the results and/or use them in BSE calculations.&lt;br /&gt;
&lt;br /&gt;
=== Plotting GW calculations. Scissor operator and GW band structure  ===&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we can start using the yambopy analysis tools. For this purpose, we have created the script &amp;lt;code&amp;gt;plot-qp.py&amp;lt;/code&amp;gt;. Using this &lt;br /&gt;
script we will be able to read the Yambo databases and plot the results. Notice that we use matplotlib to make the plots. For all the plots we define a figure and axis by&lt;br /&gt;
doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fig = plt.figure(figsize=(6,4))&lt;br /&gt;
ax  = fig.add_axes( [ 0.20, 0.20, 0.70, 0.70 ])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file is structured as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A. Define a path&#039;&#039;&#039;. Using qepy we can define a path to plot the band structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
npoints = 10&lt;br /&gt;
path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
              [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
              [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
              [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;B. Read Yambo lattice and QP databases.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lat  = YamboSaveDB.from_db_file(folder=&#039;gw/SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;gw/yambo&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;C. Plot all QP eigenvalues.&#039;&#039;&#039; A very typical plot when analyzing GW calculations is the plot of the GW eigenvalues versus LDA eigenvalues. You just need to indicate which band index corresponds to the&lt;br /&gt;
top of the valence band.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
n_top_vb = 4&lt;br /&gt;
ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Scissor-gw.png|GW results (dots) and linear fitting (solid lines) |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;D. Plot exact QP-GW eigenvalues in a path.&#039;&#039;&#039; We can also plot the band structure of calculated points (not interpolated). Yambopy &lt;br /&gt;
will find which k-points belong to a given path. We can add the LDA results for comparison.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Bands-LDA-GW.png|GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;E. Plot interpolated QP-GW eigenvalues in a path.&#039;&#039;&#039; In order to obtain results ready for publication or presentation, we can interpolate the GW calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:Bands-LDA-GW-interpolated.png| Interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;F. Comparison non-interpolated and interpolated results.&#039;&#039;&#039; It is convenient to check how good is the interpolation of GW results.&lt;br /&gt;
&lt;br /&gt;
[[File:Lda-gw-comparison.png| Exact and interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
=== GW convergence for all k-points ===&lt;br /&gt;
&lt;br /&gt;
If we want to perform GW convergence in all the band states, we can check the &lt;br /&gt;
script &amp;lt;code&amp;gt;plot-gw-conv.py&amp;lt;/code&amp;gt;. Here we plot the band structure for all the k-points. For this, we pack the results in json files and then use the analyzer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pack_files_in_folder(&#039;gw_conv&#039;)&lt;br /&gt;
ya = YamboAnalyser(&#039;gw_conv&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the case of the variable NGsBlkXs, we have set:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ya.plot_gw_all_kpoints_convergence(tag=&#039;NGsBlkXs&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Chi-cutoff-kpoints.png||500px]]&lt;br /&gt;
&lt;br /&gt;
=== Approximations of the dielectric function (COHSEX, PPA) ===&lt;br /&gt;
&lt;br /&gt;
We can use yambopy to examine different run levels. For instance, the approximations used to obtain the screening are the: (i) static screening or COHSEX, (ii) plasmon-pole approximations (PPA), or (iii) real axis integration. We have set the same parameters for the first two options, just changing the variable name for the number of bands and the cut-off of the screening.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
COHSEX&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXs = 40 bands&lt;br /&gt;
NGsBlkXs = 3 Ry&lt;br /&gt;
&lt;br /&gt;
PPA&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp = 3 Ry&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the converged parameters and the function works by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -x&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We plot the band structure using the analyzer explained above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -xp&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We observe a large difference between COHSEX and PPA.&lt;br /&gt;
&lt;br /&gt;
[[File:Gw-chi-s.png|GW bands calculated with the COHSEX and PPA|300px]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands-LDA-GW.png&amp;diff=3630</id>
		<title>File:Bands-LDA-GW.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands-LDA-GW.png&amp;diff=3630"/>
		<updated>2020-01-23T16:43:56Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-01-23&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Alejandro|Alejandro]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands-LDA-GW-interpolated.png&amp;diff=3629</id>
		<title>File:Bands-LDA-GW-interpolated.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Bands-LDA-GW-interpolated.png&amp;diff=3629"/>
		<updated>2020-01-23T16:43:56Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-01-23&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Alejandro|Alejandro]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Lda-gw-comparison.png&amp;diff=3628</id>
		<title>File:Lda-gw-comparison.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Lda-gw-comparison.png&amp;diff=3628"/>
		<updated>2020-01-23T16:43:56Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-01-23&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Alejandro|Alejandro]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3623</id>
		<title>GW tutorial. Convergence and approximations (BN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3623"/>
		<updated>2020-01-23T15:42:05Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Approximations of the dielectric function (COHSEX, PPA) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
We have selected 2D hexagonal boron nitride to explain the use of yambopy. Throughout this tutorial we show how to use yambopy to make efficient convergence tests, to compare different approximations and to analyse the results.&lt;br /&gt;
&lt;br /&gt;
=== Initial steps with Quantum Espresso ===&lt;br /&gt;
&lt;br /&gt;
Yambopy includes qepy, a module to handle QE-DFT calculations necessary to run Yambo.&lt;br /&gt;
&lt;br /&gt;
The initial step consists of a self-consistent (scf) ground state calculation together with a non-self-consistent (nscf) calculation with QE using the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py&lt;br /&gt;
python gs_bn.py -sn&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the non-self-consistent run with a wave-function cutoff of &#039;&#039;&#039;60 Ry, 70 bands and a k-grid of &amp;lt;code&amp;gt;12x12x1&amp;lt;/code&amp;gt;&#039;&#039;&#039; for Yambo calculations.&lt;br /&gt;
&lt;br /&gt;
In addition, we can check if we get a reasonable band structure for our many-body calculations. We can define a path, for instance, in an hexagonal Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
p = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
           [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
           [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
           [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(10*2),int(10),int(sqrt(5)*10)])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We obtain the band structure by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py -b&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Plot-bn-band.png|BN Band Structure|500px]]&lt;br /&gt;
&lt;br /&gt;
The horizontal line marks the top of the valence band. The electronic bandgap has a value of 4.73 eV. In the next sections, we will show how to calculate the GW correction and the excitonic effects with BSE using Yambo in an automatic way.&lt;br /&gt;
&lt;br /&gt;
=== GW convergence of the bandgap ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a) Calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We converge the main parameters of a GW calculation independently. In addition, we make use of the plasmon pole approximation for the dielectric function, and the Newton solver to find the GW correction to the LDA eigenvalues. We converge the band gap of BN (difference in energy of the bottom of the conduction and top of the valence band at the K point of the Brillouin zone). We have designed the script &#039;&#039;&#039;gw_conv_bn.py&#039;&#039;&#039; (folder ~/tutorial/bn) for this purpose.&lt;br /&gt;
&lt;br /&gt;
We can select the GW calculation by calling the &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; with the corresponding arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;y = YamboIn.from_runlevel(&#039;yambo -d -p p -g n -V all&#039;,folder=&#039;gw_conv&#039;)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main variables of a GW calculation are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;EXXRLvcs&amp;lt;/code&amp;gt;: Exchange self-energy cutoff&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NGsBlkXp&amp;lt;/code&amp;gt;: Cutoff of the dielectric function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;BndsRnXp&amp;lt;/code&amp;gt;: Number of bands in the calculation of the dielectric function (PPA).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GbndRnge&amp;lt;/code&amp;gt;: Self-energy. The number of bands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We define a dictionary with all the parameters that we want to converge. Be aware of setting the right units and format for each parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;conv = { &#039;EXXRLvcs&#039;: [[10,10,20,30,40,50,60,70,80,90,100],&#039;Ry&#039;],&lt;br /&gt;
         &#039;NGsBlkXp&#039;: [[0,0,1,2,3,4,5,6], &#039;Ry&#039;],&lt;br /&gt;
         &#039;BndsRnXp&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] ,&lt;br /&gt;
         &#039;GbndRnge&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The class &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; includes the function &amp;lt;code&amp;gt;optimize&amp;lt;/code&amp;gt;, which is called here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
y.optimize(conv,folder=&#039;gw_conv&#039;,run=run,ref_run=False)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function optimize has two main arguments: the convergence dictionary, and a function &#039;&#039;&#039;run&#039;&#039;&#039; with the instructions to run&lt;br /&gt;
the calculation, defined in our case like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
    def run(filename):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; Function to be called by the optimize function &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        folder = filename.split(&#039;.&#039;)[0]&lt;br /&gt;
        print(filename,folder)&lt;br /&gt;
        shell = bash() &lt;br /&gt;
        shell.add_command(&#039;cd gw_conv&#039;)&lt;br /&gt;
        shell.add_command(&#039;rm -f *.json %s/o-*&#039;%folder) #cleanup&lt;br /&gt;
        shell.add_command(&#039;%s -F %s -J %s -C %s 2&amp;gt; %s.log&#039;%(yambo,filename,folder,folder,folder))&lt;br /&gt;
        shell.run()&lt;br /&gt;
        shell.clean()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have defined interactive run, in the folder &amp;lt;code&amp;gt;gw_conv&amp;lt;/code&amp;gt;. We have also defined the name for each job, associated with the variable and its value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b) Analysis&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once all the calculations are finished it&#039;s time to analyse them. At this point yambopy will facilitate the analysis. Besides &lt;br /&gt;
the python module, &amp;lt;code&amp;gt;yambopy&amp;lt;/code&amp;gt; can also be called in the terminal to perform some post-analysis tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
     $ yambopy&lt;br /&gt;
     analysebse -&amp;gt;     Using ypp, you can study the convergence of BSE calculations in 2 ways:&lt;br /&gt;
       plotem1s -&amp;gt;     Plot em1s calculation&lt;br /&gt;
      analysegw -&amp;gt;     Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
        mergeqp -&amp;gt;     Merge QP databases&lt;br /&gt;
           test -&amp;gt;     Run yambopy tests&lt;br /&gt;
   plotexcitons -&amp;gt;     Plot excitons calculation&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calling &amp;lt;code&amp;gt;yambopy analysegw&amp;lt;/code&amp;gt; will display the help of the function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
&lt;br /&gt;
    The script reads from &amp;lt;folder&amp;gt; all results from &amp;lt;variable&amp;gt; calculations and display them.&lt;br /&gt;
&lt;br /&gt;
    Use the band and k-point options according to the size of your k-grid&lt;br /&gt;
    and the location of the band extrema.&lt;br /&gt;
&lt;br /&gt;
        Mandatory arguments are:&lt;br /&gt;
            folder   -&amp;gt; Folder containing SAVE and convergence runs.&lt;br /&gt;
            var      -&amp;gt; Variable tested (e.g. FFTGvecs)&lt;br /&gt;
&lt;br /&gt;
        Optional variables are:&lt;br /&gt;
            -bc, --bandc   (int)  -&amp;gt; Lowest conduction band number&lt;br /&gt;
            -kc, --kpointc (int)  -&amp;gt; k-point index for conduction band&lt;br /&gt;
            -bv, --bandv   (int)  -&amp;gt; Highest valence band number&lt;br /&gt;
            -kv, --kpointv (int)  -&amp;gt; k-point index for valence band&lt;br /&gt;
            -np, --nopack  (flag) -&amp;gt; Do not call &#039;pack_files_in_folder&#039;&lt;br /&gt;
            -nt, --notext  (flag) -&amp;gt; Do not print a text file&lt;br /&gt;
            -nd, --nodraw  (flag) -&amp;gt; Do not draw (plot) the result&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the function selecting the bands and k-points, together with the parameter of convergence we will obtain the convergence plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv EXXRLvcs &lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv NGsBlkXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv BndsRnXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv GbndRnge&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the convergence plots, we can choose the set of converged parameters and repeat the calculation for finer k-grids until we reach convergence with the k-points. We have&lt;br /&gt;
intentionally used non-converged parameters. Nevertheless, along this week&lt;br /&gt;
you should have gotten enough expertise to push the convergence of the parameters&lt;br /&gt;
and determine the correct convergence set of parameters.&lt;br /&gt;
We invite you to enter in the python script, increase the parameters and check&lt;br /&gt;
again the convergence for larger values!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:EXXRLvcs.png|FFTGvecs|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:NGsBlkXp.png|NGsBlkXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:BndsRnXp.png|BndsRnXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:GbndRnge2.png|GbndRnge|300px]]&lt;br /&gt;
&lt;br /&gt;
In general, the convergence with the &#039;&#039;&#039;k-grid&#039;&#039;&#039; is done after these variables are converged and, in principle, it is also independent of them. We invite you to change the number of k-points in the file &#039;&#039;&#039;gs_bn.py&#039;&#039;&#039; using the variable &#039;&#039;&#039;kpoints_nscf&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== GW calculation in regular k-grid ===&lt;br /&gt;
&lt;br /&gt;
From the bandgap convergence study made above for a &#039;&#039;&#039;k-grid&#039;&#039;&#039; we can decide reasonable parameters. Another option is to decide a convergence threshold to establish&lt;br /&gt;
the accuracy of the convergence. In this tutorial, in order to make calculations lighter, we have chosen the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EXXRLvcs = 60 Ry&lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp =  3  Ry&lt;br /&gt;
GbndRnge = 30 bands&lt;br /&gt;
QPkrange = [1,19,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can change the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; scripts to calculate a non self-consistent run for a larger &#039;&#039;&#039;k-grid&#039;&#039;&#039; (12x12x1 will do the job). We can also change the number of bands to 40 in order to speed up a bit the QE calculation.&lt;br /&gt;
&lt;br /&gt;
We can just simply run the code to calculate the GW corrections for all the points of the Brillouin zone by setting the converged parameters in the script &amp;lt;code&amp;gt;gw_bn.py&amp;lt;/code&amp;gt;. If we enter in the script we can check that we define a scheduler (the default is bash):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
scheduler = Scheduler.factory&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just need to define the run level and the variables we are going to chang:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
y = YamboIn.from_runlevel(&#039;%s -p p -g n -V all&#039;%yambo,folder=&#039;gw&#039;)&lt;br /&gt;
    &lt;br /&gt;
y[&#039;EXXRLvcs&#039;] = [60,&#039;Ry&#039;]       # Self-energy. Exchange&lt;br /&gt;
y[&#039;BndsRnXp&#039;] = [1,40]          # Screening. Number of bands&lt;br /&gt;
y[&#039;NGsBlkXp&#039;] = [3,&#039;Ry&#039;]        # Cutoff Screening&lt;br /&gt;
y[&#039;GbndRnge&#039;] = [1,30]          # Self-energy. Number of bands&lt;br /&gt;
y[&#039;QPkrange&#039;] = [kpoint_start,kpoint_end,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now run the script and obtain the GW in the full &#039;&#039;&#039;k-grid&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python gw_bn.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we will have inside the folder &amp;lt;code&amp;gt;gw/yambo&amp;lt;/code&amp;gt; the netCDF file &amp;lt;code&amp;gt;ndb.QP&amp;lt;/code&amp;gt; with the results of the GW calculation. We can analyze the results and/or use them in BSE calculations.&lt;br /&gt;
&lt;br /&gt;
=== Plotting GW calculations. Scissor operator and GW band structure  ===&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we can start using the yambopy analysis tools. For this purpose, we have created the script &amp;lt;code&amp;gt;plot-qp.py&amp;lt;/code&amp;gt;. Using this &lt;br /&gt;
script we will be able to read the Yambo databases and plot the results. Notice that we use matplotlib to make the plots. For all the plots we define a figure and axis by&lt;br /&gt;
doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fig = plt.figure(figsize=(6,4))&lt;br /&gt;
ax  = fig.add_axes( [ 0.20, 0.20, 0.70, 0.70 ])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file is structured as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A. Define a path&#039;&#039;&#039;. Using qepy we can define a path to plot the band structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
npoints = 10&lt;br /&gt;
path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
              [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
              [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
              [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;B. Read Yambo lattice and QP databases.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lat  = YamboSaveDB.from_db_file(folder=&#039;gw/SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;gw/yambo&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;C. Plot all QP eigenvalues.&#039;&#039;&#039; A very typical plot when analyzing GW calculations is the plot of the GW eigenvalues versus LDA eigenvalues. You just need to indicate which band index corresponds to the&lt;br /&gt;
top of the valence band.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
n_top_vb = 4&lt;br /&gt;
ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Scissor-gw.png|GW results (dots) and linear fitting (solid lines) |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;D. Plot exact QP-GW eigenvalues in a path.&#039;&#039;&#039; We can also plot the band structure of calculated points (not interpolated). Yambopy &lt;br /&gt;
will find which k-points belong to a given path. We can add the LDA results for comparison.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bands-not-interpolated.png|GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;E. Plot interpolated QP-GW eigenvalues in a path.&#039;&#039;&#039; In order to obtain results ready for publication or presentation, we can interpolate the GW calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:bands-interpolated.png| Interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;F. Comparison non-interpolated and interpolated results.&#039;&#039;&#039; It is convenient to check how good is the interpolation of GW results.&lt;br /&gt;
&lt;br /&gt;
[[File:check-interpolation.png| Exact and interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
=== GW convergence for all k-points ===&lt;br /&gt;
&lt;br /&gt;
If we want to perform GW convergence in all the band states, we can check the &lt;br /&gt;
script &amp;lt;code&amp;gt;plot-gw-conv.py&amp;lt;/code&amp;gt;. Here we plot the band structure for all the k-points. For this, we pack the results in json files and then use the analyzer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pack_files_in_folder(&#039;gw_conv&#039;)&lt;br /&gt;
ya = YamboAnalyser(&#039;gw_conv&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the case of the variable NGsBlkXs, we have set:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ya.plot_gw_all_kpoints_convergence(tag=&#039;NGsBlkXs&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Chi-cutoff-kpoints.png||500px]]&lt;br /&gt;
&lt;br /&gt;
=== Approximations of the dielectric function (COHSEX, PPA) ===&lt;br /&gt;
&lt;br /&gt;
We can use yambopy to examine different run levels. For instance, the approximations used to obtain the screening are the: (i) static screening or COHSEX, (ii) plasmon-pole approximations (PPA), or (iii) real axis integration. We have set the same parameters for the first two options, just changing the variable name for the number of bands and the cut-off of the screening.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
COHSEX&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXs = 40 bands&lt;br /&gt;
NGsBlkXs = 3 Ry&lt;br /&gt;
&lt;br /&gt;
PPA&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp = 3 Ry&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the converged parameters and the function works by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -x&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We plot the band structure using the analyzer explained above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -xp&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We observe a large difference between COHSEX and PPA.&lt;br /&gt;
&lt;br /&gt;
[[File:Gw-chi-s.png|GW bands calculated with the COHSEX and PPA|300px]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=File:Gw-chi-s.png&amp;diff=3622</id>
		<title>File:Gw-chi-s.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=File:Gw-chi-s.png&amp;diff=3622"/>
		<updated>2020-01-23T15:41:21Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Yambo tutorial image}}&lt;br /&gt;
|date=2020-01-23&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Alejandro|Alejandro]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-4.0}}&lt;br /&gt;
&lt;br /&gt;
This file was uploaded with the UploadWizard extension.&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3288</id>
		<title>GW tutorial. Convergence and approximations (BN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3288"/>
		<updated>2020-01-16T16:35:32Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Approximations of the dielectric function (COHSEX, PPA) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
We have selected 2D hexagonal boron nitride to explain the use of yambopy. Along with this tutorial we show how to use yambopy to make efficient convergence tests, to compare different approximations and to analyze the results.&lt;br /&gt;
&lt;br /&gt;
=== Initial steps with Quantum Espresso ===&lt;br /&gt;
&lt;br /&gt;
Yambopy includes qepy, a module to handle QE-DFT calculations necessary to run Yambo.&lt;br /&gt;
&lt;br /&gt;
The initial step consists of a self-consistent (scf) ground state calculation together with a non-self-consistent (nscf) calculation with QE using the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py&lt;br /&gt;
python gs_bn.py -sn&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the non-self-consistent run with a wave-function cutoff of &#039;&#039;&#039;60 Ry, 70 bands and a k-grid of &amp;lt;code&amp;gt;12x12x1&amp;lt;/code&amp;gt;&#039;&#039;&#039; for Yambo calculations.&lt;br /&gt;
&lt;br /&gt;
In addition, we can check if we get a reasonable band structure for our many-body calculations. We can define a path, for instance, in an hexagonal Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
p = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
           [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
           [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
           [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(10*2),int(10),int(sqrt(5)*10)])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We obtain the band structure by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py -b&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Plot-bn-band.png|BN Band Structure|500px]]&lt;br /&gt;
&lt;br /&gt;
The horizontal line marks the top of the valence band. The electronic bandgap has a value of 4.73 eV. In the next sections, we will show how to calculate the GW correction and the excitonic effects with BSE using Yambo in an automatic way.&lt;br /&gt;
&lt;br /&gt;
=== GW convergence of the bandgap ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a) Calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We converge the main parameters of a GW calculation independently. In addition, we make use of the plasmon pole approximation for the dielectric function, and the Newton solver to find the GW correction to the LDA eigenvalues. We converge the band gap of BN (difference in energy of the bottom of the conduction and top of the valence band at the K point of the Brillouin zone). We have designed the script &#039;&#039;&#039;gw_conv_bn.py&#039;&#039;&#039; (folder ~/tutorial/bn) for this purpose.&lt;br /&gt;
&lt;br /&gt;
We can select the GW calculation by calling the &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; with the corresponding arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;y = YamboIn.from_runlevel(&#039;yambo -d -p p -g n -V all&#039;,folder=&#039;gw_conv&#039;)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main variables of a GW calculation are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;EXXRLvcs&amp;lt;/code&amp;gt;: Exchange self-energy cutoff&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NGsBlkXp&amp;lt;/code&amp;gt;: Cutoff of the dielectric function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;BndsRnXp&amp;lt;/code&amp;gt;: Number of bands in the calculation of the dielectric function (PPA).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GbndRnge&amp;lt;/code&amp;gt;: Self-energy. The number of bands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We define a dictionary with all the parameters that we want to converge. Be aware of setting the right units and format for each parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;conv = { &#039;EXXRLvcs&#039;: [[10,10,20,30,40,50,60,70,80,90,100],&#039;Ry&#039;],&lt;br /&gt;
         &#039;NGsBlkXp&#039;: [[0,0,1,2,3,4,5,6], &#039;Ry&#039;],&lt;br /&gt;
         &#039;BndsRnXp&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] ,&lt;br /&gt;
         &#039;GbndRnge&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The class &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; includes the function &amp;lt;code&amp;gt;optimize&amp;lt;/code&amp;gt;, which is called here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
y.optimize(conv,folder=&#039;gw_conv&#039;,run=run,ref_run=False)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function optimize has two main arguments: the convergence dictionary, and a function &#039;&#039;&#039;run&#039;&#039;&#039; with the instructions to run&lt;br /&gt;
the calculation, defined in our case like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
    def run(filename):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; Function to be called by the optimize function &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        folder = filename.split(&#039;.&#039;)[0]&lt;br /&gt;
        print(filename,folder)&lt;br /&gt;
        shell = bash() &lt;br /&gt;
        shell.add_command(&#039;cd gw_conv&#039;)&lt;br /&gt;
        shell.add_command(&#039;rm -f *.json %s/o-*&#039;%folder) #cleanup&lt;br /&gt;
        shell.add_command(&#039;%s -F %s -J %s -C %s 2&amp;gt; %s.log&#039;%(yambo,filename,folder,folder,folder))&lt;br /&gt;
        shell.run()&lt;br /&gt;
        shell.clean()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have defined interactive run, in the folder &amp;lt;code&amp;gt;gw_conv&amp;lt;/code&amp;gt;. We have also defined the name for each job, associated with the variable and its value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b) Analysis&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once all the calculations are finished it&#039;s time to analyse them. At this point yambopy will facilitate the analysis. Besides &lt;br /&gt;
the python module, &amp;lt;code&amp;gt;yambopy&amp;lt;/code&amp;gt; can also be called in the terminal to perform some post-analysis tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
     $ yambopy&lt;br /&gt;
     analysebse -&amp;gt;     Using ypp, you can study the convergence of BSE calculations in 2 ways:&lt;br /&gt;
       plotem1s -&amp;gt;     Plot em1s calculation&lt;br /&gt;
      analysegw -&amp;gt;     Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
        mergeqp -&amp;gt;     Merge QP databases&lt;br /&gt;
           test -&amp;gt;     Run yambopy tests&lt;br /&gt;
   plotexcitons -&amp;gt;     Plot excitons calculation&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calling &amp;lt;code&amp;gt;yambopy analysegw&amp;lt;/code&amp;gt; will display the help of the function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
&lt;br /&gt;
    The script reads from &amp;lt;folder&amp;gt; all results from &amp;lt;variable&amp;gt; calculations and display them.&lt;br /&gt;
&lt;br /&gt;
    Use the band and k-point options according to the size of your k-grid&lt;br /&gt;
    and the location of the band extrema.&lt;br /&gt;
&lt;br /&gt;
        Mandatory arguments are:&lt;br /&gt;
            folder   -&amp;gt; Folder containing SAVE and convergence runs.&lt;br /&gt;
            var      -&amp;gt; Variable tested (e.g. FFTGvecs)&lt;br /&gt;
&lt;br /&gt;
        Optional variables are:&lt;br /&gt;
            -bc, --bandc   (int)  -&amp;gt; Lowest conduction band number&lt;br /&gt;
            -kc, --kpointc (int)  -&amp;gt; k-point index for conduction band&lt;br /&gt;
            -bv, --bandv   (int)  -&amp;gt; Highest valence band number&lt;br /&gt;
            -kv, --kpointv (int)  -&amp;gt; k-point index for valence band&lt;br /&gt;
            -np, --nopack  (flag) -&amp;gt; Do not call &#039;pack_files_in_folder&#039;&lt;br /&gt;
            -nt, --notext  (flag) -&amp;gt; Do not print a text file&lt;br /&gt;
            -nd, --nodraw  (flag) -&amp;gt; Do not draw (plot) the result&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the function selecting the bands and k-points, together with the parameter of convergence we will obtain the convergence plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv EXXRLvcs &lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv NGsBlkXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv BndsRnXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv GbndRnge&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the convergence plots, we can choose the set of converged parameters and repeat the calculation for finer k-grids until we reach convergence with the k-points. We have&lt;br /&gt;
intentionally used non-converged parameters. Nevertheless, along this week&lt;br /&gt;
you should have gotten enough expertise to push the convergence of the parameters&lt;br /&gt;
and determine the correct convergence set of parameters.&lt;br /&gt;
We invite you to enter in the python script, increase the parameters and check&lt;br /&gt;
again the convergence for larger values!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:EXXRLvcs.png|FFTGvecs|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:NGsBlkXp.png|NGsBlkXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:BndsRnXp.png|BndsRnXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:GbndRnge2.png|GbndRnge|300px]]&lt;br /&gt;
&lt;br /&gt;
In general, the convergence with the &#039;&#039;&#039;k-grid&#039;&#039;&#039; is done after these variables are converged and, in principle, it is also independent of them. We invite you to change the number of k-points in the file &#039;&#039;&#039;gs_bn.py&#039;&#039;&#039; using the variable &#039;&#039;&#039;kpoints_nscf&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== GW calculation in regular k-grid ===&lt;br /&gt;
&lt;br /&gt;
From the bandgap convergence study made above for a &#039;&#039;&#039;k-grid&#039;&#039;&#039; we can decide reasonable parameters. Another option is to decide a convergence threshold to establish&lt;br /&gt;
the accuracy of the convergence. In this tutorial, in order to make calculations lighter, we have chosen the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EXXRLvcs = 60 Ry&lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp =  3  Ry&lt;br /&gt;
GbndRnge = 30 bands&lt;br /&gt;
QPkrange = [1,19,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can change the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; scripts to calculate a non self-consistent run for a larger &#039;&#039;&#039;k-grid&#039;&#039;&#039; (12x12x1 will do the job). We can also change the number of bands to 40 in order to speed up a bit the QE calculation.&lt;br /&gt;
&lt;br /&gt;
We can just simply run the code to calculate the GW corrections for all the points of the Brillouin zone by setting the converged parameters in the script &amp;lt;code&amp;gt;gw_bn.py&amp;lt;/code&amp;gt;. If we enter in the script we can check that we define a scheduler (the default is bash):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
scheduler = Scheduler.factory&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just need to define the run level and the variables we are going to chang:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
y = YamboIn.from_runlevel(&#039;%s -p p -g n -V all&#039;%yambo,folder=&#039;gw&#039;)&lt;br /&gt;
    &lt;br /&gt;
y[&#039;EXXRLvcs&#039;] = [60,&#039;Ry&#039;]       # Self-energy. Exchange&lt;br /&gt;
y[&#039;BndsRnXp&#039;] = [1,40]          # Screening. Number of bands&lt;br /&gt;
y[&#039;NGsBlkXp&#039;] = [3,&#039;Ry&#039;]        # Cutoff Screening&lt;br /&gt;
y[&#039;GbndRnge&#039;] = [1,30]          # Self-energy. Number of bands&lt;br /&gt;
y[&#039;QPkrange&#039;] = [kpoint_start,kpoint_end,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now run the script and obtain the GW in the full &#039;&#039;&#039;k-grid&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python gw_bn.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we will have inside the folder &amp;lt;code&amp;gt;gw/yambo&amp;lt;/code&amp;gt; the netCDF file &amp;lt;code&amp;gt;ndb.QP&amp;lt;/code&amp;gt; with the results of the GW calculation. We can analyze the results and/or use them in BSE calculations.&lt;br /&gt;
&lt;br /&gt;
=== Plotting GW calculations. Scissor operator and GW band structure  ===&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we can start using the yambopy analysis tools. For this purpose, we have created the script &amp;lt;code&amp;gt;plot-qp.py&amp;lt;/code&amp;gt;. Using this &lt;br /&gt;
script we will be able to read the Yambo databases and plot the results. Notice that we use matplotlib to make the plots. For all the plots we define a figure and axis by&lt;br /&gt;
doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fig = plt.figure(figsize=(6,4))&lt;br /&gt;
ax  = fig.add_axes( [ 0.20, 0.20, 0.70, 0.70 ])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file is structured as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A. Define a path&#039;&#039;&#039;. Using qepy we can define a path to plot the band structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
npoints = 10&lt;br /&gt;
path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
              [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
              [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
              [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;B. Read Yambo lattice and QP databases.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lat  = YamboSaveDB.from_db_file(folder=&#039;gw/SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;gw/yambo&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;C. Plot all QP eigenvalues.&#039;&#039;&#039; A very typical plot when analyzing GW calculations is the plot of the GW eigenvalues versus LDA eigenvalues. You just need to indicate which band index corresponds to the&lt;br /&gt;
top of the valence band.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
n_top_vb = 4&lt;br /&gt;
ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Scissor-gw.png|GW results (dots) and linear fitting (solid lines) |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;D. Plot exact QP-GW eigenvalues in a path.&#039;&#039;&#039; We can also plot the band structure of calculated points (not interpolated). Yambopy &lt;br /&gt;
will find which k-points belong to a given path. We can add the LDA results for comparison.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bands-not-interpolated.png|GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;E. Plot interpolated QP-GW eigenvalues in a path.&#039;&#039;&#039; In order to obtain results ready for publication or presentation, we can interpolate the GW calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:bands-interpolated.png| Interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;F. Comparison non-interpolated and interpolated results.&#039;&#039;&#039; It is convenient to check how good is the interpolation of GW results.&lt;br /&gt;
&lt;br /&gt;
[[File:check-interpolation.png| Exact and interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
=== GW convergence for all k-points ===&lt;br /&gt;
&lt;br /&gt;
If we want to perform GW convergence in all the band states, we can check the &lt;br /&gt;
script &amp;lt;code&amp;gt;plot-gw-conv.py&amp;lt;/code&amp;gt;. Here we plot the band structure for all the k-points. For this, we pack the results in json files and then use the analyzer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pack_files_in_folder(&#039;gw_conv&#039;)&lt;br /&gt;
ya = YamboAnalyser(&#039;gw_conv&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the case of the variable NGsBlkXs, we have set:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ya.plot_gw_all_kpoints_convergence(tag=&#039;NGsBlkXs&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Chi-cutoff-kpoints.png||500px]]&lt;br /&gt;
&lt;br /&gt;
=== Approximations of the dielectric function (COHSEX, PPA) ===&lt;br /&gt;
&lt;br /&gt;
We can use yambopy to examine different run levels. For instance, the approximations used to obtain the screening are the: (i) static screening or COHSEX, (ii) plasmon-pole approximations (PPA), or (iii) real axis integration. We have set the same parameters for the first two options, just changing the variable name for the number of bands and the cut-off of the screening.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
COHSEX&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXs = 40 bands&lt;br /&gt;
NGsBlkXs = 3 Ry&lt;br /&gt;
&lt;br /&gt;
PPA&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp = 3 Ry&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the converged parameters and the function works by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -x&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We plot the band structure using the analyzer explained above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -xp&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We observe a large difference between COHSEX and PPA.&lt;br /&gt;
&lt;br /&gt;
[[File:GW-COHSEX-PPA.png|GW bands calculated with the COHSEX and PPA|300px]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3287</id>
		<title>GW tutorial. Convergence and approximations (BN)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=GW_tutorial._Convergence_and_approximations_(BN)&amp;diff=3287"/>
		<updated>2020-01-16T16:35:16Z</updated>

		<summary type="html">&lt;p&gt;Alejandro: /* Approximations of the dielectric function (COHSEX, PPA) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
We have selected 2D hexagonal boron nitride to explain the use of yambopy. Along with this tutorial we show how to use yambopy to make efficient convergence tests, to compare different approximations and to analyze the results.&lt;br /&gt;
&lt;br /&gt;
=== Initial steps with Quantum Espresso ===&lt;br /&gt;
&lt;br /&gt;
Yambopy includes qepy, a module to handle QE-DFT calculations necessary to run Yambo.&lt;br /&gt;
&lt;br /&gt;
The initial step consists of a self-consistent (scf) ground state calculation together with a non-self-consistent (nscf) calculation with QE using the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py&lt;br /&gt;
python gs_bn.py -sn&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the non-self-consistent run with a wave-function cutoff of &#039;&#039;&#039;60 Ry, 70 bands and a k-grid of &amp;lt;code&amp;gt;12x12x1&amp;lt;/code&amp;gt;&#039;&#039;&#039; for Yambo calculations.&lt;br /&gt;
&lt;br /&gt;
In addition, we can check if we get a reasonable band structure for our many-body calculations. We can define a path, for instance, in an hexagonal Brillouin zone:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
p = Path([ [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
           [[0.5, 0.0, 0.0],&#039;M&#039;],&lt;br /&gt;
           [[1./3,1./3,0.0],&#039;K&#039;],&lt;br /&gt;
           [[0.0, 0.0, 0.0],&#039;$\Gamma$&#039;]], [int(10*2),int(10),int(sqrt(5)*10)])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We obtain the band structure by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gs_bn.py -b&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Plot-bn-band.png|BN Band Structure|500px]]&lt;br /&gt;
&lt;br /&gt;
The horizontal line marks the top of the valence band. The electronic bandgap has a value of 4.73 eV. In the next sections, we will show how to calculate the GW correction and the excitonic effects with BSE using Yambo in an automatic way.&lt;br /&gt;
&lt;br /&gt;
=== GW convergence of the bandgap ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(a) Calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We converge the main parameters of a GW calculation independently. In addition, we make use of the plasmon pole approximation for the dielectric function, and the Newton solver to find the GW correction to the LDA eigenvalues. We converge the band gap of BN (difference in energy of the bottom of the conduction and top of the valence band at the K point of the Brillouin zone). We have designed the script &#039;&#039;&#039;gw_conv_bn.py&#039;&#039;&#039; (folder ~/tutorial/bn) for this purpose.&lt;br /&gt;
&lt;br /&gt;
We can select the GW calculation by calling the &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; with the corresponding arguments:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;y = YamboIn.from_runlevel(&#039;yambo -d -p p -g n -V all&#039;,folder=&#039;gw_conv&#039;)&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The main variables of a GW calculation are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;EXXRLvcs&amp;lt;/code&amp;gt;: Exchange self-energy cutoff&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NGsBlkXp&amp;lt;/code&amp;gt;: Cutoff of the dielectric function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;BndsRnXp&amp;lt;/code&amp;gt;: Number of bands in the calculation of the dielectric function (PPA).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GbndRnge&amp;lt;/code&amp;gt;: Self-energy. The number of bands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We define a dictionary with all the parameters that we want to converge. Be aware of setting the right units and format for each parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;conv = { &#039;EXXRLvcs&#039;: [[10,10,20,30,40,50,60,70,80,90,100],&#039;Ry&#039;],&lt;br /&gt;
         &#039;NGsBlkXp&#039;: [[0,0,1,2,3,4,5,6], &#039;Ry&#039;],&lt;br /&gt;
         &#039;BndsRnXp&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] ,&lt;br /&gt;
         &#039;GbndRnge&#039;: [[[1,10],[1,10],[1,20],[1,30],[1,40],[1,50],[1,60],[1,70]],&#039;&#039;] }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The class &amp;lt;code&amp;gt;YamboIn&amp;lt;/code&amp;gt; includes the function &amp;lt;code&amp;gt;optimize&amp;lt;/code&amp;gt;, which is called here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
y.optimize(conv,folder=&#039;gw_conv&#039;,run=run,ref_run=False)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function optimize has two main arguments: the convergence dictionary, and a function &#039;&#039;&#039;run&#039;&#039;&#039; with the instructions to run&lt;br /&gt;
the calculation, defined in our case like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
    def run(filename):&lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; Function to be called by the optimize function &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
        folder = filename.split(&#039;.&#039;)[0]&lt;br /&gt;
        print(filename,folder)&lt;br /&gt;
        shell = bash() &lt;br /&gt;
        shell.add_command(&#039;cd gw_conv&#039;)&lt;br /&gt;
        shell.add_command(&#039;rm -f *.json %s/o-*&#039;%folder) #cleanup&lt;br /&gt;
        shell.add_command(&#039;%s -F %s -J %s -C %s 2&amp;gt; %s.log&#039;%(yambo,filename,folder,folder,folder))&lt;br /&gt;
        shell.run()&lt;br /&gt;
        shell.clean()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have defined interactive run, in the folder &amp;lt;code&amp;gt;gw_conv&amp;lt;/code&amp;gt;. We have also defined the name for each job, associated with the variable and its value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(b) Analysis&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once all the calculations are finished it&#039;s time to analyse them. At this point yambopy will facilitate the analysis. Besides &lt;br /&gt;
the python module, &amp;lt;code&amp;gt;yambopy&amp;lt;/code&amp;gt; can also be called in the terminal to perform some post-analysis tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
     $ yambopy&lt;br /&gt;
     analysebse -&amp;gt;     Using ypp, you can study the convergence of BSE calculations in 2 ways:&lt;br /&gt;
       plotem1s -&amp;gt;     Plot em1s calculation&lt;br /&gt;
      analysegw -&amp;gt;     Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
        mergeqp -&amp;gt;     Merge QP databases&lt;br /&gt;
           test -&amp;gt;     Run yambopy tests&lt;br /&gt;
   plotexcitons -&amp;gt;     Plot excitons calculation&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Calling &amp;lt;code&amp;gt;yambopy analysegw&amp;lt;/code&amp;gt; will display the help of the function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    Study the convergence of GW calculations by looking at the change in bandgap value.&lt;br /&gt;
&lt;br /&gt;
    The script reads from &amp;lt;folder&amp;gt; all results from &amp;lt;variable&amp;gt; calculations and display them.&lt;br /&gt;
&lt;br /&gt;
    Use the band and k-point options according to the size of your k-grid&lt;br /&gt;
    and the location of the band extrema.&lt;br /&gt;
&lt;br /&gt;
        Mandatory arguments are:&lt;br /&gt;
            folder   -&amp;gt; Folder containing SAVE and convergence runs.&lt;br /&gt;
            var      -&amp;gt; Variable tested (e.g. FFTGvecs)&lt;br /&gt;
&lt;br /&gt;
        Optional variables are:&lt;br /&gt;
            -bc, --bandc   (int)  -&amp;gt; Lowest conduction band number&lt;br /&gt;
            -kc, --kpointc (int)  -&amp;gt; k-point index for conduction band&lt;br /&gt;
            -bv, --bandv   (int)  -&amp;gt; Highest valence band number&lt;br /&gt;
            -kv, --kpointv (int)  -&amp;gt; k-point index for valence band&lt;br /&gt;
            -np, --nopack  (flag) -&amp;gt; Do not call &#039;pack_files_in_folder&#039;&lt;br /&gt;
            -nt, --notext  (flag) -&amp;gt; Do not print a text file&lt;br /&gt;
            -nd, --nodraw  (flag) -&amp;gt; Do not draw (plot) the result&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the function selecting the bands and k-points, together with the parameter of convergence we will obtain the convergence plot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv EXXRLvcs &lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv NGsBlkXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv BndsRnXp&lt;br /&gt;
yambopy analysegw -bc 5 -kc 7 -bv 4 -kv 7 gw_conv GbndRnge&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the convergence plots, we can choose the set of converged parameters and repeat the calculation for finer k-grids until we reach convergence with the k-points. We have&lt;br /&gt;
intentionally used non-converged parameters. Nevertheless, along this week&lt;br /&gt;
you should have gotten enough expertise to push the convergence of the parameters&lt;br /&gt;
and determine the correct convergence set of parameters.&lt;br /&gt;
We invite you to enter in the python script, increase the parameters and check&lt;br /&gt;
again the convergence for larger values!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:EXXRLvcs.png|FFTGvecs|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:NGsBlkXp.png|NGsBlkXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:BndsRnXp.png|BndsRnXp|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:GbndRnge2.png|GbndRnge|300px]]&lt;br /&gt;
&lt;br /&gt;
In general, the convergence with the &#039;&#039;&#039;k-grid&#039;&#039;&#039; is done after these variables are converged and, in principle, it is also independent of them. We invite you to change the number of k-points in the file &#039;&#039;&#039;gs_bn.py&#039;&#039;&#039; using the variable &#039;&#039;&#039;kpoints_nscf&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== GW calculation in regular k-grid ===&lt;br /&gt;
&lt;br /&gt;
From the bandgap convergence study made above for a &#039;&#039;&#039;k-grid&#039;&#039;&#039; we can decide reasonable parameters. Another option is to decide a convergence threshold to establish&lt;br /&gt;
the accuracy of the convergence. In this tutorial, in order to make calculations lighter, we have chosen the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
EXXRLvcs = 60 Ry&lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp =  3  Ry&lt;br /&gt;
GbndRnge = 30 bands&lt;br /&gt;
QPkrange = [1,19,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can change the &amp;lt;code&amp;gt;gs_bn.py&amp;lt;/code&amp;gt; scripts to calculate a non self-consistent run for a larger &#039;&#039;&#039;k-grid&#039;&#039;&#039; (12x12x1 will do the job). We can also change the number of bands to 40 in order to speed up a bit the QE calculation.&lt;br /&gt;
&lt;br /&gt;
We can just simply run the code to calculate the GW corrections for all the points of the Brillouin zone by setting the converged parameters in the script &amp;lt;code&amp;gt;gw_bn.py&amp;lt;/code&amp;gt;. If we enter in the script we can check that we define a scheduler (the default is bash):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
scheduler = Scheduler.factory&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We just need to define the run level and the variables we are going to chang:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
y = YamboIn.from_runlevel(&#039;%s -p p -g n -V all&#039;%yambo,folder=&#039;gw&#039;)&lt;br /&gt;
    &lt;br /&gt;
y[&#039;EXXRLvcs&#039;] = [60,&#039;Ry&#039;]       # Self-energy. Exchange&lt;br /&gt;
y[&#039;BndsRnXp&#039;] = [1,40]          # Screening. Number of bands&lt;br /&gt;
y[&#039;NGsBlkXp&#039;] = [3,&#039;Ry&#039;]        # Cutoff Screening&lt;br /&gt;
y[&#039;GbndRnge&#039;] = [1,30]          # Self-energy. Number of bands&lt;br /&gt;
y[&#039;QPkrange&#039;] = [kpoint_start,kpoint_end,2,6]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now run the script and obtain the GW in the full &#039;&#039;&#039;k-grid&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python gw_bn.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we will have inside the folder &amp;lt;code&amp;gt;gw/yambo&amp;lt;/code&amp;gt; the netCDF file &amp;lt;code&amp;gt;ndb.QP&amp;lt;/code&amp;gt; with the results of the GW calculation. We can analyze the results and/or use them in BSE calculations.&lt;br /&gt;
&lt;br /&gt;
=== Plotting GW calculations. Scissor operator and GW band structure  ===&lt;br /&gt;
&lt;br /&gt;
If everything has worked fine now we can start using the yambopy analysis tools. For this purpose, we have created the script &amp;lt;code&amp;gt;plot-qp.py&amp;lt;/code&amp;gt;. Using this &lt;br /&gt;
script we will be able to read the Yambo databases and plot the results. Notice that we use matplotlib to make the plots. For all the plots we define a figure and axis by&lt;br /&gt;
doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fig = plt.figure(figsize=(6,4))&lt;br /&gt;
ax  = fig.add_axes( [ 0.20, 0.20, 0.70, 0.70 ])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file is structured as follows:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A. Define a path&#039;&#039;&#039;. Using qepy we can define a path to plot the band structure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
npoints = 10&lt;br /&gt;
path = Path([ [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;],&lt;br /&gt;
              [[  0.5,  0.0,  0.0],&#039;M&#039;],&lt;br /&gt;
              [[1./3.,1./3.,  0.0],&#039;K&#039;],&lt;br /&gt;
              [[  0.0,  0.0,  0.0],&#039;$\Gamma$&#039;]], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;B. Read Yambo lattice and QP databases.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
lat  = YamboSaveDB.from_db_file(folder=&#039;gw/SAVE&#039;,filename=&#039;ns.db1&#039;)&lt;br /&gt;
ydb  = YamboQPDB.from_db(filename=&#039;ndb.QP&#039;,folder=&#039;gw/yambo&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;C. Plot all QP eigenvalues.&#039;&#039;&#039; A very typical plot when analyzing GW calculations is the plot of the GW eigenvalues versus LDA eigenvalues. You just need to indicate which band index corresponds to the&lt;br /&gt;
top of the valence band.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
n_top_vb = 4&lt;br /&gt;
ydb.plot_scissor_ax(ax,n_top_vb)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Scissor-gw.png|GW results (dots) and linear fitting (solid lines) |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;D. Plot exact QP-GW eigenvalues in a path.&#039;&#039;&#039; We can also plot the band structure of calculated points (not interpolated). Yambopy &lt;br /&gt;
will find which k-points belong to a given path. We can add the LDA results for comparison.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ks_bs_0, qp_bs_0 = ydb.get_bs_path(lat,path)&lt;br /&gt;
ks_bs_0.plot_ax(ax,legend=True,color_bands=&#039;r&#039;,label=&#039;KS&#039;)&lt;br /&gt;
qp_bs_0.plot_ax(ax,legend=True,color_bands=&#039;b&#039;,label=&#039;QP-GW&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bands-not-interpolated.png|GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;E. Plot interpolated QP-GW eigenvalues in a path.&#039;&#039;&#039; In order to obtain results ready for publication or presentation, we can interpolate the GW calculations.&lt;br /&gt;
&lt;br /&gt;
[[File:bands-interpolated.png| Interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;F. Comparison non-interpolated and interpolated results.&#039;&#039;&#039; It is convenient to check how good is the interpolation of GW results.&lt;br /&gt;
&lt;br /&gt;
[[File:check-interpolation.png| Exact and interpolated GW and LDA band structures |300px]]&lt;br /&gt;
&lt;br /&gt;
=== GW convergence for all k-points ===&lt;br /&gt;
&lt;br /&gt;
If we want to perform GW convergence in all the band states, we can check the &lt;br /&gt;
script &amp;lt;code&amp;gt;plot-gw-conv.py&amp;lt;/code&amp;gt;. Here we plot the band structure for all the k-points. For this, we pack the results in json files and then use the analyzer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
pack_files_in_folder(&#039;gw_conv&#039;)&lt;br /&gt;
ya = YamboAnalyser(&#039;gw_conv&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the case of the variable NGsBlkXs, we have set:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ya.plot_gw_all_kpoints_convergence(tag=&#039;NGsBlkXs&#039;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Chi-cutoff-kpoints.png||500px]]&lt;br /&gt;
&lt;br /&gt;
=== Approximations of the dielectric function (COHSEX, PPA) ===&lt;br /&gt;
&lt;br /&gt;
We can use yambopy to examine different run levels. For instance, the approximations used to obtain the screening are the: (i) static screening or COHSEX, (ii) plasmon-pole approximations (PPA), or (iii) real axis integration. We have set the same parameters for the first two options, just changing the variable name for the number of bands and the cut-off of the screening.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
COHSEX&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXs = 40 bands&lt;br /&gt;
NGsBlkXs = 3 Ry&lt;br /&gt;
&lt;br /&gt;
PPA&lt;br /&gt;
EXXRLvcs = 60 Ry &lt;br /&gt;
BndsRnXp = 40 bands&lt;br /&gt;
NGsBlkXp = 3 Ry&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have set the converged parameters and the function works by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -x&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We plot the band structure using the analyzer explained above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;python gw_conv_bn.py -xp&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We observe a large difference between COHSEX and PPA.&lt;br /&gt;
&lt;br /&gt;
[[File:GW-cohsex-ppa-ra.png|GW bands calculated with the COHSEX, PPA and RA|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:GW-COHSEX-PPA.png|GW bands calculated with the COHSEX and PPA|300px]]&lt;/div&gt;</summary>
		<author><name>Alejandro</name></author>
	</entry>
</feed>