# 1. DFT: all functionals The `functional:` section selects exchange and correlation independently. Without `exchange` and `correlation` the run is Hartree–Fock. ## Back ends | `backend` | Functionals | |---|---| | `inhouse` (default) | exchange `slater`, `pbe`, `scan`, `rscan`, `rppscan`, `r2scan`, `r4scan`; correlation `vwn5`, `pw92`, `pbe`, `scan`, `rscan`, `rppscan`, `r2scan`, `r4scan`, `none` | | `libxc` | any [Libxc](#ref-libxc) functional by its exact name: LDA, GGA and meta-GGA (those that need no density Laplacian), global and range-separated hybrids | | `nxc`, `mlxc` | machine-learned semilocal functionals (energies, forces, open shells; no TDDFT or analytic Hessians) | A SCAN-family name on either side switches on meta-GGA evaluation. The in-house `pw92` is the [Perdew–Wang](#ref-pw92) LDA correlation used in FLOSIC work. References for the in-house functionals: Slater exchange [(Slater 1951)](#ref-slater51), VWN5 [(Vosko, Wilk, Nusair 1980)](#ref-vwn80), PW92 [(Perdew, Wang 1992)](#ref-pw92), PBE [(Perdew, Burke, Ernzerhof 1996)](#ref-pbe96), SCAN [(Sun et al. 2015)](#ref-scan15), rSCAN [(Bartók, Yates 2019)](#ref-rscan19), r²SCAN [(Furness et al. 2020)](#ref-r2scan20). ## Semilocal functionals ```yaml functional: exchange: pbe correlation: pbe ``` For libxc functionals give the full name; for example `GGA_X_B88` with `GGA_C_LYP` ([Becke 1988](#ref-b88), [Lee, Yang, Parr 1988](#ref-lyp88)): ```yaml functional: backend: libxc exchange: GGA_X_PBE correlation: GGA_C_PBE ``` ## Hybrid functionals A combined hybrid goes into `exchange` with `correlation: none`; the exact-exchange fraction is the one libxc reports: ```{literalinclude} ../examples/h2o_pbe0.yaml :language: yaml :start-at: "functional:" :end-before: "basis:" ``` Examples: `HYB_GGA_XC_B3LYP` ([Becke 1993](#ref-b3lyp)), `HYB_GGA_XC_PBEH` = PBE0 ([Adamo, Barone 1999](#ref-pbe0)). Range-separated and screened hybrids (`HYB_GGA_XC_CAM_B3LYP` [(Yanai et al.)](#ref-camb3lyp), `HYB_GGA_XC_WB97X` [(Chai, Head-Gordon)](#ref-wb97x), `HYB_GGA_XC_LRC_WPBE` [(Vydrov, Scuseria)](#ref-lcwpbe), `HYB_GGA_XC_HSE06` [(Heyd et al.)](#ref-hse), `HYB_GGA_XC_HJS_PBE` [(Henderson et al.)](#ref-hjs)) work with exact or density-fitted exchange. For geometries and frequencies prefer `HJS_PBE` over `HSE06`: libxc's HSE06 potential is not the exact derivative of its energy. Exact exchange follows `coulomb:`. For large systems the chain-of-spheres option ([Neese et al.](#ref-cosx)) is much cheaper: ```{literalinclude} ../examples/h2o_pbe0_cosx.yaml :language: yaml :start-at: "coulomb:" :end-before: "scf:" ``` ## Composed and double hybrids, dispersion The pieces of a hybrid can be scaled separately (`exchange_scale`, `correlation_scale`, `exx_fraction`), and `pt2_os`, `pt2_ss` add a second-order perturbative correlation after the SCF. B2PLYP ([Grimme 2006](#ref-b2plyp)): ```yaml functional: backend: libxc exchange: GGA_X_B88 correlation: GGA_C_LYP exchange_scale: 0.47 # 1 - c_x exx_fraction: 0.53 # c_x correlation_scale: 0.73 # c_c pt2_os: 0.27 pt2_ss: 0.27 pt2_engine: ri pt2_aux_basis_file: basis/cc-pvtz-ri_HO.nw ``` Only single-point energies are available for double hybrids. Grimme's DFT-D3 ([Grimme et al. 2010](#ref-d3); Becke–Johnson damping, [Grimme et al. 2011](#ref-d3bj)) is switched on with `dispersion: d3bj` and `dispersion_functional: b3-lyp` (Grimme's spelling of the functional name). ## Example: one molecule, many functionals Water at one geometry, def2-TZVP, exact Coulomb integrals (`coulomb: method: eri`). The inputs are `h2o_*.yaml` in the {download}`example set <../examples/h2o_pbe.yaml>`: | Input | Functional | Total energy (Ha) | |---|---|---| | `h2o_hf.yaml` | Hartree–Fock | −76.0594112 | | `h2o_pbe.yaml` | PBE | −76.3773251 | | `h2o_pbe0.yaml` | PBE0 (libxc) | −76.3779122 | | `h2o_r2scan.yaml` | r²SCAN | −76.4201031 | The functionals share one SCF code, so changing the functional means changing two lines. ## Choosing a functional in practice - Start with PBE or r²SCAN for geometries and frequencies; r²SCAN is a numerically gentle meta-GGA. - Use a hybrid for gaps, excitation energies and charge-transfer problems. - Self-interaction errors of these functionals are treated in {doc}`flosic`. - Local hybrids with position-dependent exact exchange are in {doc}`localhybrid`. Related tutorials: {doc}`../tutorials/01_scf/index`, {doc}`../tutorials/05_tddft/index`, {doc}`../tutorials/20_inputs/index`.