Hubbard correction (DFT+U)

In this example, we'll plot the DOS and projected DOS of Nickel Oxide with and without the Hubbard term correction.

using DFTK
using PseudoPotentialData
using Unitful
using UnitfulAtomic
using Plots

Define the geometry and pseudopotential

a = 7.9  # Nickel Oxide lattice constant in Bohr
lattice = a * [[ 1.0  0.5  0.5];
               [ 0.5  1.0  0.5];
               [ 0.5  0.5  1.0]]
pseudopotentials = PseudoFamily("dojo.nc.sr.pbe.v0_4_1.standard.upf")
Ni = ElementPsp(:Ni, pseudopotentials)
O  = ElementPsp(:O, pseudopotentials)
atoms = [Ni, O, Ni, O]
positions = [zeros(3), ones(3) / 4, ones(3) / 2, ones(3) * 3 / 4]
magnetic_moments = [2, 0, -1, 0]
4-element Vector{Int64}:
  2
  0
 -1
  0

First, we run an SCF and band computation without the Hubbard term

model = model_DFT(lattice, atoms, positions; temperature=5e-3,
                  functionals=PBE(), magnetic_moments)
basis = PlaneWaveBasis(model; Ecut=20, kgrid=[2, 2, 2])
scfres = self_consistent_field(basis; tol=1e-6, ρ=guess_density(basis, magnetic_moments))
bands = compute_bands(scfres, MonkhorstPack(4, 4, 4))
lowest_unocc_band = findfirst(ε -> ε-bands.εF > 0, bands.eigenvalues[1])
band_gap = bands.eigenvalues[1][lowest_unocc_band] - bands.eigenvalues[1][lowest_unocc_band-1]
0.08219388020202661

Then we plot the DOS and the PDOS for the relevant 3D (pseudo)atomic projector

εF = bands.εF
width = 5.0u"eV"
εrange = (εF - austrip(width), εF + austrip(width))
p = plot_dos(bands; εrange, colors=[1, 1])
plot_pdos(bands; p, iatom=1, label="3D", colors=[3, 4], εrange)

To perform and Hubbard computation, we have to define the Hubbard manifold and associated constant.

In DFTK there are a few ways to construct the OrbitalManifold. Here, we will apply the Hubbard correction on the 3D orbital of all nickel atoms. To select all nickel atoms, we can:

  • Pass the Ni element directly.
  • Pass the :Ni symbol.
  • Pass the list of atom indices, here [1, 3].

To select the orbitals, it is recommended to use their label, such as "3D" for PseudoDojo pseudopotentials.

Note that "manifold" is the standard term used in the literature for the set of atomic orbitals used to compute the Hubbard correction, but it is not meant in the mathematical sense.

U = 10u"eV"
# Alternative:
# manifold = OrbitalManifold(:Ni, "3D")
# Alternative:
# manifold = OrbitalManifold([1, 3], "3D")
manifold = OrbitalManifold(Ni, "3D")
OrbitalManifold(Ni, "3D")

Run SCF with a DFT+U setup, notice the extra_terms keyword argument, setting up the Hubbard +U term. It is also possible to set up multiple manifolds with different U values by passing each pair as a separate entry in the Hubbard constructor (i.e. Hubbard(manifold1 => U1, manifold2 => U2, etc.)) or as two vectors (i.e. Hubbard([manifold1, manifold2, etc.], [U1, U2, etc.])).

model = model_DFT(lattice, atoms, positions; extra_terms=[Hubbard(manifold => U)],
                  functionals=PBE(), temperature=5e-3, magnetic_moments)
