<?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=DarioAlejandro</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=DarioAlejandro"/>
	<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Special:Contributions/DarioAlejandro"/>
	<updated>2026-05-26T08:09:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6763</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6763"/>
		<updated>2023-05-19T17:08:50Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.2)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the type of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try tuning better the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be noticed, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. As an example, for the diagonal elements, W evaluated on the imaginary axis should be real and therefore&lt;br /&gt;
unfulfilled modes are those for which the interpolated PPA pole is instead imaginary. Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6729</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6729"/>
		<updated>2023-05-19T13:38:41Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 1: Run MPA and compare with PPA and FF-RA calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the type of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try tuning better the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be noticed, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. As an example, for the diagonal elements, W evaluated on the imaginary axis should be real and therefore&lt;br /&gt;
unfulfilled modes are those for which the interpolated PPA pole is instead imaginary. Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6727</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6727"/>
		<updated>2023-05-19T13:32:40Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the type of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be noticed, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. As an example, for the diagonal elements, W evaluated on the imaginary axis should be real and therefore&lt;br /&gt;
unfulfilled modes are those for which the interpolated PPA pole is instead imaginary. Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6726</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6726"/>
		<updated>2023-05-19T13:24:14Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the type of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. As an example, for the diagonal elements, W evaluated on the imaginary axis should be real and therefore&lt;br /&gt;
