by Ute Werner for exciting boron
Purpose: In this tutorial, you will learn how to use different exchange-correlation (XC) functionals and the libxc library. As an example, the optimal volume and bulk modulus of silicon are calculated.
1. Introduction
We assume you are already familiar with the ideas and the scripts shown in Volume optimization for cubic systems. Here, we will use these scripts to compare XC functionals. The comparison of results obtained for the equilibrium volume and bulk modulus for different XC functionals gives information on the validity and applicability of the functionals.
2. Directly implemented functionals
i) Preparation of the input file
The first step is to create a directory for the system that you want to investigate.
$ mkdir XC-functionals
$ cd XC-functionals
In this tutorial, we consider as an example the calculation of the energy-vs-volume curves for silicon in the fcc cubic structure. Inside the directory XC-functionals, we create the file input.xml corresponding to a SCF calculation at a reference lattice constant. The input file employing the experimental lattice constant could look like the following.
<input> <title>Silicon</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="10.261"> <basevect> 0.0 0.5 0.5 </basevect> <basevect> 0.5 0.0 0.5 </basevect> <basevect> 0.5 0.5 0.0 </basevect> </crystal> <species speciesfile="Si.xml"> <atom coord="0.00 0.00 0.00" /> <atom coord="0.25 0.25 0.25" /> </species> </structure> <groundstate ngridk="8 8 8" swidth="0.01" rgkmax="8.0" xctype="LDA_PW"> </groundstate> </input>
The parameter xctype specifies the XC functional that will be used in the calculation. In this example, the local spin density approximation (LDA_PW) is used. For further details and perarmeters see Input Reference. Set the correct path for the exciting root directory ($EXCITINGROOT) to the one pointing to the place where the exciting directory is placed.
$ SETUP-excitingroot.sh
ii) Execute the calculations
Use the given example to create input files for xctype = "LDA_PW" and xctype = "GGA_PBE_SOL" (general gradient approximation, GGA) functionals. Perform the calculations for the two functionals as you have already learned in the tutorial Volume optimization for cubic systems. Since you will run several sets of calculations, it is recommended to decrease the number of volume values, e.g., to 7.
$ SETUP-volume-optimization.py workdir_LDA
Enter the number of volume values >>>> 7
$
To execute the calculations, run
$ EXECUTE-volume-optimization.sh workdir_LDA
...
Further details can be found in Volume optimization for cubic systems.
iii) Post processing: Comparison of XC functionals
In order to compare the different XC functionals, calculate the lattice constant and the bulk modulus with the script CHECKFIT-energy-vs-volume.py (cf. Volume optimization for cubic systems). Compare them to the experimental values, which you can obtain, e.g., from the WebElements site. You can also use the Python script PLOT-volumecurves.py for a graphical comparison of the fitted energy-versus-volume curves for different functionals. The script will produce the following output on the screen.
$ PLOT-volumecurves.py
################################################
Enter list of working directories
Entering "Quit" will terminate the input
################################################
directory name: workdir_LDA
directory name: workdir_PBE_SOL
directory name: Quit
$
In this example, the input entry is preceded by "directory name: ". The entry values must be typed on the screen and must be the name of the directories which contain your results for different XC functionals. In the example, the first entry contains results obtained using the LDA_PW exchange-correlation functional and the second the ones corresponding to GGA_PBE_SOL calculation. If you enter Quit, the input will be terminated. The script PLOT-volumecurves.py produces a PostScript (XC.eps) and a PNG (XC.png) output file, as well as an image on the screen. Using the given example you will obtain the following plot.
For a better comparison, the minima of the energy curves are shifted to zero.
3. Use of libxc
In order to use a wider variety of XC functionals or to combine different functionals for exchange and correlation, the libxc library can be used. For this purpose, the element libxc can be added to the groundstate element in the exciting input. The XC functional can then be chosen with the attributes xc or exchange and correlation, as described in detail in Input Reference.
Remarks:
- Not every functional, especially not every combination of exchange and correlation, may give stable results. For more details on the validity and applicability of different functionals, please look at the tables shown here.
- Further details concerning different functionals can be found in the libxc wiki.
Example calculation
Repeat the calculation for silicon from the previous section, but this time employing the libxc library. For this purpose, use the previous input file and replace the groundstate element with the following lines.
... <groundstate ngridk="8 8 8" swidth="0.01" rgkmax="8.0"> <libxc correlation="XC_GGA_C_PBE" exchange="XC_GGA_X_PBE"> </libxc> </groundstate> ...
If you plot your new results together with the previous results from LDA_PW and GGA_PBE_SOL using the script PLOT-volumecurves.py (see above), you will obtain the following plot:
4. Exercises
- Repeat the example of silicon for different XC functionals and try to find the best agreement with the experimental values.
- Investigate the influence of different combinations of exchange and correlation functionals on calculations performed for another material, e.g., silver.
5. Literature
- "XC functionals in exciting": Tutorial talk (PDF) at the HoW exciting! 2014 workshop in Berlin.
- LDA_PW: J. P. Perdew and Y. Wang, Phys. Rev. B 23, 5048 (1981); D.M. Ceperly and B.J. Alder, Phys. Rev. Lett. 45, 566 (1980)
- GGA_PBE_SOL: J. P. Perdew, A. Ruzsinszky, G. I. Csonka, O. A. Vydrov, G. E. Scuseria, L. A. Constantin, X. Zhou, and K. Burke, arXiv:0707.2088v1 (2007)
- GGA_PBE: J. P. Perdew, K. Burke, and M. Ernzerhof, Phys. Rev. Lett. 77, 3865 (1996)