# Tutorial:Hybrid functionals

The objective of this tutorial is to give a basic idea of how to perform Hartree-Fock, as well as hybrid functionals calculations within the framework of generalized Kohn-Sham calculation.

## Input

As always, we will start with a simple input file. In this example, we will look at the example of solid argon, treated using the HSE06 functional.

`CalculationMode`

= gs`PeriodicDimensions`

= 3`BoxShape`

= parallelepiped`ExperimentalFeatures`

= yes`FromScratch`

= yes`PseudopotentialSet`

= sg15 a = 5.256*Angstrom`Spacing`

= 0.5 %`LatticeParameters`

a | a | a % %`LatticeVectors`

0. | 0.5 | 0.5 0.5 | 0. | 0.5 0.5 | 0.5 | 0.0 % %`ReducedCoordinates`

"Ar" | 0.0 | 0.0 | 0.0 % nk = 2 %`KPointsGrid`

nk | nk | nk %`KPointsUseSymmetries`

= yes`ExtraStates`

= 1`ExperimentalFeatures`

= yes`XCFunctional`

= hyb_gga_xc_hse06`AdaptivelyCompressedExchange`

= yes

Let us look at the different input variable. Most of them have already been described in the Periodic System tutorials. What we have added here are:

`XCFunctional`

= hyb_gga_xc_hse06: This specifies that we are using the HSE06 exchange-correlation functional.

This implies that the code will work in the generalized Kohn-Sham framework, which allows for nonlocal operators. If we would like to work in the usual Kohn-Sham framework, we would need to use the Optimized Effective Potential (OEP) method.

`AdaptivelyCompressedExchange`

= yes: This activates the use of the Adaptively Compressed Exchange (ACE) operator proposed in^{[1]}, which makes the evaluation of the exchange operator much faster.

## Output

Now run Octopus using the above input file. Here are some important things to note from the output.
First of all, we see that the theory level has been automatically switched to `generalized_kohn_sham`, and that the code is rightly using the requested HSE06 fuctional.

**************************** Theory Level **************************** Input: [TheoryLevel = generalized_kohn_sham] Exchange-correlation: Exchange Exact exchange Exchange-correlation HSE06 (Hybrid GGA) [1] J. Heyd, G. E. Scuseria, and M. Ernzerhof, J. Chem. Phys. 118, 8207 (2003) [2] J. Heyd, G. E. Scuseria, and M. Ernzerhof, J. Chem. Phys. 124, 219906 (2006) Exact exchange mixing for the short-range part = 0.25000 **********************************************************************

The rest of the output is quite standard.
As one main effect of using the HSE06 functional is to open the bandgap of solid argon.
Indeed, looking at the `static/info` file, we see that we obtain a bandgap of roughly 10.5 eV:

Direct gap at ik= 1 of 0.3866 H Indirect gap between ik= 1 and ik= 1 of 0.3866 H

whereas a similar PBE calculation produces a bandgap of only 8.6eV.

## Hartree-Fock

If we want to perform not an hybrid-functional calculation but an Hartree-Fock calculation, we simply need to replace the definition of the functional by the line

` ``TheoryLevel`

= hartree_fock

The ACE operator should still be used here to obtain the best performance. Using the same input file but for Hartree-Fock, we obtain the HF bandgap of solid argon, which is roughly of 17.2 eV:

Direct gap at ik= 1 of 0.6330 H Indirect gap between ik= 1 and ik= 1 of 0.6330 H

## Using the ACE operator for TD calculations

Here we want to mention an important aspect of the ACE operator for TD simulations.
By construction, the ACE operator is only defined at convergence of an SCF loop. For TD calculations, this implies that one should perform a self-consistency at every step of a TD calculation.
At the moment, this is only implemented for the ETRS propagator, and we strongly recommend to use the following lines for a TD calculation using the ACE operator (`AdaptivelyCompressedExchange`

= yes):

`TDPropagator`

= etrs`TDStepsWithSelfConsistency`

= all_steps

## References

- ↑
Lin Lin,
*Adaptively Compressed Exchange Operator*, J. Chem. Theory Comput.**12**2242–2249 (2016)