By the end of this tutorial, you will be able to:
- perform a collinear spin-density-functional-theory (SDFT) calculation
- relax the volume of a collinear magnet
- interpret the DOS of a magnetic system
- plot the DOS and band structure of a magnetic system using py4vasp
8.1 Task¶
Perform a volume relaxation and obtain the DOS and band structure for spin-polarized face-centered-cubic (fcc) nickel.
In SDFT the Hamiltonian is a $2\times2$ matrix and the Kohn–Sham (KS) orbitals are two component vectors in spin space. Here, the two components correspond to spin up and down in fcc nickel and are allowed to have different eigenvalues. The interaction between the two spin components stems from the exchange-correlation functional that depends on the spin-up and spin-down charge densities.
In practice, you can perform spin-polarized calculations with ISPIN = 2 which yields the collinear magnetic moments.
If the direction of the spin is important include spin-orbit coupling, by setting LSORBIT = True and use the executable vasp_ncl
.
8.2 Input¶
The input files to run this example are prepared at $TUTORIALS/bulk/e08_fcc-Ni
. Check them out!
fcc Ni
3.5
0.0 0.5 0.5
0.5 0.0 0.5
0.5 0.5 0.0
1
Cartesian
0.0 0.0 0.0
SYSTEM = fcc Ni relaxation
ICHARG = 2 ! overlapping atomic densities
ISMEAR = 1 ! Methfessel-Paxton
SIGMA = 0.2 ! smearing in eV
ENCUT = 540 ! cutoff energy
IBRION = 2 ! conjugate-gradient algorithm
ISIF = 7 ! volume relaxation
NSW = 6 ! number of ionic steps
EDIFFG = -0.001 ! stops when forces < 0.001
ISPIN = 2 ! spin polarization
MAGMOM = 1 ! initial magnetic moment
SYSTEM = fcc Ni DOS
ENCUT = 350
ISMEAR = -5
LORBIT = 11
ISPIN = 2
MAGMOM = 1
SYSTEM = fcc Ni band
ICHARG = 11
ISMEAR = 1
SIGMA = 0.2
ENCUT = 540
ISPIN = 2
MAGMOM = 1
K-Points
0
Monkhorst Pack
9 9 9
0 0 0
K-Points
0
Monkhorst Pack
16 16 16
0 0 0
kpoints for band structure L-G-X-U K-G
10
line
reciprocal
0.50000 0.50000 0.50000 ! L
0.00000 0.00000 0.00000 ! G
0.00000 0.00000 0.00000 ! G
0.50000 0.00000 0.50000 ! X
0.50000 0.00000 0.50000 ! X
0.62500 0.25000 0.62500 ! U
0.37500 0.3750 0.75000 ! K
0.00000 0.00000 0.00000 ! G
Pseudopotential of Ni.
8.3 Calculation¶
Change to this example's directory:
cd $TUTORIALS/bulk/e08_*
Step 1.)¶
Determine the optimal lattice constant.
Click to get a hint!
Run your first calculation with
cp INCAR.vol INCAR
cp KPOINTS.vol KPOINTS
mpirun -np 2 vasp_std
Only a maximum of 6 ionic steps will be performed, because otherwise, the volume may change so much that Pulay stress introduces a significant bias towards smaller volume. Repeatedly start a new calculation with the new volume and keep an eye on the difference between CONTCAR and POSCAR to see in what decimal place changes take place!
cp CONTCAR POSCAR
mpirun -np 2 vasp_std
vimdiff CONTCAR POSCAR
vimdiff
can be closed by entering :qa
.
Finally, back up your CHGCAR for the band-structure calculation.
cp CHGCAR CHGCAR.bk
Click to see the answer!
fcc Ni
3.50000000000000
0.5025053959148403 0.5025053959148403 0.0000000000000000
0.0000000000000000 0.5025053959148403 0.5025053959148403
0.5025053959148403 0.0000000000000000 0.5025053959148403
Ni
1
Direct
0.0000000000000000 0.0000000000000000 0.0000000000000000
0.00000000E+00 0.00000000E+00 0.00000000E+00
The optimal lattice constant is $3.5 \cdot 0.5025 / 0.5=3.517$ Å.
Step 2.)¶
Compute the DOS with the optimized structure!
Visualize the structure and DOS using py4vasp!
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e08_fcc-Ni")
mycalc.dos.plot()
Step 3.)¶
Compute the band structure.
cp CHGCAR.bk CHGCAR
cp INCAR.band INCAR
cp KPOINTS.band KPOINTS
mpirun -np 2 vasp_std
Then, visualize the band structure using py4vasp!
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e08_fcc-Ni")
mycalc.band.plot()
8.4 Questions¶
- Does spin up point in positive $\hat{\mathbf{z}}$ direction?
- What qualitative effect does the magnetization have on the DOS?
- What task is the Methfessel-Paxton method used for and which systems should this method not be used for?
By the end of this tutorial, you will be able to:
- choose the exchange-correlation functional with the XC tag
- control the verbosity of the bandgap output with the BANDGAP tag
- set the MAGMOM and LORBIT tags related to the atomic magnetic moment
- extract the bandgap and atomic magnetic moment with py4vasp
9.1 Task¶
Calculate the bandgap and magnetic moment in antiferromagnetic NiO.
Antiferromagnetic NiO belongs to the class of strongly correlated systems because the 3d electrons are well localized around the Ni atoms. Such systems are difficult to describe with standard exchange-correlation functionals of the generalized gradient approximation (GGA), like PBE, that usually lead to qualitatively wrong results for the electronic and magnetic properties.
Thus, strongly correlated systems require using more advanced functionals to treat them with density functional theory. This includes DFT+U, meta-GGA functionals (e.g., SCAN or MBJ), and hybrid functionals (e.g., HSE06). Even more advanced beyond-DFT methods such as dynamical mean-field theory will not be considered in this tutorial.
Below, we apply several functionals to NiO. We compare the resulting bandgap and magnetic moment on the Ni atoms to the experimental values which are in the ranges 4.0–4.3 eV and 1.9–2.2 $\mu_{B}$, respectively.
9.2 Input¶
The input files to run this example are prepared at $TUTORIALS/bulk/e09_AFM-NiO
. Check them out!
NiO (AFII)
4.17
1.0 0.5 0.5
0.5 1.0 0.5
0.5 0.5 1.0
2 2
Cartesian
0.0 0.0 0.0
1.0 1.0 1.0
0.5 0.5 0.5
1.5 1.5 1.5
SYSTEM = NiO with PBE ! antiferromagnetic AFMII
XC = PE ! PBE functional
LASPH = .TRUE. ! non-spherical contribution to the gradient
ISMEAR = -5 ! tetrahedron method
ENCUT = 350 ! cutoff energy
EDIFF = 1E-4 ! convergence criterion
ISPIN = 2 ! spin polarization
MAGMOM = 2 -2 0 0 ! initial magnetic moment
LORBIT = 11 ! atomic magnetic moment is printed
BANDGAP = KPOINT ! more information about the bandgap is printed
DFT+U/INCAR
SYSTEM = NiO with DFT+U ! antiferromagnetic AFMII
XC = CA ! LDA functional
LDAU = .TRUE. ! switches on DFT+U
LDAUTYPE = 2 ! DFT+U variant
LDAUL = 2 -1 ! angular momentum treated with U
LDAUU = 8.00 0.00 ! effective on-site Coulomb interaction (eV)
LDAUJ = 0.95 0.00 ! effective on-site exchange interaction (eV)
LASPH = .TRUE. ! non-spherical contribution to the gradient
ISMEAR = -5 ! tetrahedron method
ENCUT = 350 ! cutoff energy
EDIFF = 1E-4 ! convergence criterion
ISPIN = 2 ! spin polarization
MAGMOM = 2 -2 0 0 ! initial magnetic moment
LORBIT = 11 ! atomic magnetic moment is printed
BANDGAP = KPOINT ! more information about the bandgap is printed
SCAN/INCAR
SYSTEM = NiO with SCAN ! antiferromagnetic AFMII
XC = SCAN ! SCAN functional
LASPH = .TRUE. ! non-spherical contribution to the gradient
ISMEAR = -5 ! tetrahedron method
ENCUT = 350 ! cutoff energy
EDIFF = 1E-4 ! convergence criterion
ISPIN = 2 ! spin polarization
MAGMOM = 2 -2 0 0 ! initial magnetic moment
LORBIT = 11 ! atomic magnetic moment is printed
BANDGAP = KPOINT ! more information about the bandgap is printed
MBJ/INCAR
SYSTEM = NiO with MBJ ! antiferromagnetic AFMII
XC = MBJ ! MBJ potential
LASPH = .TRUE. ! non-spherical contribution to the gradient
ISMEAR = -5 ! tetrahedron method
ENCUT = 350 ! cutoff energy
EDIFF = 1E-4 ! convergence criterion
ISPIN = 2 ! spin polarization
MAGMOM = 2 -2 0 0 ! initial magnetic moment
LORBIT = 11 ! atomic magnetic moment is printed
BANDGAP = KPOINT ! more information about the bandgap is printed
HSE06/INCAR
SYSTEM = NiO with HSE06 ! antiferromagnetic AFMII
XC = PE ! PBE functional
LHFCALC = .TRUE. ! 25% of exchange is from Hartree-Fock
HFSCREEN = 0.2 ! long-range Hartree-Fock exchange is screened
LASPH = .TRUE. ! non-spherical contribution to the gradient
ISMEAR = -5 ! tetrahedron method
ENCUT = 350 ! cutoff energy
EDIFF = 1E-4 ! convergence criterion
ISPIN = 2 ! spin polarization
MAGMOM = 2 -2 0 0 ! initial magnetic moment
LORBIT = 11 ! atomic magnetic moment is printed
BANDGAP = KPOINT ! more information about the bandgap is printed
k-points
0
Gamma
4 4 4
k-points
0
Gamma
3 3 3
Pseudopotentials of Ni and O.
The crystallographic structure of NiO is rocksalt, however in order to accomodate the AFM II antiferromagnetic ordering (ferromagnetic planes stacked along the cubic [111] axis with alternating direction of the magnetic moment), a rhombohedral cell is used. Below, are shown the cubic (conventional) cell (left) and rhombohedral cell (right), where the Ni atoms are in blue (the arrows show the direction of the magnetic moment) and the O atoms are in red:


How many atoms comprise the cubic and rhombohedral unit cells?
Click to see the answer!
In the cubic cell there is one atom at the center of the cell, as well as atoms on the 8 vertices, 6 faces and 12 axes that contribute with $1/8$, $1/2$ and $1/4$, respectively. In total this yields 8 atoms: $$ 1 + 8 \cdot \frac{1}{8} + 6 \cdot \frac{1}{2} + 12 \cdot \frac{1}{4} = 8 $$ Similarly, the rhombohedral cell comprises 4 atoms. Note that the primitive cell of the rocksalt structure has 2 atoms.
In the INCAR file, the tag BANDGAP controls the verbosity for the bandgap in the OUTCAR file.
For magnetic systems, it is particularly important to set the MAGMOM tag that specifies the initial magnetic configuration. In general, this initial configuration strongly influences the magnetic configuration obtained at the end of the calculation (e.g. ferromagnetic versus antiferromagnetic). Therefore, if a particular magnetic configuration is desired, then MAGMOM should be set accordingly. The LORBIT tag selects a projection method onto local quantum numbers and writes the atomic magnetic moments to the OUTCAR and the vaspout.h5 file.
In VASP.6.4.3, we introduced the XC tag to specify the desired exchange-correlation functional. In addition, you can check the documentation to learn how to use it to mix different exchange-correlation functionals.
Since calculations with hybrid functionals are much more expensive than with GGAs or meta-GGAs, less k-points are used for the hybrid HSE06 in order to reduce the computational time. However, note that this crude k-mesh leads to an error of the order of 0.2 eV for the band gap.
9.3 Calculation¶
PBE :
PBE is the standard and most used functional in solid-state pyhsics.
It is used mainly for total-energy calculations, e.g., for the geometry or the binding energy.
Open a terminal, navigate to this example's directory (PBE calculation) and run VASP by entering the following:
cd $TUTORIALS/bulk/e09_*
mpirun -np 2 vasp_std
Extract the fundamental bandgap using py4vasp (in eV).
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO")
mycalc.bandgap.fundamental()
How does the PBE bandgap compare with respect to the range of experimental values mentioned above?
Click to see the answer!
The PBE bandgap is 0.96 eV, which is much smaller than the experimental range of 4.0–4.3 eV.
The fundamental band gap is direct when the valence band maximum and conduction band minimum are at the same k point otherwise it is called indirect. Is the fundamental band gap in NiO direct or indirect? To answer this question one extracts the smallest direct band gap and compares it to the fundamental one.
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO")
mycalc.bandgap.direct()
Click to see the answer!
The smallest direct bandgap is larger than the fundamental bandgap by 0.17 eV. Therefore, the fundamental bandgap is indirect.
Alternatively, the fundamental bandgap can be extracted from the OUTCAR file. By setting the BANDGAP tag, more information are printed, like the bandgap for each spin channel or the k-points at which the valence band maximum and conduction band minimum are located. Execute the following in the terminal.
cd $TUTORIALS/bulk/e09_*
grep -B3 -A2 "fundamental gap" OUTCAR
Why are the bandgaps for the two spin channels the same?
%%bash
cd ./e09_*
grep -B3 -A2 "fundamental gap" OUTCAR
Click to see the answer!
The system is antiferromagnetic, which means that the spin-up and spin-down bands are degenerate.
Next, we extract the atomic magnetic moments using py4vasp.
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO")
mycalc.local_moment.projected_magnetic()
Is the antiferromagnetic configuration the same as the one set by MAGMOM? Why is the magnetic moment on the O atoms exactly zero? How does the PBE Ni magnetic moment compare to the experimental value mentioned above?
Click to see the answer!
The sign of the magnetic moment on the atoms corresponds to what was specified in MAGMOM, i.e., the AFM II magnetic configuration is obtained. The magnetic moment on the O atoms is zero by symmetry. The Ni magnetic moment obtained with PBE (1.37 $\mu_{B}$) is much smaller than the experimental values 1.9–2.2 $\mu_{B}$. Note that the precise magnitude of the magnetic moment also depends on numerical details such as the size of the sphere of the orbital projection. Hence, the magnetic moment may differ from experimental values even if DFT describes the system correctly.
Advanced functionals
Next, let's use more advanced exchange-correlation functionals to see if they predict the fundamental bandgap and the Ni magnetic moment in, at least qualitative, better agreement with experiment. For each of the functionals listed below, run VASP in the terminal and extract the bandgap and magnetic moment.
DFT+U :
In DFT+U, on-site Coulomb and exchange terms are added to the LDA (chosen here) or GGA functional for a better description of localized d or f electrons.
DFT+U is conceptionally simple with a computational cost comparable to the one of the underlying functional.
However, the U parameter is often empirically adjusted reducing the predictive power of this approach.
cd $TUTORIALS/bulk/e09_*/DFT+U
mpirun -np 2 vasp_std
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/DFT+U")
mycalc.bandgap.fundamental()
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/DFT+U")
mycalc.local_moment.projected_magnetic()
SCAN :
SCAN is the most popular functional of the meta-GGA type in solid-state physics.
Meta-GGA functionals include the second derivative of the density to improve the accuracy of the exchange-correlation functional.
This is often done by considering the kinetic energy density.
SCAN is constrained to fulfill various analytic properties of the exact exchange-correlation functional and contains no empirical parameters.
cd $TUTORIALS/bulk/e09_*/SCAN
mpirun -np 2 vasp_std
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/SCAN")
mycalc.bandgap.fundamental()
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/SCAN")
mycalc.local_moment.projected_magnetic()
MBJ :
The MBJ potential is another meta-GGA functional.
As unique selling, it usually captures the band gap of solids quite accurately.
However, MBJ achieves the larger band gaps including an additional potential without a corresponding contribution to the total energy.
Hence, MBJ cannot be used for structural optimization or stability.
cd $TUTORIALS/bulk/e09_*/MBJ
mpirun -np 2 vasp_std
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/MBJ")
mycalc.bandgap.fundamental()
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/MBJ")
mycalc.local_moment.projected_magnetic()
HSE06 :
HSE06 is a screened hybrid functional.
Here, hybrid means that the functional includes a mixture of a local functional and nonlocal Hartree-Fock (HF) exchange.
Since the short-range effects should be stronger, HSE06 screens out the longer range contribution which leads to a faster convergence with respect to the k-point mesh compared to the related PBE0 functional.
Note that the inclusion of HF exchange results in a one to two orders of magnitude more expensive calculations.
cd $TUTORIALS/bulk/e09_*/HSE06
mpirun -np 4 vasp_std
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/HSE06")
mycalc.bandgap.fundamental()
import py4vasp
mycalc = py4vasp.Calculation.from_path( "./e09_AFM-NiO/HSE06")
mycalc.local_moment.projected_magnetic()
Which functionals lead to the best agreement with experiment?
Click to see the answer!
DFT+U, MBJ and HSE06 are the most accurate methods for the bandgap, however nonnegligible underestimation (with DFT+U) or overstimation (with MBJ and HSE06) is still obtained.
DFT+U and MBJ lead to the best agreement with experiment for the Ni magnetic moment. The value is around 1.73 $\mu_{B}$, which is however still smaller than the range of experimental values. Nevertheless, note that the magnetic moment obtained from the calculations does not include the orbital contribution (only the spin contribution is calculated). The orbital contribution in NiO is estimated to be in the range 0.3–0.45 $\mu_{B}$.
9.4 Questions¶
- Among the considered functionals, which ones contain parameters that could be tuned to possibly improve the results?
- HSE06 and MBJ lead to rather similar results for the bandgap and magnetic moment. Which one is computationally more efficient?