Phonons at Γ in Diamond-Structure Crystals

by Pasquale Pavone for exciting fluorine

Purpose: In this tutorial, you will learn how to set up and execute a series of calculations for a crystal in the diamond structure, where the second atom in the unit cell is displaced along the cube diagonal. Additionally, it will be explained how to obtain the phonon frequency of the optical modes at q=0 (Γ point), by calculating the derivatives of the energy-vs-displacement and force-vs-displacement curves at zero displacement.


0. Define relevant environment variables

Read the following paragraphs before starting with the rest of this tutorial!

Before starting, be sure that relevant environment variables are already defined as specified in 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.

  • SETUP-diamond-phonon-g.py: Python script for generating structures with displaced atoms.
  • EXECUTE-diamond-phonon-g.sh: (Bash) shell script for running a series of exciting calculations.
  • CHECKFIT-energy-vs-displacement.py: Python script for extracting the derivatives at zero displacement of the energy-vs-displacement curves.
  • CHECKFIT-force-vs-displacement.py: Python script for extracting the derivatives at zero displacement of the force-vs-displacement curves.
  • PLOT-energy.py: Python visualization tool for the energy-vs-displacement curves.
  • PLOT-atomforce.py: Python visualization tool for the force-vs-displacement curves.
  • PLOT-status.py: Python visualization tool for the RMS deviations of the SCF potential as a function of the iteration number during the SCF loop.
  • PLOT-checkderiv.py: Python visualization tool for the fit of the derivatives of the energy-vs-displacement curves at zero displacement.

From now on the symbol $ will indicate the shell prompt.

Requirements: Bash shell. Python numpy, lxml, matplotlib.pyplot, and sys libraries. Gnuplot (visualization tools).


1. Set up the calculations

i) Preparation of the input file

The first step is to create a directory for each system that you want to investigate. In this tutorial, we consider as an example the calculation of the energy-vs-displacement curves for carbon in the diamond structure. Thus, we will create a directory diamond-phonon-g and we move inside it.

$ mkdir diamond-phonon-g
$ cd diamond-phonon-g

Inside this directory, we create (or copy from a previous calculation) the file input.xml corresponding to a calculation for the equilibrium structure of diamond. This file could look like the following

<input>
 
   <title>Diamond: Phonons at Gamma</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 
      ngridk="2 2 2"
      xctype="GGA_PBE"
      swidth="0.0001"
      rgkmax="4.0"
      gmaxvr="14"
      tforce="true">
   </groundstate>
 
</input>

Please, remember that the input file for an exciting calculation must always be called input.xml. After creating the input file, set the path for the species file using the command

$ SETUP-excitingroot.sh

Furthermore

  • do not perform any structural optimization.
  • perform the calculation of the force acting on the atoms by adding the tforce = "true" attribute to the groundstate element:
...
   <groundstate
      ...
      tforce="true">
   </groundstate>
...
ii) Generation of input files for the different structures

In order to generate input files for a series of different structures you have to run the script SETUP-diamond-phonon-g.py. Notice that the script SETUP-diamond-phonon-g.py always generates a working directory containing input files for different atomic displacements. Results of the current calculations will be also stored in the working directory. The directory name (in this example gamma-1) can be specified by adding the name in the command line.

$ SETUP-diamond-phonon-g.py gamma-1

If the directory name is not given explicitly, the script SETUP-diamond-phonon-g.py generates a directory called by default workdir.

Very important: The working directory is overwritten each time you execute the script SETUP-diamond-phonon-g.py. Therefore, choose different names for different calculations.

The script SETUP-diamond-phonon-g.py produces the following output on the screen (using gamma-1 as working directory).

$ SETUP-diamond-phonon-g.py gamma-1

Enter maximum displacement umax [u/(lat. parameter)] >>>> 0.025

Enter the number of displacements in [-umax,umax] >>>> 11

$

In this example, (on screen) input entries are preceded by the symbol ">>>>". The entry values must be typed on the screen when requested. The first entry (in our example 0.025) represents the absolute value of the maximum displacement (for each component, in crystal coordinates) for which we want to perform the calculation. The second entry (11) is the number of structures equally spaced in the displacement of the second atom, which are generated between the maximum negative displacement and the maximum positive one.


2. Execute the calculations

To execute the series of calculations with input files created by SETUP-diamond-phonon-g.py you have to run the script EXECUTE-diamond-phonon-g.sh. If a name for the working directory has been specified, then you must give it here, too.

$ EXECUTE-diamond-phonon-g.sh gamma-1

Running exciting for file input-01.xml ----------------------------------

...

Run completed for file input-11.xml -------------------------------------

$

