by Kathrin Glantschnig & Ronaldo Rodrigues Pela for exciting oxygen
Purpose: In this tutorial, you will learn how to set up and execute calculations to determine optical spectra within time-dependent density functional theory (TDDFT) for the case of non-zero momentum transfer. As example, the evolution of the loss function of silver for increasing momentum transfer in (001) direction is studied.
Table of Contents
|
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 Tutorial Scripts. Here is a list of the scripts which are relevant for this tutorial together with a short description.
- EXECUTE-single.sh: (Bash) shell script for running a single exciting calculation.
- PLOT-loss-function.py: Python script for generating plots of the loss function.
From now on the symbol $ will indicate the shell prompt.
Requirements: Bash shell. Python numpy, lxml, matplotlib.pyplot, and sys libraries.
Important note: Throughout this tutorial, all input parameters will be given in atomic units!
1. Ground-state calculation
First you have to create a directory to host the calculations that will be performed in this tutorial. We name it Ag-qtddft and move into it.
$ mkdir Ag-qtddft
$ cd Ag-qtddft
To obtain the converged electron density and potential, needed as starting point for the TDDFT calculation, we have to perform a ground-state calculation first. For this purpose, we create the file input.xml (or copy it from a previous calculation) which should look like the following.
<input> <title>Loss function of Ag</title> <structure speciespath="$EXCITINGROOT/species"> <crystal scale="7.72"> <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="Ag.xml"> <atom coord="0.00 0.00 0.00" /> </species> </structure> <groundstate xctype="GGA_PBE_SOL" ngridk="10 10 10"> </groundstate> </input>
Please, remember that the input file for an exciting calculation must always be called input.xml. For further details see Input Reference and How to start an exciting calculation.
N.B.: Do not forget to replace the string "$EXCITINGROOT" in the file input.xml by the actual value of the environment variable $EXCITINGROOT by directly editing input.xml or by using the following command:
$ SETUP-excitingroot.sh
You can start the calculation by invoking the script EXECUTE-single.sh.
$ EXECUTE-single.sh q001-test-1
After the execution finished, all results are written to the subdirectory q001-test-1. Move inside it.
$ cd q001-test-1
You can check the main output file INFO.OUT for convergence information. If the ground-state calculation has been finished successfully, you will find the following message in the last lines of INFO.OUT:
...
================================================================================
| EXCITING OXYGEN stopped =
================================================================================
Please notice: To obtain reliable results, it is necessary to perform careful convergence tests with respect to the k-point mesh (parameter ngridk), the smearing width (parameter swidth), and the size of the basis set (parameter rgkmax). For details see Simple convergence tests.
Make sure that your ground-state calculation is converged before you continue with the TDDFT calculation!
2. TDDFT calculation for non-zero momentum transfer
A well-converged groundstate is the starting point for every TDDFT calculation. Among the many files created during the ground-state calculation only two are essential for the TDDFT part, namely EFERMI.OUT (which contains the Fermi level) and STATE.OUT (which contains the ground-state density and potential).
Please notice: If the EFERMI.OUT and the STATE.OUT files are already available from a previous calculation, it is not necessary to repeat the ground-state calculation. It can be skipped by adding the do attribute inside the groundstate element and setting its value to "skip".
... <groundstate do="skip" ... > ... </groundstate> ...
To perform a TDDFT calculation of the excited states, it is necessary to add the xs element to the input file input.xml. It is placed inside the input element right after the groundstate element and could look like this:
... <xs xstype="TDDFT" ngridk="8 8 8" vkloff="0.097 0.273 0.493" nempty="30" gqmax="2.0" broad="0.004" tevout="true"> <energywindow intv="0.0 2.0" points="1500" /> <tddft fxctype="RPA" intraband="true"/> <qpointset> <qpoint> 0.0 0.0 0.00 </qpoint> <qpoint> 0.0 0.0 0.01 </qpoint> </qpointset> </xs> ...
Within the xs element one or more q points can be specified inside the qpointset element. They are listed one after the other by using qpoint elements. For a TDDFT calculation at non-zero momentum transfer, the q vector must have at least one non-zero component. The given xs block corresponds to a calculation which includes local-field effects. To neglect local-field effects in the calculation, set the gqmax attribute to zero. Intraband contributions are included by setting the intraband attribute within the tddft element to intraband = "true". For further information on the input parameters see Input Reference and Excited states from TDDFT.
Note: The q points are given in reciprocal space coordinates.
Now, start the TDDFT calculation inside the subdirectory q001-test-1 by
$ time exciting_smp >& outputXS.txt &
Information on the progress of the calculation can be found in the file INFOXS.OUT. Check also the outputXS.txt file for warnings and error messages. In INFOXS.OUT you will find information concerning the different tasks (each characterized by a specific task number) executed during the TDDFT calculation. For every task finished, you will find the following message in INFOXS.OUT.
================================================================================
= EXCITING OXYGEN stopped for task XXX =
================================================================================
Here, XXX stands for the specific task which was carried out. As soon as task 350 has been completed, the complete TDDFT calculation is finished.
3. Output files
After the TDDFT calculation finished successfully, optical spectra for finite momentum transfer are available from the output files listed below.
|
Note: xxx stands for further labels present in the output file.
LOSS_NLF_FXCRPA_QMT002.OUT is an example of an output file containing the loss function and the dynamical structure factor. The meaning of the different labels is given below.
|
For further information on possible labels and their meaning see TDDFT Output Files.
Note: A calculation including local-field effects always gives, in addition, the spectra neglecting local-field effects.
4. Visualization
With the help of the python script PLOT-loss-function.py you can to visualize one or more output files of the loss function. In order to plot the data sets including and neglecting local-field effects, use the following command line (see Excited states from TDDFT for further information concerning the use of the script).
$ PLOT-loss-function.py --kernel LOSS_FXCRPA_QMT002.OUT LOSS_NLF_FXCRPA_QMT002.OUT
This will generate the files PLOT.ps and PLOT.png, that will look like the figure below.
As can be seen, the impact of local-field effects is negligible below 8 eV. In contrast, their inclusion is important especially for energies above 35 eV, where they lead to a drastical reduction in spectral weight.
The effect of intraband contributions
Now, move to the parent directory, create here a new directory, e.g., named q001-test-2, copy the files input.xml, EFERMI.OUT, and STATE.OUT from q001-test-1 to it, and move into it.
$ cd ..
$ mkdir q001-test-2
$ cp q001-test-1/{input.xml,EFERMI.OUT,STATE.OUT} q001-test-2
$ cd q001-test-2
In order to calculate the loss function neglecting intraband contributions you have to change inside the file input.xml the intraband attribute from "true" to "false".
... <tddft ... intraband="false" ... > ...
Then, start the calculation. After the calculation finished successfully, you can plot the loss functions neglecting and including intraband contributions for comparison. In order to do so, use the following commands:
$ cp LOSS_FXCRPA_QMT002.OUT no-intraband_toplot_LOSS_FXCRPA_QMT002.OUT
$ cp ../q001-test-1/LOSS_FXCRPA_QMT002.OUT intraband_toplot_LOSS_FXCRPA_QMT002.OUT
$ PLOT-loss-function.py --kernel no-intraband_toplot_LOSS_FXCRPA_QMT002.OUT intraband_toplot_LOSS_FXCRPA_QMT002.OUT
As visible from the figure, the inclusion of intraband contributions increases the spectral weight and gives rise to a sharp plasmon peak around 3 eV.
5. Converging the results
Before starting a series of calculations to investigate the q dependence of different optical quantities, it is necessary to find a proper set of parameters leading to high-quality spectra. The choice of the parameters listed below is crucial for the accuracy of the calculation.
|
For further information see Input Reference and Excited states from TDDFT.
6. Evolution of the electron energy-loss function for increasing momentum transfer
To study the evolution of optical spectra with increasing momentum transfer in a certain direction within the Brillouin Zone, you have the following two possibilities:
- Repeat the procedure discussed in Section 2 several times and change the q point in input.xml after every run. In this case it is necessary to save the output files with a new name, otherwise the results will be overwritten by the next calculation.
- List the q points inside the qpointset element using the qpoint element. In this case, the calculation produces a set of output files for each q point. The output files can be related to the q points with the help of the QPOINTS.OUT file and the number following the QMT label.
Move to the parent directory. Create a new directory with the name q001-test3, copy the input.xml, EFERMI.OUT, and the STATE.OUT files into it and move into it.
$ cd ..
$ mkdir q001-test-3
$ cp q001-test-1/{input.xml,EFERMI.OUT,STATE.OUT} q001-test-3
$ cd q001-test-3
We will use the second approach to study the momentum dependence along the (001) direction. For this purpose, replace the qpointset element in input.xml by
... <qpointset> <qpoint> 0.0 0.0 0.00 </qpoint> <qpoint> 0.0 0.0 0.03 </qpoint> <qpoint> 0.0 0.0 0.06 </qpoint> <qpoint> 0.0 0.0 0.09 </qpoint> </qpointset> ...
To reduce the computing time for this test calculation, neglect local-field effects by setting gqmax = "0.0", set nempty = "10" and change the intv attribute to "0.0 0.3". Intraband contributions should be included in the calculation.
Please notice: The parameters used in this test calculation are chosen for practical reasons to keep the computational time low. In general, careful convergence tests must be performed to find a proper parameter set leading to high-quality results.
Now, start the TDDFT calculation in the background by typing:
$ time exciting_smp >& output.txt &
and, through the file INFOXS.OUT, monitor its progress.
In order to visualize your results, you can use the script PLOT-loss-function.py as follows:
$ PLOT-loss-function.py --qmt LOSS_NLF_FXCRPA_QMT002.OUT LOSS_NLF_FXCRPA_QMT003.OUT LOSS_NLF_FXCRPA_QMT004.OUT
The main change in the spectrum with increasing momentum transfer occurs at the onset of the spectrum, where the plasmonic peak moves to higher energies and concurrently loses intensity. The features at higher energies show no dispersion.
Note: A realistic investigation of the evolution of the low-energy plasmon with increasing momentum transfer requires a much denser k mesh than that used in this example.
Exercise
- Set up and perform similar calculations for increasing momentum transfer in (011) or (111) direction. Visualize the results.