q-Dependent TDDFT

by Kathrin Glantschnig and Ronaldo Rodrigues Pela for exciting sodium

(Jupyter notebook by Mara Voiculescu and Martin Kuban)


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. Before Starting

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

Before running any Jupyter tutorials, please refer to the 00_before_starting.md document on how to correctly set up the environment. This only needs to be done once. After which, the venv can be (re)activated from exciting's root directory:

source $EXCITINGROOT/tools/excitingjupyter/venv/excitingvenv/bin/activate

Important note: All input parameters that will appear 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, which we run_Ag_q_tddft, as well as a subdirectory q001_test_1.

In [1]:
%%bash
mkdir -p run_Ag_q_tddft && cd run_Ag_q_tddft
mkdir -p q001_test_1
cd ..

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>

Do not forget to replace in the input.xml the actual value of the environment variable $EXCITINGROOT. You can do this by directly editing the input.xml file or by using the following command:

In [3]:
%%bash
cd run_Ag_q_tddft/q001_test_1
python3 -m excitingscripts.setup.excitingroot
cd ../..

You can start the calculation by invoking the script excitingscripts.execute.single.

In [4]:
%%bash
cd run_Ag_q_tddft
python3 -m excitingscripts.execute.single -r q001_test_1
cd ..

You can check the bunch of files created during the run, especially the main output file INFO.OUT, for convergence information. If the calculation of the ground state has been finished successfully, in the last lines of the INFO.OUT file you should find the message

...
================================================================================
| EXCITING SODIUM stopped                                                        =
================================================================================

Please note: 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 the tutorial 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 note: 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 attribute do="skip" inside the element 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 the tutorial 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

In [ ]:
%%bash
cd run_Ag_q_tddft
python3 -m excitingscripts.execute.single -r q001_test_1
cd ..

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

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

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
QMT002 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 excitingscripts.plot.files 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.

In [7]:
%%bash
cd run_Ag_q_tddft/q001_test_1
python3 -m excitingscripts.plot.files -f LOSS_FXCRPA_QMT002.OUT LOSS_NLF_FXCRPA_QMT002.OUT -lx 'Energy [eV]'  -ly 'Loss function'  -x 0 54  -y 0 1.6 -ll 'RPA (LFE)' 'RPA (no-LFE)'
cd ../..

This will generate the file PLOT.png, that will look like the figure below.

No description has been provided for this image

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, and copy the files input.xml, EFERMI.OUT, and STATE.OUT from q001_test_1 into it.

In [8]:
%%bash
cd run_Ag_q_tddft
mkdir -p q001_test_2
cp q001_test_1/{input.xml,EFERMI.OUT,STATE.OUT} q001_test_2
cd ..

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

Then, start the calculation.

In [ ]:
%%bash
cd run_Ag_q_tddft
python3 -m excitingscripts.execute.single -r q001_test_2
cd ..

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:

In [11]:
%%bash
cd run_Ag_q_tddft/q001_test_2
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
python3 -m excitingscripts.plot.files -f no-intraband_toplot_LOSS_FXCRPA_QMT002.OUT intraband_toplot_LOSS_FXCRPA_QMT002.OUT -lx 'Energy [eV]'  -ly 'Loss function'  -x 0 54  -y 0 1.6 -ll 'no-intraband RPA (LFE)' 'intraband RPA (LFE)'
cd ../..

You should obtain the following result:

No description has been provided for this image

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.

Attribute Element Description
ngridk xs The quality of the spectra depends on the size of the k-mesh. 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 inside the groundstate element
swidth xs In particular for metals, the convergence test with respect to the smearing width swidth must go hand in hand with that of ngridk.
rgkmax xs It determines the size of the basis set and, therefore, influences the quality of the eigenvalues. When increasing it, the computational time rises rapidly. The rgkmax attribute inside the xs element is independent of the rgkmax inside the groundstate element.
gqmax xs This is the value of the local-field effects cutoff Gmax. If it is set to zero, local-field effects are neglected.
nempty xs 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 the tutorial 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 q001_test_3 and copy the input.xml, EFERMI.OUT, and the STATE.OUT files into it.

In [12]:
%%bash
cd run_Ag_q_tddft
mkdir -p q001_test_3
cp q001_test_1/{input.xml,EFERMI.OUT,STATE.OUT} q001_test_3
cd ..

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.

Now, start the TDDFT calculation

In [ ]:
%%bash
cd run_Ag_q_tddft
python3 -m excitingscripts.execute.single -r q001_test_3
cd ..

and, through the file INFOXS.OUT, monitor its progress.

In order to visualize your results, you can use the script excitingscripts.plot.files as follows:

In [15]:
%%bash
cd run_Ag_q_tddft/q001_test_3
python3 -m excitingscripts.plot.files -f LOSS_NLF_FXCRPA_QMT002.OUT LOSS_NLF_FXCRPA_QMT003.OUT LOSS_NLF_FXCRPA_QMT004.OUT -lx 'Energy [eV]'  -ly 'Loss function'  -x 0 8  -y 0 1.2 -ll 'QMT002' 'QMT003' 'QMT004'
cd ../..

With this command, you will create a plot like the one below.

No description has been provided for this image

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.

Bibliography

  1. Tutorial talk by Stefan Sagmeister (PDF) at the HoW exciting! 2010 workshop in Lausanne.
  2. 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).
  3. More details on the implementation of the TDDFT formalism within the LAPW method: S. Sagmeister, PhD thesis, University of Graz, August 2009 (PDF).