After the complete run, inside the directory gamma-1 the results of the calculation for the input file input-i.xml are contained in the subdirectory rundir-i where i is running from 01 to the total number of strain values. The data for the energy-vs-displacement and force-vs-displacement curves are contained in the files energy-vs-displacement and force-vs-displacement, respectively. More precisely, the file force-vs-displacement contains the x component of the force acting on the second atom in the unit cell as a function of the displacement.


3. Post-processing: Extract energy derivatives

In order to analyse the results of the calculations, you first have to move to the working directory.

$ cd gamma-1

At this point, you can use the python script CHECKFIT-energy-vs-displacement.py for extracting the derivatives of the energy-vs-displacement curves at zero displacement.

$ CHECKFIT-energy-vs-displacement.py 

Enter maximum displacement for the fit >>>> 0.025

Enter the order of derivative >>>> 2

Enter atomic mass in [amu] >>>> 12.01

#############################################

 Fit data------------------------------------

 Maximum value of the displacement  ==> 0.025
 Number of displacement values used ==>    11 

 Fit results for the derivative of order    2 

 Polynomial of order  2  ==>   1602.12 [cm-1]
 Polynomial of order  3  ==>   1602.12 [cm-1]
 Polynomial of order  4  ==>   1584.17 [cm-1]
 Polynomial of order  5  ==>   1584.17 [cm-1]
 Polynomial of order  6  ==>   1584.05 [cm-1]
 Polynomial of order  7  ==>   1584.05 [cm-1]

 Polynomial of order  2  ==>   48.0303  [THz]
 Polynomial of order  3  ==>   48.0303  [THz]
 Polynomial of order  4  ==>   47.4922  [THz]
 Polynomial of order  5  ==>   47.4922  [THz]
 Polynomial of order  6  ==>   47.4885  [THz]
 Polynomial of order  7  ==>   47.4885  [THz]

#############################################

$

In this example, the input entries are preceded by the symbol ">>>>". The entry values must be typed on the screen when requested. The first entry (in our example 0.025) represents the absolute value of the maximum displacement for which we want to perform the analysis. The second entry (2) is the order of the derivative that we want to obtain. Finally, the third entry (12.01) is the atomic mass of carbon in units of [amu].

NOTICE that, in this example, the values which are given above as output on the screen are not directly the actual second derivative of the energy-vs-displacement curves, but the values of the frequency, i.e., combinations involving the square root of the derivative (see Section 6. for the explanation).

The script CHECKFIT-energy-vs-displacement.py generates the output files check-energy-derivatives and order-of-derivative, which can be used in the post-processing analysis.


4. Post-processing: Extract force derivatives

The procedure for extracting the derivatives of the force-vs-displacement curves is very similar to the one exposed in the previous Section for the energy-vs-displacement curves. You can use the python script CHECKFIT-force-vs-displacement.py for extracting the derivatives of the force-vs-displacement curves at zero displacement. The meaning of the input entries for this script is the same as for CHECKFIT-energy-vs-displacement.py (see above). The only difference is that the derivative which one has to calculate in order to extract the phonon frequencies is the first one. Here, is an example of execution of the script CHECKFIT-force-vs-displacement.py.

$ CHECKFIT-force-vs-displacement.py 

Enter maximum displacement for the fit >>>> 0.025

Enter the order of derivative >>>> 1

Enter atomic mass >>>> 12.01

#############################################

 Fit data------------------------------------

 Maximum value of the displacement  ==> 0.025
 Number of displacement values used ==>    11 

 Fit results for the derivative of order    1 

 Polynomial of order  1  ==>   1605.97 [cm-1]
 Polynomial of order  2  ==>   1605.97 [cm-1]
 Polynomial of order  3  ==>   1580.60 [cm-1]
 Polynomial of order  4  ==>   1580.60 [cm-1]
 Polynomial of order  5  ==>   1580.62 [cm-1]
 Polynomial of order  6  ==>   1580.62 [cm-1]

 Polynomial of order  1  ==>   48.1456  [THz]
 Polynomial of order  2  ==>   48.1456  [THz]
 Polynomial of order  3  ==>   47.3852  [THz]
 Polynomial of order  4  ==>   47.3852  [THz]
 Polynomial of order  5  ==>   47.3859  [THz]
 Polynomial of order  6  ==>   47.3859  [THz]

#############################################

$

5. Post-processing: Visualization tools

All the scripts mentioned here must be executed in the directory where the energy-vs-displacement, force-vs-displacement, check-energy-derivatives, and order-of-derivative files are located. The scripts produce as output a PostScript file named PLOT.ps .

i) PLOT-energy.py

This script allows for the visualization of the energy-vs-displacement curve. It is executed as follows.

$ PLOT-energy.py
In the following, we display the result for the example mentioned above.
fluorine-c-energy.png

ii) PLOT-checkderiv.py

