Purpose: In this tutorial you will learn how to set up and execute exciting calculations using the ElaStic@exciting interface, which allows to obtain the full elastic tensors (elastic constants) of crystal systems for any crystal structure. In addition, the application of ElaStic@exciting to the determination of the elastic constants of C in the diamond phase and of hexagonal Be is explicitly presented.
Table of Contents
0. Define relevant shell variables and download scripts
Read the following paragraphs before starting with the rest of this tutorial!
Before starting, be sure that relevant shell variables are already defined and that the excitingscripts directory has already been downloaded, as specified in Tutorial scripts and environment variables. Here is a list of the scripts which are relevant for this tutorial with a short description.
- ElaStic@exciting-setup.py: Python script for generating structures at different strains.
- ElaStic@exciting-submit.sh: (Bash) shell script for running a series of exciting calculations.
- ElaStic@exciting-analyze.py: Python script for fitting the energy-vs-strain and CVe-vs-strain curves.
- ElaStic@exciting-clean.sh: (Bash) shell script for cleaning unnecessary files.
- ElaStic@exciting-result.py: Python script for calculating elastic constants.
- ElaStic_Result_Energy_2nd.py: Python script for calculating second-order elastic constants.
- ElaStic_Result_Energy_3rd.py: Python script for calculating third-order elastic constants.
- ElaStic_xyz2XYZ.py: Python script for the conversion of second-order elastic constants to different coordinate systems.
- exciting2sgroup.xsl: xsl script for converting the exciting input to an sgroup input file.
- Grace.par: File containing xmgrace parameters needed by visualization tools.
Requirements: Bash shell. Python numpy, lxml, math, sys and os libraries. xmgrace (visualization tool).
From now on the symbol $ will indicate the shell prompt.
Extra requirement: Tool for space-group determination
ElaStic@exciting uses the sgroup tool. If you have not done before, this tool should be downloaded and installed. The code sgroup is a utility which allows to determine the space group and symmetry operations of a crystal structure.
- Tool name: sgroup
- Authors: B.Z. Yanchitsky, A.N. Timoshevskii
- Website: http://cpc.cs.qub.ac.uk/summaries/adon
- Download sgroup here (open the link, push the Download botton, and save the file containg the sgroup package)
After the download, you will get a tar.gz file, go to the directory where you saved this file and execute the following commands.
$ tar xfvp DownloadedFile.tar.gz $ cd SpaceGroups $ make $ cp sgroup $EXCITINGSCRIPTS
Now, you have everything you need for starting and performing elastic-constants calculations.
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 first consider as an example carbon in the diamond structure (the procedure we use is, nevertheless, valid for any system). Thus, we will create a directory C_2nd and we move inside it.
Inside this directory, we create or copy an optimized structure file for diamond named C_2nd.xml. This file could look like the following.
<input> <title>Diamond: 2nd-order elastic constants</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="6.7188"> <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.30"> <atom coord="0.00 0.00 0.00"/> <atom coord="0.25 0.25 0.25"/> </species> </structure> <groundstate ngridk="4 4 4" swidth="0.0001" gmaxvr="14" maxscl="20"> </groundstate> <structureoptimization/> </input>
This file can be saved with any name. In this tutorial is not necessary to rename the exciting input file as input.xml, because this file is the input of ElaStic@exciting and not of exciting itself. Please, notice that the input file for a direct exciting calculation must be always called input.xml.
Be sure to set the correct path for the exciting root directory (indicated in this example by $EXCITINGROOT) to the one pointing to the place where the exciting directory is placed. In order to do this, use the command
$ SETUP-excitingroot.sh C_2nd.xml
ii) Generation of input files for distorted structures
All strains considered in this tutorial are Lagrangian strains.
In order to generate input files for a series of distorted structure, you have to run the script ElaStic@exciting-setup.py, which will produce the following output on the screen.
Entry values must be typed on the screen when requested. In this case, the entries are the following.
- 2, the order of the elastic constants in which you are interested.
- C_2nd.xml, the name of the input file.
- 0.05, the absolute value of the maximum strain for which we want to perform the calculation.
- 11, the number of deformed structures equally spaced in strain, which are generated between the maximum negative strain and the maximum positive one.
The script generates some new directories and files, which you can list using the following command (in the C_2nd directory).
You may also list the single direcories, e.g., if you list Dst01 you will see the following (sub)directories.
3. Execute the calculations
To execute the series of calculations, run (in the C_2nd directory) the script ElaStic@exciting-submit.sh, which will produce an output on the screen similar to the following.
After the complete run, elastic constants can be calculated.
ATTENTION:The running time necessary for performing a complete calculation of the elastic constants of diamond using computational parameters as included in the above file C_2nd.xml, is of about one hour (depending on the machine processor you are using). In order to save time or comparing your results, you could alternatively download here a tar.gz archive with the relevant output files (INFO.OUT and TOTENERGY.OUT for all distortions).
4. Analyzing the calculations
In order to calculate elastic constants, we have to analyze our calculations. The script ElaStic@exciting-analyze.py allows for the analysis of the dependence of the calculated derivatives of the energy-vs-strain curve on
- the range of distortions included in the fitting procedure (the x axis in xmgrace plots),
- the degree of the polynomial fit used in the fitting procedure (different color curves in xmgrace plots).
The ElaStic@exciting-analyze.py script is executed as follows.
At this point, six xmgrace plots will appear on your screen automatically (for more information on how to deal with xmgrace plots, see Xmgrace: A Quickstart). These plots should be similar to the ones displayed in the following. However, please note that some difference exists between your plots and the ones showed in the following. This difference arises from the fact that displayed results are obtained using 41 distortions instead of the 11 used in this tutorial.
The previous plots can be used to determine the best range of deformations and order of polynomial fit for each distortion.
As an example, we analyze the first plot, corresponding to the distortion Dst01. Distortion types are listed in the file Distorted_Parameter. By examinating this file, we can see that the Dst01 distortion corresponds to an applied Lagrangian strain in the Voigt notation with the form (η,η,η,0,0,0), where η is a strain parameter. This deformation type is directly connected with the bulk module B0. For each distorsion type, two plots appear. The first plot contains the second derivative of the energy with respect to the strain parameter η as a function of the maximum strain and of the order of polynomial fit. In a similar way, the second plot shows the corresponding cross-validation error. By analyzing the first plot for the Dst01 distortion, we notice that curves corresponding to the higher order of the polynomial used in the fit show a horizontal plateau at about 4030-4050 GPa. This can be assumed to be the converged value for the second derivative, from the point of view of the fit (further information on this topic can be found here). For this distortion type, this value equals 9 times the bulk modulus. Thus, the extracted value of the bulk modulus is 448-450 GPa.
The script ElaStic@exciting-analyze.py generates the file ElaStic_2nd.in, which will be discussed and used in the next section.
5. Numerical values of the elastic constants
In order to obtain the numerical values of the second-order elastic constants of diamond, you should use the following procedure. The first step is to edit the file ElaStic_2nd.in, which should have the form
Dst01 eta_max Fit_order Dst02 eta_max Fit_order Dst03 eta_max Fit_order
In each row of this file, you should insert a value for eta_max and Fit_order. According to the result of the visual analisys of the previous figures, these two values are extracted by considering the plateau regions of the corresponding plot: eta_max is a value of maximum distortion located in the plateau region of the curve representing the polynomial fit of order Fit_order. In our case, we can choose for each distortion 0.05 and 6 as the best distortion range and polynomial fit, respectively. Thus, the ElaStic_2nd.in file should contain
Dst01 0.05 6 Dst02 0.05 6 Dst03 0.05 6
Now, in order to calculate elastic constants and moduli, you should run the ElaStic@exciting-result.py script.
Finally, numerical values of the elastic constants for diamond are written in the output file ElaStic_2nd.out.
Experimental reference elastic constants for diamond:
- C11 = 1076 GPa
- C12 = 125 GPa
- C44 = 577 GPa
- B0 = 452 GPa
- Repeat all calculations using a denser k-point grid and a larger number of strain points.
6. Set up the calculation for Be
In the next example, we consider the calculation of the elastic constants of hexagonal Be.
First, create a new directory Be_2nd and move inside it.
Inside this directory, create the file Be_2nd.xml corresponding to a calculation for the equilibrium structure of Be. This file could look like the following.
<input> <title>Be: 2nd order elastic constants</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="4.3254"> <basevect> 1.00000000 0.00000000 0.00000000 </basevect> <basevect> -0.50000000 0.86602540 0.00000000 </basevect> <basevect> 0.00000000 0.00000000 1.52224072 </basevect> </crystal> <species speciesfile="Be.xml" rmt="1.45"> <atom coord="0.66666666 0.33333334 0.75000000"/> <atom coord="0.33333334 0.66666666 0.25000000"/> </species> </structure> <groundstate ngridk="6 6 4" gmaxvr="14"> </groundstate> <structureoptimization/> </input>
Do not forget to update the string "$EXCITINGROOT" inside the file Be_2nd.xml.
Then, we generate a set of exciting input files with the script ElaStic@exciting-setup.py.
From now on, the procedure is completely equivalent to the one used for diamond. However, note that in this case the entry values are chosen in such a way to correspond to more accurate calculations. In turn, this means that the running time for completing the calculation of the elastic constants of hexagonal Be will be much longer that in the example of diamond. For a fast analysis, you can find here a tar.gz archive with the relevant output files (INFO.OUT and TOTENERGY.OUT for all distortions). The analysis of the result can be made as in the previous example.