# Locally scaled SIC by direct minimization :::{admonition} Video :class: tip [Watch the narrated video of this tutorial on YouTube](https://www.youtube.com/watch?v=ZPsylxH4cRM). ::: :::{admonition} In this tutorial :class: tip Perdew–Zunger SIC (tutorial 7) over-corrects: total energies of atoms and molecules end up far below the exact values. The locally scaled self-interaction correction (LSIC) applies the correction only where it is needed. You run LSIC-LDA for water by direct minimization of the LSIC energy, read the minimizer's output, and compare LDA, PZ-SIC and LSIC for a set of atoms against exact energies. **Time:** 10 s for water and 10 s for all 18 atom runs (32 cores); the exercises take a few seconds each. **Files:** {download}`h2o_lsic.yaml `, {download}`h2o_lsic.out ` (reference output), `files/atoms/` (FODs and an input template), exercise inputs `files/h2o_lsic_{jacobi,oneshot,quasi_kli}.yaml`, {download}`run.sh `. ::: ## The idea PZ-SIC removes the full self-interaction of every orbital everywhere. That is right in a one-electron region, but too much where orbitals overlap, as in the valence region of an atom or a bond. LSIC scales the SIC energy density of each orbital pointwise by the iso-orbital indicator $$ z(\mathbf r) = \frac{\tau_W(\mathbf r)}{\tau(\mathbf r)}, \qquad 0\le z\le 1 . $$ Here $\tau_W$ is the von Weizsäcker and $\tau$ the Kohn–Sham kinetic energy density. In one-electron regions $z\to1$ and the full correction is kept. Where many orbitals overlap, $z\to0$ and the correction fades out. ## Direct minimization The LSIC energy is a functional of the orbitals. With `scf_algorithm: direct` DFTSW27 minimizes it directly over rotations between occupied and virtual orbitals, at fixed FODs, using the exact gradient: first L-BFGS, then a trust-region Newton method. It finishes with a check that the result is a true minimum. It starts from a converged plain-DFT SCF, so it is robust and reproducible, which makes it the method of choice for benchmark energies. ## The input file ```yaml system: charge: 0 unpaired_electrons: 0 units: angstrom functional: exchange: slater correlation: pw92 basis: name: UTEP-NRLMOL file: basis/FLOSIC-LDA_atoms_normalized.nw scf: conv_tol: 1.0e-8 sic: functional: lsic solver: jacobi lsic_consistency: full scf_algorithm: direct coulomb_method: poisson fod_file: tutorials/09_lsic/files/h2o.fod atoms: # water, as in tutorials 7 and 8 ... ``` `functional: lsic` : Locally scaled SIC; the scaling factor is $z=\tau_W/\tau$ (`lsic_scaling_factor: tw_t`, the default). `lsic_consistency: full` : The exact derivative of the LSIC energy. `quasi` is the cheaper approximation of the potential (exercise 3). `scf_algorithm: direct` : Direct minimization (with `solver: jacobi`). The default `jacobi` is the fixed-point SCF (exercise 1). `coulomb_method: poisson` : LSIC needs the Poisson self-Coulomb (a plain and a $z$-scaled Poisson solve per orbital). `fod_file` : The FODs optimized with PZ-SIC in tutorial 8. LSIC calculations use PZ-SIC-optimized FODs. ## Running ```bash $ OMP_NUM_THREADS=16 ./run_dft tutorials/09_lsic/files/h2o_lsic.yaml > h2o_lsic.out ``` ## Reading the output After a preliminary plain-LDA SCF, the minimizer reports one line per step: ```text sic: scf_algorithm = direct: direct minimization of the FLOSIC energy over orbital rotations SIC SCF starts from the converged preliminary plain-DFT orbitals flosic_direct iter 1 e_total = -76.4735167494 max|F_ov| = 1.650E-01 [lbfgs, history 0 flosic_direct iter 2 e_total = -76.4803139601 max|F_ov| = 8.442E-02 [lbfgs, history 1 flosic_direct iter 3 e_total = -76.4827189826 max|F_ov| = 2.375E-03 [lbfgs, history 2 flosic_direct iter 4 e_total = -76.4827189826 max|F_ov| = 2.375E-03 [newton, radius 1.000, Hv 0 flosic_direct iter 5 e_total = -76.4827349004 max|F_ov| = 2.182E-04 [newton, radius 1.000, Hv 2 flosic_direct iter 6 e_total = -76.4827349736 max|F_ov| = 2.589E-06 [newton, radius 1.000, Hv 5 flosic_direct iter 7 e_total = -76.4827349737 max|F_ov| = 3.346E-09 [newton, radius 1.000, Hv 9 flosic_direct stability: lowest eigenvalue of the preconditioned orbital Hessian = 3.939E-01 (Lanczos, 16 vectors) flosic_direct: converged solution is a minimum of the orbital Hessian (stable) ``` - `max|F_ov|` is the largest occupied–virtual orbital gradient. Convergence means `direct_grad_tol` = $10^{-6}$. - Once L-BFGS has brought the gradient below $10^{-2}$, Newton steps take over. They use Hessian–vector products (`Hv`), and the gradient drops by one to three orders of magnitude per step. - The stability check finds no negative orbital-Hessian eigenvalue, so this is a minimum and not a saddle point. (The header says "FLOSIC energy"; with `functional: lsic` it is the LSIC energy that is minimized.) The final energy is $-76.4827350$ Ha. The direct algorithm does not produce orbital energies (`Frontier orbital energies: not available`); the Jacobi SCF of exercise 1 does. ## LSIC against PZ-SIC | water | $E$ (Ha) | $E - E_{\rm exact}$ | |---|---|---| | LDA | $-75.90904$ | $+0.53$ Ha | | PZ-SIC (tutorial 8) | $-76.67890$ | $-0.24$ Ha | | LSIC (this run) | $-76.48273$ | $-0.045$ Ha | | exact (nonrelativistic) | $-76.438$ | | The atoms show the same pattern, more cleanly. `run.sh` runs LDA, PZ-SIC and LSIC (all by direct minimization) for six atoms, with the FLOSIC-optimized FODs of the DFTSW27 benchmark set (`files/atoms/`): ```{figure} figures/atom_errors.png :width: 85% Total-energy errors against the exact nonrelativistic energies (mHa). LDA is too high, increasingly so with the number of electrons. PZ-SIC overshoots, by $-343$ mHa for neon. LSIC brings the errors down to $-11$ to $-37$ mHa. ``` | | He | Li | Be | N | O | Ne | |---|---|---|---|---|---|---| | LDA | 69.3 | 134.9 | 221.2 | 455.0 | 539.8 | 707.9 | | PZ-SIC | −16.0 | −31.1 | −39.3 | −151.9 | −217.4 | −343.1 | | LSIC | −16.0 | −23.0 | −11.4 | −28.3 | −37.0 | −37.4 | **He** is a two-electron singlet: one electron per spin, so $z=1$ everywhere and LSIC equals PZ-SIC exactly. **Li** comes out at $-7.50107$ Ha, the published self-consistent LSIC value. The PZ-SIC and LSIC energies agree with the DFTSW27 benchmark runs to about 10 µHa; the remaining difference is the integration grid. ## Things to try ### 1. Direct minimization or the Jacobi SCF? `files/h2o_lsic_jacobi.yaml` is the same input without `scf_algorithm: direct`. :::{dropdown} What you should find $E=-76.4827205$ Ha, 14 µHa above the direct minimum. Both solve the same equations: the Jacobi fixed point and the direct minimum can differ slightly, and the direct minimum can lie a little lower. Jacobi reports semicanonical orbital energies: $-\varepsilon_{\rm HOMO}=11.19$ eV (PZ-SIC: 14.78 eV, experiment 12.62 eV). ::: ### 2. One-shot LSIC `lsic_perturbative: true` (`files/h2o_lsic_oneshot.yaml`) runs PZ-SIC to self-consistency and then evaluates the LSIC energy once with its orbitals. :::{dropdown} What you should find $E=-76.4794747$ Ha, 3.3 mHa above the self-consistent LSIC energy, from a PZ-SIC calculation only. Good enough for trends; use the self-consistent version for final numbers. ::: ### 3. Quasi-self-consistent LSIC with KLI `files/h2o_lsic_quasi_kli.yaml`: `solver: kli`, `lsic_consistency: quasi`. The PZ-SIC potential is scaled by $z$ (Zope et al. 2019), which is cheap but approximate. :::{dropdown} What you should find $E=-76.4710328$ Ha, 12 mHa above the full LSIC minimum, and $-\varepsilon_{\rm HOMO}=13.03$ eV. With SIC, orbital energies depend on the solver: KLI eigenvalues and Jacobi semicanonical energies are different quantities, so compare them only within one method. `quasi` gives no FOD forces, so FODs cannot be optimized with it. ::: ## Troubleshooting - **The LSIC SCF stalls.** Start from PZ-SIC-optimized FODs (tutorial 8), not from a raw guess. - **`fod_optimization: energy` with LSIC.** It needs `lsic_consistency: full`. - **The minimization stops above `direct_grad_tol`.** The output reports when the remaining gradient is at the noise floor of the grid Coulomb matrix; the energy is converged then. - **Open shells.** Direct minimization is reproducible where the Jacobi SCF may end in different states, but several minima are possible (`direct_starts`, User Manual). **Next:** {doc}`../10_mae/index`.