for helium version of Exciting
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.
Table of Contents
|
1. Define relevant shell variables and download scripts
Very important: Before starting, the following shell variables must be set by the user:
EXCITINGROOT = Directory where exciting has been downloaded, e.g.: /home/user/exciting .
EXCITINGRUNDIR = Directory where the user runs all the calculations (must be existing!!), e.g.: /home/user/tempdir .
EXCITINGSCRIPTS = Directory where the scripts are downloaded (not necessary if the downloaded files are copied in /usr/bin), e.g.: /home/user/scriptsdir .
The setting of these variables can be done in a bash shell by typing (from now on the symbol $ will indicate the shell prompt):
$ export EXCITINGROOT=/local_path_to_exciting_root
$ export EXCITINGRUNDIR=/local_run_directory
$ export EXCITINGSCRIPTS=/local_tutorial_scripts_bin_directory
$ export PATH=$PATH:$EXCITINGSCRIPTS
The directory names /local_path_to_exciting_root, /local_run_directory, and /local_tutorial_scripts_bin_directory are dummy names which must be explicitly changed by the user to the appropriate ones.
As a second step, it is necessary to download the scripts which are used in this tutorial. Here is a list of these scripts with a short description, click on the script name to download it:
- SETUP-diamond-gamma-phonon.py: Python script for generating structures with displaced atoms.
- EXECUTE-diamond-gamma-phonon.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.
- GNU-energy: Gnuplot visualization tool for the energy-vs-displacement curves.
- GNU-uforce: Gnuplot visualization tool for the force-vs-displacement curves.
- GNU-status: Gnuplot visualization tool for the RMS deviations of the SCF potential as a function of the iteration number during the SCF loop.
- GNU-check: Gnuplot visualization tool for the fit of the derivatives of the energy-vs-displacement curves at zero displacement.
- GNU-fcheck: Gnuplot visualization tool for the fit of the derivatives of the forces-vs-displacement curves at zero displacement.
All the downloaded scrips must be executable, if this is not the case use, e.g.:
$ chmod u+x SETUP-diamond-gamma-phonon.py
Requirements: Bash shell. Python numpy, lxml, and sys libraries. Gnuplot (visualization tools).
2. 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 and we move inside it:
$ mkdir diamond
$ cd diamond
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:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="inputtohtml.xsl" type="text/xsl"?> <input xsi:noNamespaceSchemaLocation="/local_path_to_exciting_root/xml/excitinginput.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsltpath="/local_path_to_exciting_root/xml/"> <title>Diamond: equilibrium structure</title> <structure speciespath="/local_path_to_exciting_root/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="8 8 8" xctype="GGAPerdew-Burke-Ernzerhof" stype= "Methfessel-Paxton 1" swidth="0.001" gmaxvr="18" lmaxvr="8" rgkmax="7.0" lradstep="2" tforce="true"> </groundstate> </input>
Please, remind that the input file for an exciting calculation must be always called input.xml.
Be sure to:
- set the correct path for the species directory (/local_path_to_exciting_root) to the one pointing to the place where the exciting directory is placed:
... <input xsi:noNamespaceSchemaLocation="/local_path_to_exciting_root/xml/excitinginput.xsd" ... xsltpath="/local_path_to_exciting_root/xml/"> ... <structure speciespath="/local_path_to_exciting_root/species"> ...
- 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 structure you have to run the script SETUP-diamond-gamma-phonon, which will produce the following output on the screen:
$ SETUP-diamond-gamma-phonon.py
Enter maximum displacement umax [u/(lat. parameter)] >>>> 0.03
Enter the number of displacements in [-umax,umax] >>>> 13
$
In this example, the (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.03) 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 (13) 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.
After running the script, a directory called workdir is created, which contains the input files corresponding to the different displacements.
Notice that the directory workdir will be overwritten each time you execute the script SETUP-diamond-gamma-phonon.py. Therefore, before setting up a new run please rename the workdir directory to a different name, e.g.:
$ mv workdir results-label
3. Execute the calculations
To execute the series of calculation with input files created by SETUP-diamond-gamma-phonon.py you have to run the script EXECUTE-diamond-gamma-phonon.sh:
$ EXECUTE-diamond-gamma-phonon.sh
Running exciting for file input-01.xml ----------------------------------
...
Run completed for file input-13.xml -------------------------------------
$
After the complete run, the results of the calculation for the input file workdir/input.xml-i are contained in the subdirectory workdir/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 workdir/energy-vs-displacement and workdir/force-vs-displacement, respectively. More precisely, the file workdir/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.
4. Post-processing: Extract energy derivatives
In order to analyse the results of the calculations, you first have to move to the working directory.
$ cd workdir
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 interpolation >>>> 0.03
Enter the order of derivative >>>> 2
Enter atomic mass in [amu] >>>> 12.01
#############################################
Fit data------------------------------------
Maximum value of the displacement ==> 0.030
Number of displacement values used ==> 13
Fit results for the derivative of order 2
Polynomial of order 2 ==> 1286.80 [cm-1]
Polynomial of order 3 ==> 1286.80 [cm-1]
Polynomial of order 4 ==> 1290.36 [cm-1]
Polynomial of order 5 ==> 1290.36 [cm-1]
Polynomial of order 6 ==> 1289.15 [cm-1]
Polynomial of order 7 ==> 1289.15 [cm-1]
Polynomial of order 2 ==> 38.5774 [THz]
Polynomial of order 3 ==> 38.5774 [THz]
Polynomial of order 4 ==> 38.6841 [THz]
Polynomial of order 5 ==> 38.6841 [THz]
Polynomial of order 6 ==> 38.6477 [THz]
Polynomial of order 7 ==> 38.6477 [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.03) represents the absolute value of the maximum displacement for which we want to perform the calculation. 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 a combination involving the square root of such quantities (see Section 7. for the explanation).
The script generates the output files check-energy-derivatives and order-of-derivative, which can be used in the post-processing analysis.
5. 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 input entries and the screen output for this script are 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.
6. 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 PostScript output file is always named gnu.ps.
i) GNU-energy
This script allows for the visualization of the energy-vs-displacement curve. It is executed as follows:
$ GNU-energy
The script generates the PostScript file gnu.ps. In the following, we display the result for the example mentioned above (carbon in the diamond structure, displacements up to 3% in units of the cubic lattice constant):

