by Pasquale Pavone, Stefan Kontur, & Axel Hubner for exciting fluorine
Purpose: In this tutorial, you will learn how to perform a phonon calculation and to obtain properties like frequencies and eigenvectors, the density of modes (or phonon density of states), thermodynamic properties, and phonondispersion relations. You will work through the example of diamond.
Note: In this tutorial the frozenphonon or supercell approach will be used to compute phonons. Alternatively, you can use densityfunctional perturbation theory (DFPT) for phonon calculations. To this end, see Phonon properties of diamondstructure crystals (DFPT). We recommend to work through this tutorial first before going to DFPT phonons.
Table of Contents

0. Prerequisites
This tutorial assumes that you have already set the relevant environment variables. Otherwise, please have a look at How to set environment variables for tutorials scripts. Here, is a list of the scripts which are relevant for this tutorial with a short description.
 FREEfromdos.py: Python script for calculating thermodynamic properties.
 PLOTdos.py: Python visualization tool for the phonon density of states.
 PLOTbandstructure.py: Python visualization tool for phonondispersion curves.
 PLOTfiles.py: Python visualization tool used by some of the other scripts.
Note: The symbol $ at beginnings of lines in code segments below indicates the shell prompt.
In the following we use the conversion factor 1 Ha $\approx$ 2.194 746 x 10^{5} cm^{1}.
All results obtained in this tutorial for diamond can be compared with theoretical and experimental data present in the literature.
In order to start, create a new working directory, e.g., /home/tutorials/diamondphonons.
$ cd /home/tutorials
$ mkdir diamondphonons
$ cd diamondphonons
1. Set up an input file for a phonon calculation
If you already completed Phonons at Γ in diamondstructure crystals you can copy the input file into diamondphonons as a starting point and modify it as discussed below.
1.1) Define structural parameters
First, the parameter defining your structure should be defined. In this example, we consider carbon in the diamond phase. The structure part of the input file looks then like the following.
... <structure speciespath="$EXCITINGROOT/species"> <crystal scale="6.7468"> <basevect>0.5 0.5 0.0</basevect> <basevect>0.5 0.0 0.5</basevect> <basevect>0.0 0.5 0.5</basevect> </crystal> <species speciesfile="C.xml" rmt="1.25"> <atom coord="0.00 0.00 0.00" /> <atom coord="0.25 0.25 0.25" /> </species> </structure> ...
The chosen lattice parameter of 6.7468 refers to the converged equilibirum parameter for diamond, as obtained with the PBE exchangecorrelation functional.
1.2) Parameters for the groundstate calculation
Then, parameters for performing the SCF have to be specified. In this example, we use the GGA functional of Perdew, Burke, and Ernzerhof (PBE), other choices can be found in the description of the attribute xctype of the element groundstate.
... <groundstate do="fromscratch" ngridk="2 2 2" swidth="0.0001" rgkmax="4.0" gmaxvr="14" xctype="GGA_PBE"/> ...
Note that this example of input contains values for the parameters ngridk and rgkmax which allow for fast calculations but should not be considered realistic. A detailed description of how to achieve convergence with respect to these parameters can be found in Simple convergence tests.
1.3) Set up the supercell phonon calculation
Simple frozenphonon calculations can be performed only at highsymmetry points in the Brillouin zone (see, e.g., Phonons at Γ in diamondstructure crystals and Phonons at X in diamondstructure crystals). With exciting, we can also perform phonon calculations at any point in the Brillouin zone using the supercell method and phonon interpolation. The input block in which this method is used is the one specified by the element phonons. In supercell phonon calculations, the size of the supercell is specifyed by the periodicity (the wavevector q) of the phonon displacements which are considered. For instance, as mentioned in Phonons at X in diamondstructure crystals, the supercell corresponding to the X point has a size which is twice the one of the unperturbed crystal.
In general, for calculating phonon properties, you must specify the attribute ngridq inside phonons. Setting ngridq = "n1 n2 n3", we are asking exciting to calculate all the phonons corresponding to all the qpoints belonging to a "n1 n2 n3" mesh in reciprocal space. In this case, exciting performs calculation for supercell defined by multiplying the crystal basis vectors of the unit cell by n1, n2, and n3, respectively. The qpoints mesh is defined in the same way as the kpoints grid (specified by ngridk), which is used in calculating the electronic ground state. However, the choices of the kpoints and qpoints meshes are completely uncorrelated.
In the following example, we choose ngridq = "2 2 2", which corresponds to a supercell with all crystal basis vectors doubled with respect to the unit cell of the unperturbed crystal.
... <phonons do="fromscratch" method="sc" ngridq="2 2 2"> ... </phonons> ...
Further attributes of the element phonons are the following.
 method, that controls the method employed to compute phonons (default is "dfpt").
 deltaph, that controls the step size for atom displacements (default is 0.03 Bohr).
 reduceq, which uses crystal symmetry to reduce the qpoints (default is "true").