unfulfilled modes are those for which the interpolated PPA pole is instead imaginary. Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6725</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6725"/>
		<updated>2023-05-19T13:21:36Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the type of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6721</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6721"/>
		<updated>2023-05-19T12:49:03Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* How to generate inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the type of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6720</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6720"/>
		<updated>2023-05-19T12:47:06Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Brief introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concepts to be familiarized with include the design of samplings in the complex frequency plane, the methods to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6719</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6719"/>
		<updated>2023-05-19T12:46:33Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Brief introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integrations on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concept to be familiarized with include the design of samplings in the complex frequency plane, the method to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6718</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6718"/>
		<updated>2023-05-19T12:45:42Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to the plasmon-pole approximation (PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integration on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concept to be familiarized with include the design of samplings in the complex frequency plane, the method to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6717</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6717"/>
		<updated>2023-05-19T12:38:57Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Brief introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to ths plasmon-pole approximation(PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integration on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concept to be familiarized with include the design of samplings in the complex frequency plane, the method to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6716</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6716"/>
		<updated>2023-05-19T12:38:33Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Brief introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to ths plasmon-pole approximation(PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integration on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concept to be familiarized with include the design of samplings in the complex frequency plane, the method to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
A more detailed description can be found in the papers presenting the MPA method:&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.104.115157 Phys. Rev. B 104, 115157 (2021)]&lt;br /&gt;
[https://journals.aps.org/prb/abstract/10.1103/PhysRevB.107.155130 Phys. Rev. B 107, 155130 (2023)]&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6715</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6715"/>
		<updated>2023-05-19T12:34:16Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to ths plasmon-pole approximation(PPA) and numerical full frequency (FF) methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integration on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concept to be familiarized with include the design of samplings in the complex frequency plane, the method to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6713</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6713"/>
		<updated>2023-05-19T12:32:35Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Brief introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation (MPA) is a technique to address the frequency convolution in the GW self-energy analytically. It can be thought as a generalization of the plasmon-pole approximation (PPA) able to provide full-frequency accuracy at a much lower computational cost than other methods like numerical full frequency integration on the real axis (FF-RA).&lt;br /&gt;
&lt;br /&gt;
The main concept to be familiarized with include the design of samplings in the complex frequency plane, the method to solve the non-linear MPA interpolation, the treatment of unfulfilled modes, and how to run calculations to compute quasi-particle energies and the frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6712</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6712"/>
		<updated>2023-05-19T12:24:31Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will find that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6711</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6711"/>
		<updated>2023-05-19T12:23:21Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for their time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constraint has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label in the input file. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6710</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6710"/>
		<updated>2023-05-19T12:21:05Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22. There is a third variable accounting for the percentage of fulfilled modes with a wrong time ordering. This variable is usually around 50%, since PPA drops the imaginary part of the poles and does&#039;t really account for the time ordering.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case, which also forces all the poles to be compliant with the time ordering. In order to count the unfulfilled modes we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6708</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6708"/>
		<updated>2023-05-19T12:14:58Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the mean relative deviation to 0.08. In the cases with more than one pole the generalized condition may result in the reduction of the number of poles for a specific matrix element, there is an additional variable in the report accounting for the mean pole reduction in the given matrix.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can also compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases like this, where the treatment of the unfulfilled modes is important, MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6707</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6707"/>
		<updated>2023-05-19T12:07:48Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 1: Run MPA and compare with PPA and FF-RA calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials on bulk hBN the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases like this where the treatment of the unfulfilled modes is important MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6706</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6706"/>
		<updated>2023-05-19T12:03:18Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation and check the output results&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases like this where the treatment of the unfulfilled modes is important MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6705</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6705"/>
		<updated>2023-05-19T12:02:23Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases like this where the treatment of the unfulfilled modes is important MPA with a single pole already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6702</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6702"/>
		<updated>2023-05-19T12:01:34Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;br /&gt;
You will see that in cases where the treatment of the unfulfilled modes is important MPA with a single poles already improves the PPA results:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 7                  8                -0.411876          -0.346001           2.615150&lt;br /&gt;
 7                  9                 3.877976           1.056318          -3.880004&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6700</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6700"/>
		<updated>2023-05-19T11:57:40Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 2: Run self-energy calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6699</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6699"/>
		<updated>2023-05-19T11:57:11Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 2: Run self-energy calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffrr_SG.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpar_SG.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6698</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6698"/>
		<updated>2023-05-19T11:56:12Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;br /&gt;
&lt;br /&gt;
Then run the calculation&lt;br /&gt;
 $ yambo -F mpa1.in -J mp1_r0-0i0-1Ha_x3Ry_b100&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6697</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6697"/>
		<updated>2023-05-19T11:54:28Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 0.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   0.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  2                             # [Xm] Total Energy steps&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6696</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6696"/>
		<updated>2023-05-19T11:52:51Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of MPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6695</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6695"/>
		<updated>2023-05-19T11:51:51Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;br /&gt;
You can see that already with 2 poles the number of unfulfilled modes is reduced to 8% and the relative to 0.08.&lt;br /&gt;
&lt;br /&gt;
Since MPA uses an improved condition to fix the nonphysical poles, we can compare the case of mPA with a single pole with PPA. In order to do so we need to modify the sampling to make it consistent to the one used in PPA.&lt;br /&gt;
Let&#039;s make a copy of the input:&lt;br /&gt;
 $ cp mpa.in mpa1.in&lt;br /&gt;
and set the sampling in mpa1.in as follows:&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6692</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6692"/>
		<updated>2023-05-19T11:28:58Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file from 2 to 10:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
Now we can check the report file r-mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa&lt;br /&gt;
   :: Current Q-pt index     : 1&lt;br /&gt;
   :: Number of poles  : 2&lt;br /&gt;
   :: PP cond fix/tot      :  0.081406&lt;br /&gt;
   :: Mean np reduction    :  0.000000&lt;br /&gt;
   :: Mean Xm rel dev      :  0.079866&lt;br /&gt;
   ...&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6690</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6690"/>
		<updated>2023-05-19T11:25:59Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file from 2 to 10:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
and then&lt;br /&gt;
 $ yambo -F mpa.in -J mp2_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6689</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6689"/>
		<updated>2023-05-19T11:20:45Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles in the mpa.in file from 2 to 10:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6688</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6688"/>
		<updated>2023-05-19T11:20:02Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles from 2 to 10:&lt;br /&gt;
 ETStpsXm=  4                             # [Xm] Total Energy steps&lt;br /&gt;
 mpERdb                                   # [Xm] Write to disk MPA poles and residues&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6687</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6687"/>
		<updated>2023-05-19T11:18:51Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to run the MPA calculation switching on the mpERdb label. Let&#039;s also change the number of poles from 2 to 10:&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6686</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6686"/>
		<updated>2023-05-19T11:17:15Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled modes. In the PPA case the energy of the failing poles is set to a fixed value of 1 Ha, which produces a mean relative standard deviation of 0.22.&lt;br /&gt;
&lt;br /&gt;
The condition controlling the fulfillment of the constrain has been generalized to a multipole expression for the MPA case. In order to check it we need to repeat the calculation switching on the mpERdb label.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6685</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6685"/>
		<updated>2023-05-19T11:11:59Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes for each q point.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines corresponding to the first q point:&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;br /&gt;
In the Exercise 1 we have set the cutoff energy for the size of the polarizability matrix to 3000 mRy, which corresponds to a matrices of dimension 37. In the report we can see that the 22% of these matrix elements are identified as unfulfilled. In the PPA case the failing poles are set to a fixed value of 1 Ha, which produce a mean relative standard deviation of 0.22.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6672</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6672"/>
		<updated>2023-05-19T10:07:51Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s open the file r-pp1_i1Ha_x3Ry_b100_HF_and_locXC_gw0_em1d_ppa and check the following lines&lt;br /&gt;
   Current Q-pt index             :  1&lt;br /&gt;
   :: PP condition fails/total    :  0.216216&lt;br /&gt;
   :: Time ordering fails/rest    :  0.500466&lt;br /&gt;
   :: Mean rel dev of PP cond     :  0.216203&lt;br /&gt;
   Current Q-pt index             :  2&lt;br /&gt;
   ...&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6671</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6671"/>
		<updated>2023-05-19T10:06:19Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W. ... Since the current implementation of Yambo it is possible to check in the report file some information about unfulfilled modes.&lt;br /&gt;
&lt;br /&gt;
Le&#039;s open the file _HF_and_locXC_gw0_em1d_ppa and check the following lines&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6667</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6667"/>
		<updated>2023-05-19T09:53:39Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 1: Run MPA and compare with PPA and FF-RA calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                            # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6666</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6666"/>
		<updated>2023-05-19T09:53:24Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 1: Run MPA and compare with PPA and FF-RA calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                  Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |             eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                           # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                           # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                           # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |              Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |              Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |              Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                            # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                           # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                  # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6665</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6665"/>
		<updated>2023-05-19T09:52:25Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 1: Run MPA and compare with PPA and FF-RA calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000                 Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |            eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                           # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                          # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                          # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |             Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |             Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |             Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                           # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                          # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                                 # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6664</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6664"/>
		<updated>2023-05-19T09:51:20Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* How to generate inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                       # [R] GW approximation&lt;br /&gt;
 mpa                                       # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6663</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6663"/>
		<updated>2023-05-19T09:51:02Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* How to generate inputs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                                  # [R] GW approximation&lt;br /&gt;
 mpa                                  # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6660</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6660"/>
		<updated>2023-05-19T09:49:57Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6657</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6657"/>
		<updated>2023-05-19T09:48:33Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 2: Run self-energy calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Let&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6656</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6656"/>
		<updated>2023-05-19T09:45:42Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 3: Count unfulfilled modes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;br /&gt;
We can now examine one of the problems of PPA that concerns the fulfillment of a physical constraint for the poles of W.&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6655</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6655"/>
		<updated>2023-05-19T09:39:10Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 2: Run self-energy calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6654</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6654"/>
		<updated>2023-05-19T09:38:40Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: /* Exercise 2: Run self-energy calculations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
The results for both quasi-particles will be similar to these:&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6653</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6653"/>
		<updated>2023-05-19T09:37:44Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;br /&gt;
&lt;br /&gt;
Notice that PPA is only accurate in a zone of the tail of the self-energy corresponding to the quasi-particle peak, while MPA captures all the features in the whole frequency range, including the satellite structures.&lt;br /&gt;
&lt;br /&gt;
== Exercise 3: Count unfulfilled modes ==&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6652</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6652"/>
		<updated>2023-05-19T09:29:19Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
&lt;br /&gt;
Self-energy:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
Spectral function:&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:4 w lp&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6651</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6651"/>
		<updated>2023-05-19T09:27:03Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
&lt;br /&gt;
[[File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
	<entry>
		<id>https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6650</id>
		<title>Quasi-particles and Self-energy within the Multipole Approximation (MPA)</title>
		<link rel="alternate" type="text/html" href="https://wiki.yambo-code.eu/wiki/index.php?title=Quasi-particles_and_Self-energy_within_the_Multipole_Approximation_(MPA)&amp;diff=6650"/>
		<updated>2023-05-19T09:25:20Z</updated>

		<summary type="html">&lt;p&gt;DarioAlejandro: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this tutorial you will learn how to use the Multipole Approximation (MPA)&lt;br /&gt;
for the frequency description in GW as an alternative to PPA and FF methods.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;yambo&amp;lt;/code&amp;gt; executable (version 5.xx)&lt;br /&gt;
* &amp;lt;code&amp;gt;gnuplot&amp;lt;/code&amp;gt;, for making plots&lt;br /&gt;
* Having completed the following tutorials:&lt;br /&gt;
[[First steps: a walk through from DFT to optical properties]]&lt;br /&gt;
&lt;br /&gt;
[[How to obtain the quasi-particle band structure of a bulk material: h-BN]]&lt;br /&gt;
&lt;br /&gt;
== Brief introduction ==&lt;br /&gt;
The multipole approximation is a technique to address the frequency convolution in the GW self-energy analytically...&lt;br /&gt;
&lt;br /&gt;
== How to generate inputs ==&lt;br /&gt;
Setting a G0W0 calculation with MPA can be done in a similar way to PPA or FF-RA by using the following command&lt;br /&gt;
 $ yambo -gw0 m&lt;br /&gt;
You will recognize the kind of calculation in the first lines of the generated input:&lt;br /&gt;
&lt;br /&gt;
 gw0                              # [R] GW approximation&lt;br /&gt;
 mpa                              # [R][Xm] Multi Pole Approximation for the Screened Interaction&lt;br /&gt;
&lt;br /&gt;
It can be combined with other command as well. Let&#039;s define for instance an input with a specific name for an MPA calculation setting the treatment of the Coulomb potential and verbosity for parallelization:&lt;br /&gt;
 $ yambo -F mpa_rimV_par.in -gw0 m -r -V par&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now generate the following inputs for PPA, MPA and FF-RA calculations:&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r&lt;br /&gt;
&lt;br /&gt;
We can compare the variables corresponding to the different descriptions of the frequency dependence. You may be familiar with PPA from previous tutorials. In this case the polarizability operator, from where W is computed, is numerically evaluated in two frequencies, z = 0, and a pure imaginary frequency &amp;lt;code&amp;gt;[[Variables#PPAPntXp|PPAPntXp]]&amp;lt;/code&amp;gt; set by default to 1 Ha, from where the parameters of the plasmon pole model are interpolated. &lt;br /&gt;
&lt;br /&gt;
In the full frequency case, the polarizability is evaluated on a grid of frequencies along the real axis. The variable &amp;lt;code&amp;gt;[[ETStpsXd]]&amp;lt;/code&amp;gt; set by default to 100 define the number of frequency points of the grid, while the variable &amp;lt;code&amp;gt;[[DmRngeXd]]&amp;lt;/code&amp;gt; corresponds to a damping parameter. As described in the tutorials for optical calculations, it is also possible to specify the energy range along the real frequency axis by setting the variable &amp;lt;code&amp;gt;[[EnRngeXd]]&amp;lt;/code&amp;gt;, otherwise it is automatically set to the largest energy transition.&lt;br /&gt;
&lt;br /&gt;
At variance with PPA and FF-RA, MPA uses a sampling in the complex frequency plane. You will find similar variables in the MPA input to control the sampling. In this case, &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; define the number of frequency points, which is equivalent to twice the number of poles used in the MPA model, so it should be set to an even number. &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the real frequency axis, while &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; is the energy range along the imaginary axis, which is set by default to 1 Ha similarly to the PPA case. In case the so called &amp;quot;double parallel sampling&amp;quot; is used, &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; specifies the imaginary shifts of the sampling branch closer to the real frequency axis: the first shift corresponds to the first point only while the second shift to the rest of the points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise 1: Run MPA and compare with PPA, and FF-RA calculations ==&lt;br /&gt;
Since we are only interested in the different frequency description with PPA, MPA and FF-RA, we can fix the unrelated parameters to the default or to a reasonable value. Let&#039;s take for example the PPA input and set&lt;br /&gt;
&lt;br /&gt;
 EXXRLvcs=  3187                    RL    # [XX] Exchange    RL components&lt;br /&gt;
 VXCRLvcs=  3187                    RL    # [XC] XCpotential RL components&lt;br /&gt;
 % BndsRnXp&lt;br /&gt;
    1 | 100 |                             # [Xm] Polarization function bands&lt;br /&gt;
 %&lt;br /&gt;
 NGsBlkXp= 3000                    mRy    # [Xm] Response block size&lt;br /&gt;
 % LongDrXp&lt;br /&gt;
  1.000000 | 1.000000 | 1.000000 |        # [Xm] [cc] Electric Field&lt;br /&gt;
 %&lt;br /&gt;
 % GbndRnge&lt;br /&gt;
    1 | 100 |                             # [GW] G[W] bands range&lt;br /&gt;
 %&lt;br /&gt;
 DysSolver= &amp;quot;n&amp;quot;                           # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 %QPkrange                                # [GW] QP generalized Kpoint/Band indices&lt;br /&gt;
 7|7|8|9|&lt;br /&gt;
&lt;br /&gt;
Notice that similarly to other tutorials the range of quasi-particles corresponds to the direct gap of the system, i.e. bands 8 and 9 at the k-point number 7 in the &amp;lt;code&amp;gt;[[QPkrange]]&amp;lt;/code&amp;gt; variable. We set the same values for the analogous variables in the MPA and FF-RA inputs: &amp;lt;code&amp;gt;[[BndsRnXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[BndsRnXp]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[LongDrXm]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXd]]&amp;lt;/code&amp;gt; = &amp;lt;code&amp;gt;[[LongDrXp]]&amp;lt;/code&amp;gt;. Let&#039;s now set the variables related to frequency. &lt;br /&gt;
&lt;br /&gt;
In the case of PPA input set&lt;br /&gt;
 PPAPntXp= 1.00000              Ha    # [Xp] PPA imaginary energy&lt;br /&gt;
or leave the default value in eV.&lt;br /&gt;
&lt;br /&gt;
In the FF_RA input set&lt;br /&gt;
 % DmRngeXd&lt;br /&gt;
  0.200000 | 0.200000 |         eV    # [Xd] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXd= 400                        # [Xd] Total Energy steps&lt;br /&gt;
By varying the number of frequencies in intervals of 50 you can check the convergence of this parameter set to 400.&lt;br /&gt;
&lt;br /&gt;
In the MPA input set&lt;br /&gt;
 EnSampXm= &amp;quot;2l&amp;quot;                       # [Xm] Frequency sampling in the complex plane (&amp;quot;1l&amp;quot; one line, &amp;quot;2l&amp;quot; two lines)&lt;br /&gt;
 EnGridXm= &amp;quot;lP&amp;quot;                       # [Xm] Partition along the real axis (&amp;quot;ho&amp;quot; homogeneous, &amp;quot;lP&amp;quot; linear, &amp;quot;qP&amp;quot; quadratic, &amp;quot;cP&amp;quot; cubic)&lt;br /&gt;
 % EnRngeXm&lt;br /&gt;
   0.00000 | 4.00000 |          Ha    # [Xm] Energy range&lt;br /&gt;
 %&lt;br /&gt;
 % ImRngeXm&lt;br /&gt;
   1.00000 | 1.00000 |          Ha    # [Xm] Imaginary range&lt;br /&gt;
 %&lt;br /&gt;
 % DmRngeXm&lt;br /&gt;
   0.00000 | 0.10000 |          Ha    # [Xm] Damping range&lt;br /&gt;
 %&lt;br /&gt;
 ETStpsXm=  16                        # [Xm] Total Energy steps&lt;br /&gt;
 IntSolXm= &amp;quot;PT&amp;quot;                       # [Xm] MPA interpolation solver (&amp;quot;LA&amp;quot; linear algebra, &amp;quot;PT&amp;quot; Pade-Thiele)&lt;br /&gt;
 #mpERdb                              # [Xm] Write to disk MPA poles and residues&lt;br /&gt;
Minimal explanation of the MPA input variables:&lt;br /&gt;
&lt;br /&gt;
The value of the &amp;lt;code&amp;gt;[[EnSampXm]]&amp;lt;/code&amp;gt; variable corresponds to two lines defining a double parallel sampling, the &amp;lt;code&amp;gt;[[EnGridXm]]&amp;lt;/code&amp;gt; variable defines the type of distribution of points along the real frequency axis, we are using a linear partition in power of 2 as the default value.&lt;br /&gt;
 &lt;br /&gt;
The maximum of the real frequency range, &amp;lt;code&amp;gt;[[EnRngeXm]]&amp;lt;/code&amp;gt;, has been set to 4 Ha, a value slightly below the most energetic transition with 100 bands, which has a value of 123.8 eV (4.55 Ha). You can check that the results are not much sensitive to varying the range from the energy of the larger transition to half its value. The imaginary component &amp;lt;code&amp;gt;[[ImRngeXm]]&amp;lt;/code&amp;gt; has been set to the same default value of 1 Ha used in the PPA input, while the shifts &amp;lt;code&amp;gt;[[DmRngeXm]]&amp;lt;/code&amp;gt; have been set to their defaults too, 0 and 0.1 Ha. &lt;br /&gt;
&lt;br /&gt;
The variable &amp;lt;code&amp;gt;[[ETStpsXm]]&amp;lt;/code&amp;gt; is set to 16 frequency points corresponding to a model with 8 poles, as commented above. You can try to use a different number of poles and check that the selected value is reasonable. Be aware that the parameters controlling the MPA sampling need to be chosen with care according to the specific system and that they can&#039;t be converged with standard procedures, for example, a larger number of poles does not always lead to a more accurate result.&lt;br /&gt;
&lt;br /&gt;
The input variable &amp;lt;code&amp;gt;[[IntSolXm]]&amp;lt;/code&amp;gt; selects between the two possible solvers for the interpolation of the MPA model. Mathematically both are equivalent, although due to the non-linear nature of the system of equations, numerical instabilities may arise specially for a large number of poles, then the Pade-Thiele solver is more stable, but the one based on linear algebra is more flexible and it is use only in rare cases. In practice, for MPA it is recommended to compile Yambo in double precision and avoid using more than 20 poles. Rather than increasing the number of poles, it is recommended to try improving the other parameters of the sampling.&lt;br /&gt;
Last, it is possible to store an additional database with the interpolated  poles and residues of the MPA model by adding the &amp;lt;code&amp;gt;[[mpERdb]]&amp;lt;/code&amp;gt; label, which is left inactivated for now.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now run the calculations and compare the results&lt;br /&gt;
 $ yambo -F ppa.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
&lt;br /&gt;
o-pp1_i1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.332210           2.632103&lt;br /&gt;
 7                  9                 3.877976           1.047207          -3.890988&lt;br /&gt;
&lt;br /&gt;
o-ff400_d0.2eV_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.347396           2.599905&lt;br /&gt;
 7                  9                 3.877976           1.037291          -3.873562&lt;br /&gt;
&lt;br /&gt;
o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.qp:&lt;br /&gt;
 K-point            Band               Eo [eV]            E-Eo [eV]          Sc|Eo [eV]&lt;br /&gt;
 &lt;br /&gt;
 7                  8                -0.411876          -0.349764           2.598567&lt;br /&gt;
 7                  9                 3.877976           1.038180          -3.875556&lt;br /&gt;
&lt;br /&gt;
As can be notice, the results corresponding to MPA with 8 poles are practically on top of the FF-RA results. The difference between the quasi-particle energies computed with MPA and FF-RA is around 2 meV, while in the case of PPA is around 15 meV. This differences are small since the response of this system is well described by a single pole, however, the difference between PPA and full frequency is expected to increase by an order of magnitude with a larger number of bands and polarizability cutoff.&lt;br /&gt;
&lt;br /&gt;
== Exercise 2: Run self-energy calculations ==&lt;br /&gt;
So far we have computed quasi-particles with the Newton method, this means that we are evaluating the self-energy in two frequency points used to solve the linearized quasi-particle equation. Now we will plot the whole frequency dependence of the self-energy and the spectral function.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s first make a copy of the input files to keep the previous modifications&lt;br /&gt;
 $ cp ppa.in ppa_SG.in&lt;br /&gt;
 $ cp mpa.in mpa_SG.in&lt;br /&gt;
 $ cp ffr.in ffr_SG.in&lt;br /&gt;
Then we regenerate the inputs specifying the Dyson solver to be the one corresponding the Green&#039;s function&lt;br /&gt;
 $ yambo -F ppa.in -gw0 p -g g&lt;br /&gt;
 $ yambo -F mpa.in -gw0 m -g g&lt;br /&gt;
 $ yambo -F ffr.in -gw0 r -g g&lt;br /&gt;
You will now see and set the following variables&lt;br /&gt;
 DysSolver= &amp;quot;g&amp;quot;                       # [GW] Dyson Equation solver (&amp;quot;n&amp;quot;,&amp;quot;s&amp;quot;,&amp;quot;g&amp;quot;)&lt;br /&gt;
 GEnSteps= 200                        # [GW] Green`s Function (GF) energy steps&lt;br /&gt;
 % GEnRnge&lt;br /&gt;
 -40.00000 | 40.00000 |         eV    # [GW] GF energy range&lt;br /&gt;
 %&lt;br /&gt;
 % GDmRnge&lt;br /&gt;
  0.100000 | 0.100000 |         eV    # [GW] G_gw damping range&lt;br /&gt;
We can use the same job identifiers to run the calculations&lt;br /&gt;
 $ yambo -F ppa_SG.in -J pp1_i1Ha_x3Ry_b100&lt;br /&gt;
 $ yambo -F ffr.in_SG -J ff400_d0.2eV_x3Ry_b100&lt;br /&gt;
 $ yambo -F mpa.in_SG -J mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100&lt;br /&gt;
Le&#039;s plot the results&lt;br /&gt;
 $ gnuplot&lt;br /&gt;
 gnuplot&amp;gt; p &amp;quot;o-pp1_i1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-mp8_r0-4i1-1d0-0.1Ha_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp, &lt;br /&gt;
            &amp;quot;o-ff400_d0.2eV_x3Ry_b100.G_Sc_band_008_k_007&amp;quot; u 1:5 w lp&lt;br /&gt;
&lt;br /&gt;
[[https://www.yambo-code.eu/wiki/index.php/File:MPA_self_energy_and_spectral_function.png#file|PPA vs MPA vs. FF-RA: self-energy and spectral function]]&lt;/div&gt;</summary>
		<author><name>DarioAlejandro</name></author>
	</entry>
</feed>