This is a very important tool that allows to represent the dependence of the calculated derivatives of the energy-vs-displacement and force-vs-displacement curves on

  • the range of points included in the fitting procedure ("maximum displacement u"),
  • the maximum degree of the polynomial used in the fitting procedure ("n").

The script PLOT-checkderiv.py requires as input the check-energy-derivatives and order-of-derivative files generated by CHECKFIT-energy-vs-displacement.py or CHECKFIT-force-vs-displacement.py. If PLOT-checkderiv.py is executed after CHECKFIT-energy-vs-displacement.py, it will give information on the energy derivatives, if it is executed after CHECKFIT-force-vs-displacement.py, force derivatives are considered. The script PLOT-checkderiv.py is executed as follows.

$ PLOT-checkderiv.py YMIN YMAX
One or two optional entries can be specified on the calling line. Assigning numerical values to these two entries, you can set the minimum (YMIN) and the maximum (YMAX) value on the vertical axis, respectively. An example of the script output for the energy derivatives (i.e., the output of PLOT-checkderiv.py obtained after running CHECKFIT-energy-vs-displacement.py) is the following.
fluorine-c-checkderiv.png

The previous plots can be used to determine the best range of displacements and order of polynomial fit. By analyzing the plot, we note that curves corresponding to the higher order of the polynomial used in the fit show a horizontal plateau at about 1584 cm-1. This can be assumed to be the converged value for the second derivative, from the point of view of the fit (see the analogue case in Energy vs. strain calculations).

NOTICE that, in this example, the values which are given above as output on the screen are not directly the actual second derivative of the energy-vs-displacement curves, but the values of the frequency, i.e., combinations involving the square root of the derivative (see Section 6. for the explanation).

iii) PLOT-status.py

Python visualization tool for the root mean squared (RMS) deviations of the effective SCF potential as a function of the iteration number during the SCF loop. It is executed as follows.

$ PLOT-status.py LABEL
Here, the entry on the command line, LABEL, must be specified and represents the name of the directory where an exciting calculation has been or is still running. The PLOT-status.py is particularly useful in the latter case because one can follow "live" the convergence of the calculation. An example of the PostScript output of the script is the following.
fluorine-c-status.png

iv) PLOT-atomforce.py

This script allows for the visualization of the force-vs-displacement curve. It is executed as follows.

$ PLOT-atomforce.py
In the following, we display the result for the example mentioned above.
fluorine-c-atomforce.png

6. Post-processing: How to derive the optical phonon frequency at q=0 (Γ point)

i) Using the energy-vs-displacement curves

The total energy per unit cell of a crystal where the atoms are displaced by their equilibrium positions can be written as a Taylor series

E({u}) = E0 + 1/2 ΣR,R' u(R) Φ(R,R') u(R') + O(u3)

where E0 is the energy corresponding to the equilibrium structure, u(R) is an atomic displacement in the cell R, Φ(R,R') is the inter-atomic force-constants matrix, and O(u3) includes all orders higher than two in the displacements u. For small displacements, terms beyond the harmonic approximation (which retains only terms that are quadratic in u) can be neglected. For the diamond structure and a phonon pattern corresponding to the optical phonon at the Γ point, the displacements of the 2 atoms in the unit cell can be given as

u1(R) = (0, 0, 0)
u2(R) = a (u, u, u)

where a is the lattice constant. The same displacements hold in all unit cells of the crystal. Therefore, for an optical phonon at q=0, the total energy per unit cell of the crystal can be written as (see details here):

E({u}) = E0 + 3/4 m a2opt)2 u2

Using appropriate values for m and a and their units, the phonon frequency of the optical mode at the Γ point for the diamond structure is given directly from the square root of the second derivative of the energy-vs-displacement curves. This is the output of the fit procedure exposed above if the order of the derivative is taken equal to 2. The optical phonon frequency is obtained from the plateau value of the second-order derivative at zero displacement of the energy-vs-displacement curves. For more details on the procedure used for extracting numerical derivatives, see Energy vs. strain calculations, where the same approach is used for calculating elastic constants.

ii) Using the force-vs-displacement curves

Using the same phonon displacement pattern as above, the component in the x direction of the force acting on the second atom is (within the harmonic approximation):

F2x({u}) = -1/2 m a (ωopt)2 u

This force obviously vanishes in the equilibrium configuration (u=0). Similarly to the previous case, the frequency is obtained from the plateau value of the first-order derivative at zero displacement of the force-vs-displacement curves.

Exercises
  • The frequency values which are obtained in this example using the quoted parameters, are not realistic. Check the convergence of the optical phonon frequency for diamond with respect of the value of the ngridk and rgkmax attributes using
    1. derivatives of the total energy,
    2. derivatives of the force acting on the atoms.
  • Repeat all the calculation for Silicon.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License