Inside the element phonons, you can insert optional elements, requesting various phonon properties. A basic example is the element qpointset.
... <qpointset> <qpoint> 0.0 0.0 0.0 </qpoint> <qpoint> 0.5 0.5 0.0 </qpoint> <qpoint> 0.5 0.5 0.5 </qpoint> </qpointset> ...
This element is needed in order to let exciting calculate phonon eigenvalues (frequencies) and eigenvectors for the qpoints specified in each subelement qpoint. In the example above, calculations will be performed for Γ, X, and L phonons (in the standard notation for highsymmetry points in the Brillouin zone of fcc crystals). Note that qpoints are given in reciprocal lattice coordinates. Additional properties are discussed in Section 2.
1.4) The basic input file for a phonon calculation
We are now ready to run the actual phonon calculation. Create a subdirectory ctest and move inside it to run the calculations.
$ mkdir ctest
$ cd ctest
Jobs which runs a phonon calculation are in general a bit lengthy, because they use supercells which are larger than the primitive cell of the crystal. The present calculation should take about 15 minutes on a recent CPU with the loose parameters specified. Note that they can also be run in parallel. The complete input file for this calculation is given in the following.
<input> <title>Diamond: Phonons</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="6.7468"> <basevect>0.5 0.5 0.0</basevect> <basevect>0.5 0.0 0.5</basevect> <basevect>0.0 0.5 0.5</basevect> </crystal> <species speciesfile="C.xml" rmt="1.25"> <atom coord="0.00 0.00 0.00" /> <atom coord="0.25 0.25 0.25" /> </species> </structure> <groundstate do="fromscratch" ngridk="2 2 2" swidth="0.0001" rgkmax="4.0" gmaxvr="14" xctype="GGA_PBE"/> <phonons do="fromscratch" method="sc" ngridq="2 2 2"> <qpointset> <qpoint> 0.0 0.0 0.0 </qpoint> <qpoint> 0.5 0.5 0.0 </qpoint> <qpoint> 0.5 0.5 0.5 </qpoint> </qpointset> </phonons> </input>
Please, remember that after creating the input file input.xml, the path for the species file must be set using the command
$ SETUPexcitingroot.sh
Now, you can run exciting by using the command
$ time exciting_smp &
The calculation is completed if the file PHONON.OUT has been created. This can be checked by the command
$ ls PHONON.OUT
1.5) Output files of a phonon calculation
The dynamical matrix is set up from a series of supercell groundstate calculations. In a typical supercell calculation of this series, all atoms which are equivalent to a given atom in the primitive cell of the unpertubed crystal are displaced along a cartesian direction. The actual displacement pattern of these atoms is a cosinus or sinus wave with periodicity defined by the wavevector q. The amplitude of the wavelike displacement pattern is defined by the value Δ_{ph} of the attribute deltaph. Finally, elements of the dynamical matrix are obtained using a finite difference procedure from atomic forces calculated for displacement patterns with amplitude Δ_{ph} and 2Δ_{ph} (Δ_{ph} and Δ_{ph} at q=0).
After a successful phonon calculation, a number of subdirectories are created. The names of these directory include information, in order of appearance, on the q vector (Q…), the species of the displaced atoms (S…), the index in the unperturbed primitive cell of the displaced atoms (A…), and the polarization direction of the displacement (P…). Example of such names are Q0000_0000_0000_S01_A001_P1, Q0102_0000_0000_S01_A001_P1, etc.
A typical phonon calculation produces in addition the following files.

Here, fileext means an extension of the filename, again naming the corresponding qpoint of the grid, species, atom, and polarization.
As indicated above, the frequencies of the phonon modes at the required qpoints are listed inside the file PHONON.OUT. However, in this file frequencies are given in non frequently used atomic units. In order to get frequency values which can be compared to experimental data, you may use the script CONVERTau2invcm.py to obtain frequencies expressed in units of cm^{1}.
$ CONVERTau2invcm.py
############################################

Total number of atoms : 2
Total number of qpoints : 3

qpoint 1 is 0.0 0.0 0.0
mode 1 frequency: 0.0000 cm1
mode 2 frequency: 0.0000 cm1
mode 3 frequency: 0.0000 cm1
mode 4 frequency: 1580.5233 cm1
mode 5 frequency: 1580.5233 cm1
mode 6 frequency: 1580.5233 cm1
qpoint 2 is 0.5 0.5 0.0
mode 1 frequency: 523.8800 cm1
mode 2 frequency: 523.8800 cm1
mode 3 frequency: 1096.3667 cm1
mode 4 frequency: 1096.3667 cm1
mode 5 frequency: 1128.0147 cm1
mode 6 frequency: 1128.0147 cm1
qpoint 3 is 0.5 0.5 0.5
mode 1 frequency: 459.4412 cm1
mode 2 frequency: 459.4412 cm1
mode 3 frequency: 869.1994 cm1
mode 4 frequency: 1238.7323 cm1
mode 5 frequency: 1400.8203 cm1
mode 6 frequency: 1400.8203 cm1
############################################
Exercise
 Have a look to the file PHONON.OUT. What is the frequency of the optical phonon modes at Γ?
 What are the eigenvectors of the optical phonon modes at Γ?
