**by****Ute Werner****for****exciting****beryllium**

** Purpose:** In this tutorial, you will learn how to use different exchange-correlation (XC) functionals and the

`library. As an example, the optimal volume and bulk modulus of silicon are calculated.`

**libxc**### 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. In this tutorial, we consider as an example the calculation of the energy-vs-volume curves for silicon in the fcc cubic structure. Inside this directory, 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 (

`) is used. For further details and perarmeters see`

**LDA_PW**`. Set the correct path for the exciting root directory (`

**Input Reference**`) to the one pointing to the place where the`

**$EXCITINGROOT**`directory is placed.`

**exciting**`$ SETUP-excitingroot.sh`

##### ii) Execute the calculations

Use the given example to create input files for the ` LDA_PW` and

`(general gradient approximation, GGA) functionals. Perform the calculations for the two functionals as you have already learned in the tutorial`

**GGA_PBE_SOL**`. Since you will run several sets of calculations, it is recommended to decrease the number of volume values, e.g., to 7.`

**Volume Optimization for Cubic Systems**```
$ 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`.

Repeate the procedure for different exchange-correlation functionals.

##### 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.

`). Compare them to the experimental values, which you can obtain, e.g., from the`

**Volume Optimization for Cubic Systems**`site. You can also use the Python script`

**WebElements**`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**```
$ 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

`exchange-correlation functional and the second the ones corresponding to`

**LDA_PW**`calculation. If you enter`

**GGA_PBE_SOL**`, the input will be terminated. Using the given example you will obtain the following plot.`

**Quit**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

`can be added to the`

**libxc**`element in the`

**groundstate**`input. The XC functional can then be chosen with the attributes`

**exciting****or**

`xc`**and**

`exchange`**, as described in detail in**

`correlation``.`

**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> ...

### 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** : J. P. Perdew and Y. Wang,`LDA_PW`*Phys. Rev. B***23**, 5048 (1981); D.M. Ceperly and B.J. Alder,*Phys. Rev. Lett.***45**, 566 (1980): J. P. Perdew, A. Ruzsinszky, G. I. Csonka, O. A. Vydrov, G. E. Scuseria, L. A. Constantin, X. Zhou, and K. Burke,`GGA_PBE_SOL`*arXiv:***0707.2088v1**(2007): J. P. Perdew, K. Burke, and M. Ernzerhof,`GGA_PBE`*Phys. Rev. Lett.***77**, 3865 (1996)