basis = PlaneWaveBasis(model; Ecut=20, kgrid=[2, 2, 2])
scfres = self_consistent_field(basis; tol=1e-6, ρ=guess_density(basis, magnetic_moments));
n     Energy            log10(ΔE)   log10(Δρ)   Magnet   |Magn|   Diag   Δtime 
---   ---------------   ---------   ---------   ------   ------   ----   ------
  1   -361.3892430695                    0.07    1.334    3.441    7.0    2.35s
  2   -362.9631449317        0.20       -0.10    0.223    3.875    2.6    6.86s
  3   -363.1927385120       -0.64       -0.20    0.000    3.776    3.1    1.76s
  4   -363.2402080894       -1.32       -0.29    0.000    3.781    2.2    1.14s
  5   -363.3690343583       -0.89       -0.30    0.000    3.687    4.1    1.59s
  6   -363.3863889375       -1.76       -0.48   -0.000    3.657    2.1    1.61s
  7   -363.3967947335       -1.98       -1.13   -0.000    3.676    2.8    1.22s
  8   -363.3934750916   +   -2.48       -0.89    0.000    3.677    2.0    1.11s
  9   -363.3967454949       -2.49       -1.08    0.000    3.656    1.0    1.32s
 10   -363.3975255476       -3.11       -1.39    0.000    3.645    1.5    1.01s
 11   -363.3976018292       -4.12       -1.47    0.000    3.643    1.0    888ms
 12   -363.3976321304       -4.52       -1.51    0.000    3.644    1.0    959ms
 13   -363.3976437812       -4.93       -1.49    0.000    3.642    1.0    1.34s
 14   -363.3976919597       -4.32       -2.53   -0.000    3.649    1.0    912ms
 15   -363.3976929618       -6.00       -2.54   -0.000    3.651    1.9    1.06s
 16   -363.3976985996       -5.25       -2.64   -0.000    3.651    1.0    964ms
 17   -363.3977058260       -5.14       -2.88   -0.000    3.650    1.0    1.25s
 18   -363.3977090240       -5.50       -3.19   -0.000    3.649    1.8    1.03s
 19   -363.3977099445       -6.04       -3.58   -0.000    3.648    2.0    1.10s
 20   -363.3977099884       -7.36       -3.64   -0.000    3.648    1.1    1.36s
 21   -363.3977098769   +   -6.95       -3.48   -0.000    3.649    2.0    1.02s
 22   -363.3977099950       -6.93       -3.87    0.000    3.648    1.0    911ms
 23   -363.3977100103       -7.81       -4.06    0.000    3.648    1.2    973ms
 24   -363.3977100137       -8.48       -4.48    0.000    3.648    2.0    1.44s
 25   -363.3977100158       -8.68       -4.53    0.000    3.648    1.4    980ms
 26   -363.3977100170       -8.92       -4.66    0.000    3.648    1.2    929ms
 27   -363.3977100174       -9.36       -4.95    0.000    3.648    1.0    923ms
 28   -363.3977100176       -9.68       -5.25    0.000    3.648    2.0    1.47s
 29   -363.3977100177       -9.99       -5.43    0.000    3.648    2.1    1.10s
 30   -363.3977100178      -10.24       -5.88    0.000    3.648    1.0    916ms
 31   -363.3977100178      -10.41       -5.65    0.000    3.648    3.0    1.27s
 32   -363.3977100178      -10.69       -5.54    0.000    3.648    1.2    1.33s
 33   -363.3977100178      -10.93       -5.24    0.000    3.648    1.8    1.02s
 34   -363.3977100178      -11.10       -5.37    0.000    3.648    1.0    907ms
 35   -363.3977100178      -11.29       -5.59    0.000    3.648    1.5    983ms
 36   -363.3977100178      -11.56       -5.60    0.000    3.648    1.2    1.33s
 37   -363.3977100179      -11.81       -5.87    0.000    3.648    1.0    888ms
 38   -363.3977100179      -11.97       -6.50    0.000    3.648    1.0    895ms

Run band computation

bands_hub = compute_bands(scfres, MonkhorstPack(4, 4, 4))
lowest_unocc_band = findfirst(ε -> ε-bands_hub.εF > 0, bands_hub.eigenvalues[1])
band_gap = bands_hub.eigenvalues[1][lowest_unocc_band] - bands_hub.eigenvalues[1][lowest_unocc_band-1]
0.11667613141756322

With the electron localization introduced by the Hubbard term, the band gap has now opened, reflecting the experimental insulating behaviour of Nickel Oxide.

εF = bands_hub.εF
εrange = (εF - austrip(width), εF + austrip(width))
p = plot_dos(bands_hub; p, colors=[2, 2], εrange)
plot_pdos(bands_hub; p, iatom=1, label="3D", colors=[3, 4], εrange)