Introduction
There is a jungle of DFT tutorials all over the web, and only some of them are good. Only few of them are oriented at DMFT calculations, and even less use w2dynamics. This tutorial is written in the hope of filling this gap, combining a little bit of theory with practical how-tos and input files.
In this tutorial we will compute the DMFT spectral function of NiO, which is a charge transfer insulator. There is a similar tutorial on the triqs documentation which uses VASP + TRIQS. Instead, we will use Quantum ESPRESSO + w2dynamics. Compared to other DFT codes Quantum ESPRESSO has the advantage of being free and open source. Other than that, all DFT codes are essentially equivalent.
The amount of theoretical and practical knowledge needed for this tutorial is large, feel free to skip to the part that interests you through the table of contents.
Installation
Quantum ESPRESSO
can be installed in two ways, assuming you have superuser privileges. If you don't, it likely means you're using a supercluster, then you'd better bow to the cluster service and ask that they install it for you.
Easy way:
sudo apt-get install quantum-espresso
General installation:
- Install the minimum needed libraries:
sudo apt-get install libopenmpi-dev -y
sudo apt-get install libopenblas-dev -y
sudo apt-get install libfftw3-dev -y
sudo apt-get install liblapack-dev -y
sudo apt-get install libscalapack-openmpi-dev -y
sudo apt-get install g++ -y - Download from the download page (7.1 version)
- Unpack with
tar -xvf qe\-ReleasePack.tar
- cd to
qe-7.1
- Run the
./configure
script - Run
sudo make all
- Run
sudo make install
- If problems arise you have to go through the complaints of make to figure out what's wrong. Fortunately Quantum ESPRESSO has many users so you often find someone else who had the same problem.
VESTA
Can be downloaded from the jp minerals website. Installation is straightforward for all standard operative systems.
Density Functional Theory
Setting up a basic DFT calculation
General workflow of a DFT calculation
In general, a DFT calculation is well done when the total electronic energy reaches its minimum, which by the second Hohenberg and Kohn's theorem also means that the charge density is the true ground-state charge density of the system.
This is achieved by solving the Schrödinger's equation for the Kohn and Sham single-particle hamiltonian in a self consistent loop, which works as follows:
- Start from an initial guess. Typically a wavefunction that is the sum of atomic wavefunctions.
- Compute the charge density from the wavefunctions
- Compute the potential terms of the hamiltonian from the charge density
- Solve the single-particle hamiltonian with the new potential to obtain new eigenvalues and eigenfunctions
- Go back to a until self-consistency is achieved (typically on total energy)
This is called the self-consistent loop. Quantum ESPRESSO is a modular code. The part of the code that does the self-consistency is called pw.x
Once self-consistency is reached one obtains the ground-state charge density, which can be re-used to compute everything else. For instance, to compute the band structure one first obtains a good ground-state charge density, and then does a new non-self-consistent calculation in which the Scrhödinger's equation for the Kohn and Sham hamiltonian is constructed using the charge density of the previous step.
Create and visualize the crystal structure using VESTA
The first thing you need is information on your crystal structure. It's a CsCl-type cubic crystal with a = 4.1674 Ã…. We can use this information to visualize the primitive cell.
- Open VESTA, then click: File → New Structure, a prompt will open
- Click Unit cell and select Cubic, Space Group No. 225 (Fm3m), and enter the lattice parameter
- Now go to Structure parameters → New and add a Ni atom in (0, 0, 0) and O in (1/2, 1/2, 1/2). You should see something like this. Notice that VESTA does the work of recognizing the Wyckoff positions for us.
- VESTA is a very powerful software. It can plot isosurfaces, lattice planes, polyhedral bonds.. it would need a separate tutorial.
Choose a pseudopotential
What is a pseudopotential and why you need it
The Kohn and Sham equation is a second-order Schrödinger's equation for a single electron in an external field. Any numerical solution first goes through an expansion into a basis set, which transforms the problem of solving the differential equation into the one of finding the coefficients of the expansion. The latter is a problem of linear algebra and can be done numerically, provided that the expansion is truncated at some finite value. Many DFT codes, including Quantum ESPRESSO, use plane waves as the basis for expansion.
Plane waves have mainly two advantages:
- They are orthogonal to each other, and they are a complete set
- Truncation into a finite set does not break Hellman-Feynman's theorem
They also have a major inconvenience: in order to accurately describe an oscillation in real space of the order of a unit length, one needs plane waves which have at least that wavelength, or smaller. All the atomic wavefunctions present fast oscillations in real space, even those of the valence shell which are not per se localized. If the DFT calculation took into account all electrons plane waves would be simply too expensive.
Pseudopotentials overcome this problem by removing the core electrons, and replacing the core region of the potential with a weakly repulsive part that mimicks the effect of the core electrons, in such a way that the electronic properties of the valence electrons are unchanged.
Where do I get good pseudopotentials and how do I choose
Choosing a pseudopotential for a DFT calculation while being fully aware what one is doing requires quite a lot of experience. I recommend to anyone without experience to simply use a well-tested norm-conserving PBE pseudopotential. Anything else risks doing more harm than good.
A well-maintained and reliable datased is found at the pseudo-dojo website. The Optimized Norm-Conserving Vanderbilt (ONCV) pseudopotentials are a little costly, but typically very reliable.
Quantum ESPRESSO uses the Unified Pseudopotential Format (UPF) format.
Set up of the input file to compute the ground-state charge density
Download the pseudopotentials used in this tutorial
Convergence criteria to watch out for: plane waves expansion and Brillouin zone integration
Plane waves expansion
In the section about pseudopotentials it was mentioned that in Quantum ESPRESSO the wavefunctions are expanded in plane waves, and this expansion is truncated at some finite value. In most DFT codes the truncation is defined in terms of an energy value such that
Where is a reciprocal lattice vector.
Using a large enough value of is necessary to get converged result. How large depends very much on which pseudopotential is used and a very little on the specific crystal structure.
As we add more plane waves the total energy will asymptotically approach the true value from above. It looks somewhat like this.
In an accurate calculation typically one wants to have within 1 meV/atom, i.e. Anything above 70 Ry is fine for NiO. You can use the following files to produce the plot above.
CONVERGE_ECUT.sh: Bash script that changes the cutoff and runs pw.x
NiO.src.in: Template input file
plot_convergence.py: Plotting script
Brillouin zone integration
The Bloch Hamiltonian is diagonal in k-space, hence the Kohn-Sham equations can be solved separately for every k point. However, the charge density (in reciprocal space) depends on the integral over the whole Brillouin zone, hence one defines a finite and discrete grid to integrate on, usually following the Monkhorst-Pack scheme. In most cases the specific scheme does not matter, what matters is if the k-mesh is dense enough so that the integrated charge is reasonable.
In insulators, integrals over the whole Brillouin zone typically converge quite quickly, because the bands over which the integrals are performed cannot change (you integrate up to the valence band).
In metals, things are more complicated because the integral is up to the Fermi energy, hence a tiny change in the electronic structure will change which bands are occupied and which are not, hence self-consistency becomes much more difficult to achieve. To avoid this circumstance, one introduces a smearing of the states, i.e. fractional occupation of the states is allowed.
Structural relaxation using DFT
DFT band structure (with atom projection)
DFT density of states (with atom projection)
Wannierization
Set up of the calculation
Tips and tricks
Interfacing
Fourier transform of the Wannier hamiltonian
Dynamical Mean Field Theory
Set up of the input file for w2dynamics
Analytic continuation of the green's function and self-energy
Plotting tools
Table of contents