# Self-consistent GW on eigenvalues only

In this tutorial you will learn how to perform **self-consistent GW on eigenvalues only for G or both G and W (evGW)**. For molecules systems and also for many solids, the G_{0}W_{0} approach often gives poor results.
The main reason of this failure is that the DFT starting point with local or semi-local exchange correlation functionals give a too small gap compared with the experimental one, and a single shot GW is not able to correct this error.
In order to overcome this problem a possible solution is to use as starting point a hybrid functional like PBE0, B3LYP,HSE etc.. or to perform a self-consistent GW.
In general in self-consistent GW also the wave-function should be updated, but for many systems DFT wave-functions are already quite good and a self-consistency on eigenvalues only can be sufficient, for a discussion see for example ref.^{[1]}

In this tutorial we will show how to perform self-consistent GW on the eigenvalues only with the Yambo code.

- Generate an input file for a G
_{0}W_{0}calculation as explained in the GW basics tutorial doing:`yambo -X p -g n -p p -V qp -F yambo_g0w0_input.in`

notice that in order to perform self-consistent GW, you have to include all k-points and a reasonable number of valence and conduction bands in the QPkrange. - run your first GW calculation doing:
`yambo –F yambo_g0w0_input.in -J G0W0`

- at the end of the run you will get a quasi-particle file o-G0W0.qp.

Now you can read this new quasi-particle band structure and perform another GW. - copy your gw input in a new file: cp yambo_g0w0_input.in yambo_g1w1_input.in
- modify the
`yambo_g1w1_input.in`

to force Yambo to read the previous quasi-particle corrections

`GfnQPdb= "E < ./G0W0/ndb.QP"`

and

`XfnQPdb= "E < ./G0W0/ndb.QP"`

- repeat point 1) and 2) for the G1W1, G2W2, etc… until the differences between o-GnWn.qp and o-Gn+1Wn+1.qp are small enough.

Usually self-consistent GW converges in about 3/4 iterations, see for instance the figure below. Notice that self-consistency on the eigenvalues can modify the energy level orders.
Moreover **evGW** removes large part of dependency of the GW results from the DFT functional.

If you want to perform **self-consistency only on G** and not on W comment the line:
`#XfnQPdb= "E < ./G0W0/ndb.QP"`

In general increasing the self-consistency level gives larger band gap: Δ_{DFT} < Δ_{GoWo} < Δ_{GWo}< Δ_{GW}.

In this figure we show the convergence of quasi-particle energy in self-consistent GW for both G and W for hexagonal Boron Nitride, see Ref. ^{[2]}

## Convergence and other issues

Convergence : convergence parameters for the self-consistent GW are the same of the standard GoWo calculation plus the bands range QPkrange employed for the self-consistency. You should perform some tests increasing the bands range and see if you converge to the same result. Notice that at each iteration the GW correction is fitted and applied also to the bands not included in the bands range. Do not use non-continuous bands/k-points range this could give wired results and the code does not check against these errors.

Yambo version : the **self-consistent GW works only in Yambo 5.x**, please do not use it in Yambo 4.x

Internal and external self-consistency in Yambo: In Yamo there is another way to perform self-consistent GW, the use of the internal variables GWoIter, GWIter see section Eigenvalue only self-consistent evGW0 and evGW. We advise not to use these variables but to make an external script as described in this tutorial, because there it not restart for the GW, and therefore an interrupted job cannot be continued. Moreover the two approaches can give slightly different results. Using the internal loop the bands not included in the GW are rigidly shifted at each iteration, while in the external way Yambo performs a fit of the GW correction and apply it to the bands not included in the GW, this fit can include also the effect of stretching and can be different for the rigid shif. For large bands range the two methods give the same results.