2. Properties from the phonon calculation
To obtain other phonon properties, additional subelements can be inserted inside the element phonons, as explained in the following.
2.1) Phonon density of states (DOS)
The phonon density of states is computed on top of the phonon calculation by adding the element phonondos within the element phonons.
... <phonondos ngrdos="300" nwdos="1000" nsmdos="2"/> ...
Here, phonon frequencies are computed on a dense grid (ngrdos$\times$ngrdos$\times$ngrdos) and collected to obtain the DOS, which is written to the file PHDOS.OUT. The number of steps between the lowest and highest frequency (N$_{\omega}$) is given by nwdos, nsmdos is the number of times the data are smoothened.
The complete input file in this case is shown below.
<input> <title>Diamond: PhononDOS</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="6.7468"> <basevect>0.5 0.5 0.0</basevect> <basevect>0.5 0.0 0.5</basevect> <basevect>0.0 0.5 0.5</basevect> </crystal> <species speciesfile="C.xml" rmt="1.25"> <atom coord="0.00 0.00 0.00" /> <atom coord="0.25 0.25 0.25" /> </species> </structure> <groundstate do="skip" ngridk="2 2 2" swidth="0.0001" rgkmax="4.0" gmaxvr="14" xctype="GGA_PBE"/> <phonons do="skip" method="sc" ngridq="2 2 2"> <phonondos ngrdos="300" nwdos="1000" nsmdos="2"/> </phonons> </input>
Note the presence of the two attributes do = "skip" inside the elements phonons and groundstate, respectively. They let exciting skip a new (and lengthy) phonon calculation and read the necessary data from existing files. This requires you, of course, to have already performed the basic phonon calculation with the same parameters (as in Section 1.4) and to work in the same directory. If this is the case, in order to perform the calculation, you type
$ SETUPexcitingroot.sh
$ time exciting_smp &
Data in PHDOS.OUT can be plotted directly. You can use the script PLOTdos.py (see The python script "PLOTdos.py"), by typing on the command line
$ PLOTdos.py p e 0 1600
The script produces a PNG (PLOT.png) output, which should be similar to the one displayed here.
A better converged result (using an 8$\times$8$\times$8 kgrid, rgkmax = "7.0", and 4 qpoints in each direction) can be found below.
2.2) Thermodynamic properties
The zeropoint energy, E_{zp}, and further thermodynamic properties can be computed from the phonon DOS g$(\omega)$ (see Input reference for further details).
 the vibrational free energy F_{vib}= U_{vib} TS_{vib},
 the vibrational internal energy U_{vib},
 the entropic contribution to the vibrational free energy TS_{vib},
 the vibrational entropy S_{vib}
 the heat capacity C_{v}.
In order to calculate and visualize these thermodynamic properties, you can use the script FREEfromdos.py as follows
$ FREEfromdos.py 0 1600 160 eV
Zeropoint energy is 3.5040e01 [eV]
Created PNG output "PLOTfreeenergies.png"
Created PNG output "PLOTentropy.png"
Created PNG output "PLOTheatcapacity.png"
$
where the 4 online entries are the minimum temperature (usually 0), the maximum temperature, the number of temperature steps between the minimum and the maximum, and the energy units (either eV or Ha) . The value of the calculated zeropoint energy is written on the screen output. The script also generates three PNG output files: PLOTfreeenergies.png, PLOTentropy.png, and PLOTheatcapacity.png. These results can be visualized by watching directly the PNG files with standard tools. Examples are given in the following:
Better converged plots can be seen here.
2.3) Phonondispersion relations
Phonondispersion relations can also be easily calculated. Phonon eigenvalues are computed along a path through the Brillouin zone and written for later plotting. This path can be specified within the element phonondispplot (reciprocal lattice coordinates) in the following way (a path between the points Γ(K)XΓL is specified in the present example).
... <phonondispplot> <plot1d> <path steps="400"> <point coord="1.0 0.0 0.0" label="Gamma"/> <point coord="0.625 0.375 0.0" label="K"/> <point coord="0.5 0.5 0.0" label="X"/> <point coord="0.0 0.0 0.0" label="Gamma"/> <point coord="0.5 0.0 0.0" label="L"/> </path> </plot1d> </phonondispplot> ...
This codelet is to be included within the element phonons, same as for qpointset and phonondos above. Of course, one can reuse data of a previous phonon calculation by adding do = "skip" to the elements phonons and groundstate. This run produces the file PHDISP.OUT that contains the phonon eigenvalues along the path specified in the input and can be plotted directly. The script PLOTbandstructure.py (see The python script "PLOTbandstructure.py"), can be used to produce a plot of the phonondispersion relations.
$ PLOTbandstructure.py p a KS
The resulting PNG file PLOT.png looks like the following.
Converged results as mentioned above can be seen below.
2.4) Other useful features
Exercise: Silicon in diamond structure
 The calculation presented here for diamond can be repeated for silicon. Use the PBE exchangecorrelation functional, an equilibrium lattice parameter of 10.34 Bohr, and low values for both k and qpoint grids to accelerate the runs, as above.
 Compare your results with the "converged" one displayed here.