q-Dependent TDDFT

by Kathrin Glantschnig for exciting carbon

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.

### 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.
• PLOT-q-study-lossfunction.py: Python script for generating plots of a set of loss functions for different momentum transfer.

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 At first you have to create a directory for the system under investigation in which the calculation will be performed later on. Since this tutorial is dedicated to the calculation of the q-dependent loss function, we will create a directory with the name 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 could 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 Ag-test-qtddft


After the execution finished, all results are written to the subdirectory Ag-test-qtddft. Move inside it.

$cd Ag-test-qtddft  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 CARBON 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 numerous files created during the ground-state calculation only two are essential for the TDDFT part. These are EFERMI.OUT (contains the Fermi level) and STATE.OUT (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.01 </qpoint> </qpointset> </xs> ...  Within the xs element one or more q points can be specified with the help of the qpointset element. They are listed one after the other by using the qpoint element. 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 Ag-test-qtddft by $ time excitingser >& 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 CARBON 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 has finished.

### 3. Output files

After the TDDFT calculation finished successfully, optical spectra for finite momentum transfer are available from the output files listed below.

File name Content
EPSILON_xxx dielectric function
LOSS_xxx loss function and dynamical structure factor
SIGMA_xxx optical conductivity

Note: xxx stands for further labels present in the output file.

LOSS_NLF_FXCRPA_QMT001.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.

Label Meaning
NLF no local field effects: local-field effects were neglected in the calculation
FXCRPA xc-kernel type: the xc-kernel used in the calculation is RPA
QMT001 q momentum transfer: the first q point as listed in the QPOINTS.OUT file was used

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 XML data 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 LOSS_FXCRPA_QMT001.OUT.xml LOSS_NLF_FXCRPA_QMT001.OUT.xml  This will generate the files PLOT.ps and PLOT.png, that will look like in the figure given 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 Create a new directory, e.g., named TEST-1, copy the files input.xml, EFERMI.OUT, and STATE.OUT to it, and move into it. $ mkdir TEST-1
$cp ./{input.xml,EFERMI.OUT,STATE.OUT} TEST-1$ cd TEST-1


In order to calculate the loss function neglecting intraband contributions you have to change the intraband attribute from "true" to "false".

...
<tddft ... intraband="false" ... >
...

Then, start the calculation. After the calculation finished successfully, plot the loss functions neglecting and including intraband contributions for comparison. You should obtain the following result:

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.

Element Attribute Description
xs ngridk The quality of the spectra depends on the size of the k mesh controlled by the attribute ngridk. A denser k mesh results in a better resolution of the spectrum. Thus, always check for convergence with respect to the number of k points. The ngridk attribute inside the xs element is independent of the ngridk attribute inside the groundstate element.
xs swidth In particular for metals, the convergence test with respect to the smearing width swidth must go hand in hand with that of ngridk.
xs rgkmax It determines the size of the basis set and therefore influences the quality of the eigenvalues. Be careful when increasing it since the computational time rises rapidly. The rgkmax attribute inside the xs element is independent of the rgkmax attribute inside the groundstate element.
xs gqmax This is the local-field effects G-cutoff. If it is set to zero, local-field effects are neglected.
xs nempty It determines the number of empty states considered in the calculation and depends on the energy range of interest. In some case, a larger value of gqmax may require a larger value for nempty. Thus, you always have to converge with respect to nempty after selecting a new gqmax .

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:

1. 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.
2. 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 TEST-2, copy the input.xml, EFERMI.OUT, and the STATE.OUT files into it and move into it.

$cd ../$ mkdir TEST-2
$cp ./{input.xml,EFERMI.OUT,STATE.OUT} TEST-2$ cd TEST-2


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.02 </qpoint>
<qpoint> 0.0 0.0 0.04 </qpoint>
<qpoint> 0.0 0.0 0.06 </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 excitingser >& output.txt &  and monitor its progress with the help of the file INFOXS.OUT. ### 7. Evaluation In order to visualize your results, you can use the script PLOT-loss-function.py. To generate the plot, execute the following command. $ PLOT-q-study-lossfunction.py 0.0 8.0 0.05

The first two arguments (0.0 and 8.0) define the energy range (in eV) of your plot. The curves for each q are separated by an offset defined by the third argument (0.05). This script will generate a push up window which will appear on the screen. Alternatively, you can close the window and visualize the file PLOT.ps or PLOT.png, that will look like in the figure below.

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.

For further evaluation, download here a tar.gz file containing the results for a 30$\times$30$\times$30 k-point mesh with q increasing from 0.01 to 0.1 in the (001) direction and save it in a new folder. Use these data and visualize them with the help of the script PLOT-q-study-lossfunction.py. To generate the plot, execute the following command inside the folder where you unpacked the file.

\$ PLOT-q-study-lossfunction.py 0.0 8.0 0.05

The script will produce now the following plot.

The plot reveals that the low-energy plasmon shifts to higher energies and gets broader with increasing momentum transfer.

##### Exercise
• Set up and perform similar calculations for increasing momentum transfer in (011) or (111) direction. Visualize the results.

### Literature

• Tutorial talk by Stefan Sagmeister (PDF) at the HoW exciting! 2010 workshop in Lausanne.
• Further information on the momentum-dependent loss function of Ag: A. Alkauskas, S. Schneider, S. Sagmeister, C. Ambrosch-Draxl, and C. Hèbert, Theoretical analysis of the momentum-dependent loss function of bulk Ag, Ultramicroscopy 110, 1081 (2010) (PDF).
• More details on the implementation of the TDDFT formalism within the LAPW method: S. Sagmeister, PhD thesis, University of Graz, August 2009 (PDF).