ii) GNU-uforce
This script allows for the visualization of the force-vs-displacement curve. It is executed as follows:
$ GNU-uforce
An example of the script output is the following:

iii) GNU-check
This is a very important script that allows to represent the dependence of the calculated derivatives of the energy-vs-displacement curve on
- the range of points included in the fitting procedure,
- the maximum degree of the polynomial used in the fitting procedure.
The script is executed as follows:
$ GNU-check
An example of the script output is the following:

The most appropriate value for the derivative in this example is represented by the horizontal plateau (at about 1289.5 cm-1) of the curves corresponding to the highest order fits.
NOTICE that, in this example, the values which are plotted in the picture above are not directly the actual second derivative of the energy-vs-displacement curves, but a combination involving the square root of such quantities (see Section 7. for the explanation).
iv) GNU-fcheck
Same as GNU-check, but for derivatives of the force-vs-displacement curve. To be used after running CHECKFIT-force-vs-displacement.py. The script is executed as follows:
$ GNU-fcheck
An example of the script output is the following:

The most appropriate value for the derivative in this example is represented by the horizontal plateau (at about 1290.0 cm-1) of the curves corresponding to the highest order fits.
NOTICE that, in this example, the values which are plotted in the picture above are not directly the actual first derivative of the force-vs-displacement curves, but a combination involving the square root of such quantities (see Section 7. for the explanation).
v) GNU-status
Gnuplot visualization tool for the RMS deviations of the effective SCF potential as a function of the iteration number during the SCF loop. It is executed as follows:
$ GNU-status
Enter label [r or 01,02,...] >>>> 01
$
In this example, the input entry, preceded by the symbol »» (in our example 01) represents the label of the calculation for which you would like to plot the RMS deviations. In particular, the choice r refers to the currently running calculation and, e.g., 02 to the calculation already saved in the directory workdir/rundir-02. An example of the script output is the following:

Remark on the visualization scripts
All the visualization scripts accept two on-the-command-line entries specifying the y-axis limiting values. So that, e.g., the command
$ GNU-check 1280 1300
will visualize the results for the derivative in the y-axis range between 1280 and 1300 cm-1 .
7. 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
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, and Φ(R,R') is the inter-atomic force-constants matrix. 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:
E({u}) = E0 + 3/4 m a2 (ωopt)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. One obtains in our case
ωopt = 1290.36 cm-1 = 38.6841 THz
if the order of the fitting polynomial used for the fit is 4 and 13 different displacements equally spaced between -0.03 and +0.03 are considered. If the (more realistic) plateau value is used, as explained above, the value
ωopt = 1289.5 cm-1 = 38.658 THz
is obtained.
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 obtained from the plateau value of the first order derivative at zero displacement of the force-vs-displacement curves is
ωopt = 1290.0 cm-1 = 38.673 THz.