lcaotddft.rst 11.2 KB
Newer Older
1 2
.. _lcaotddft:

Time-propagation TDDFT with LCAO: Theory and usage

This page documents the use of time-propagation TDDFT in :ref:`LCAO
mode <lcao>`. The implementation is described in Ref. [#Kuisma2015]_.

Real-time propagation of LCAO functions
kuismam's avatar
kuismam committed
11 12

13 14 15
In the real-time LCAO-TDDFT approach, the time-dependent wave functions are
represented using the
localized basis functions `\tilde{\phi}_{\mu}(\mathbf r)` as
kuismam's avatar
kuismam committed
16 17 18

.. math::

  \tilde{\psi}_n(\mathbf{r},t) = \sum_{\mu} \tilde{\phi}_{\mu}(\mathbf{r}-\mathbf{R}^\mu) c_{\mu n}(t) .
kuismam's avatar
kuismam committed

The time-dependent Kohn--Sham equation in the PAW formalism can be written as
kuismam's avatar
kuismam committed
22 23 24 25 26

.. math::

  \left[ \widehat T^\dagger \left( -i \frac{{\rm d}}{{\rm d}t} + \hat H_{\rm KS}(t) \right) \widehat T \right]  \tilde{\Psi(\mathbf{r},t)} = 0.

27 28
From this, the following matrix equation can be derived for the
LCAO wave function coefficients:
kuismam's avatar
kuismam committed
29 30 31 32

.. math::
  {\rm i}\mathbf{S} \frac{{\rm d}\mathbf{C}(t)}{{\rm d}t} = \mathbf{H}(t) \mathbf{C}(t).

33 34 35 36 37 38
In the current implementation, `\mathbf C`, `\mathbf S` and
`\mathbf H` are dense matrices which are distributed using
ScaLAPACK/BLACS.  Currently, a semi-implicit Crank--Nicolson method (SICN) is
used to propagate the wave functions. For wave functions at time `t`, one
propagates the system forward using `\mathbf H(t)` and solving the
linear equation
kuismam's avatar
kuismam committed
39 40 41

.. math::

  \left( \mathbf{S} + {\rm i} \mathbf{H}(t) {\rm d}t / 2 \right) \mathbf{C}'(t+{\rm d}t) = \left( \mathbf{S} - {\rm i} \mathbf{H}(t) {\rm d}t / 2 \right) \mathbf{C}(t).
kuismam's avatar
kuismam committed

44 45 46
Using the predicted wave functions `C'(t+\mathrm dt)`, the
Hamiltonian `H'(t+\mathrm dt)` is calculated and the Hamiltonian at
middle of the time step is estimated as
kuismam's avatar
kuismam committed
47 48 49

.. math::

   \mathbf{H}(t+{\rm d}t/2) = (\mathbf{H}(t) + \mathbf{H}'(t+{\rm d}t)) / 2
kuismam's avatar
kuismam committed

52 53
With the improved Hamiltonian, the wave functions are again propagated
from `t` to `t+\mathrm dt` by solving
kuismam's avatar
kuismam committed

kuismam's avatar
kuismam committed
55 56
.. math::

  \left( \mathbf{S} + {\rm i} \mathbf{H}(t+{\rm d}t/2) {\rm d}t / 2 \right) \mathbf{C}(t+{\rm d}t) = \left( \mathbf{S} - {\rm i} \mathbf{H}(t+{\rm d}t/2) {\rm d}t / 2 \right) \mathbf{C}(t).

59 60
This procedure is repeated using 500--2000 time steps of 5--40 as to
calculate the time evolution of the electrons.

62 63
kuismam's avatar
kuismam committed

First do a standard ground-state calculation with the ``GPAW`` calculator:
kuismam's avatar
kuismam committed

67 68
.. literalinclude::
   :lines: 3-21
kuismam's avatar
kuismam committed

Some important points are:
kuismam's avatar
kuismam committed

72 73 74 75 76 77 78 79 80 81 82 83 84 85
* The grid spacing is only used to calculate the Hamiltonian matrix and
  therefore a coarser grid than usual can be used.
* Completely unoccupied bands should be left out of the calculation,
  since they are not needed.
* The density convergence criterion should be a few orders of magnitude
  more accurate than in usual ground-state calculations.
* The convergence tolerance of the Poisson solver should be at least ``1e-16``,
  but ``1e-20`` does not hurt (note that this is the **quadratic** error).
* One should use multipole-corrected Poisson solvers or other advanced
  Poisson solvers in any TDDFT run.
  See the documentation on :ref:`advancedpoisson`.

Next the calculation proceeds as in the grid mode with ``TDDFT`` object.
We kick the system in the z direction and propagate 3000 steps of 10 as:
kuismam's avatar
kuismam committed

87 88
.. literalinclude::
   :lines: 23-35
kuismam's avatar
kuismam committed

After the time propagation, the spectrum can be calculated:
kuismam's avatar
kuismam committed

92 93
.. literalinclude::
   :lines: 37-39
kuismam's avatar
kuismam committed
94 95

96 97
Simple example script
kuismam's avatar
kuismam committed

99 100
Here is the previous example as a complete script.

kuismam's avatar
kuismam committed
101 102 103 104 105 106
.. literalinclude::

General notes about basis sets

In time-propagation LCAO-TDDFT, it is much more important to think
about the basis sets compared to ground-state LCAO calculations.  It
is required that the basis set can represent both the occupied
(holes) and relevant unoccupied states (electrons) adequately.  Custom
111 112
basis sets for the time propagation should be generated according to
one's need, and then benchmarked.
kuismam's avatar
kuismam committed

jensj's avatar
jensj committed
**Irrespective of the basis sets you choose, ALWAYS, ALWAYS, benchmark LCAO
115 116 117 118 119 120
results with respect to the FD time-propagation code** on the largest system
possible. For example, one can create a prototype system which consists of
similar atomic species with similar roles as in the parent system, but small
enough to calculate with grid propagation mode.
See Figs. 4 and 5 of Ref. [#Kuisma2015]_ for example benchmarks.

121 122 123
After these remarks, we describe two packages of basis sets that can be used
as a starting point for choosing a suitable basis set for your needs.
Namely, :ref:`pvalence basis sets` and :ref:`coopt basis sets`.

Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed

126 127 128 129 130
.. _pvalence basis sets:

p-valence basis sets

Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
131 132 133 134 135 136 137 138 139 140
The so-called p-valence basis sets are constructed for transition metals by
replacing the p-type polarization function of the default basis sets with a
bound unoccupied p-type orbital and its split-valence complement. Such basis
sets correspond to the ones used in Ref. [#Kuisma2015]_. These basis sets
significantly improve density of states of unoccupied states.

The p-valence basis sets can be easily obtained for the appropriate elements
with the :command:`gpaw install-data` tool using the following options::

    $ gpaw install-data {<directory>} --basis --version=pvalence

Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
See :ref:`installation of paw datasets` for more information on basis set
Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
143 144 145
installation. It is again reminded that these basis sets are not thoroughly
tested and **it is essential to benchmark the performance of the basis sets
for your application**.
146 147 148 149 150 151 152

.. _coopt basis sets:

Completeness-optimized basis sets

jensj's avatar
jensj committed
153 154 155
A systematic approach for improving the basis sets can be obtained with the
so-called completeness-optimization approach. This approach is used in Ref.
[#Rossi2015]_ to generate basis set series for TDDFT calculations of copper,
silver, and gold clusters.

jensj's avatar
jensj committed
158 159
For further details of the basis sets, as well as their construction and
performance, see [#Rossi2015]_. For convenience, these basis sets can be easily
Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
obtained with::

Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
    $ gpaw install-data {<directory>} --basis --version=coopt

Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
See :ref:`installation of paw datasets` for basis set installation. Finally,
Jens Jørgen Mortensen's avatar
Jens Jørgen Mortensen committed
165 166
it is again emphasized that when using the basis sets, **it is essential to
benchmark their suitability for your application**.

kuismam's avatar
kuismam committed
168 169 170 171


172 173
LCAO-TDDFT is parallelized using ScaLAPACK. It runs without ScaLAPACK,
but in this case only a single core is used for linear alrebra.
kuismam's avatar
kuismam committed

175 176 177 178 179 180 181
* Use ``parallel={'sl_default':(N, M, 64)}``;  See :ref:`manual_parallel`.
* It is necessary that N*M equals the total number of cores used
  by the calculator, and ``max(N,M)*64 < nbands``, where ``64`` is the used
  block size. The block size can be changed to, e.g., 16 if necessary.
* Apart from parallelization of linear algrebra, normal domain and
  band parallelizations can be used. As in ground-state LCAO calculations,
  use band parallelization to reduce memory consumption.
kuismam's avatar
kuismam committed


184 185 186 187 188 189

    Add ``ParallelTimer`` example
tprossi's avatar
tprossi committed


Advanced tutorial - Plasmon resonance of silver cluster
kuismam's avatar
kuismam committed
193 194

195 196 197 198 199
One should think about what type of transitions of interest are present,
and make sure that the basis set can represent such Kohn-Sham electron and
hole wave functions. The first transitions in silver clusters will be
`5s \rightarrow 5p` like. We require 5p orbitals in the basis set, and thus,
we must generate a custom basis set.

201 202 203 204 205 206
Here is how to generate a double-zeta basis set with 5p orbital in valence
for silver for GLLB-SC potential. Note that the extra 5p valence state
effectively improves on the ordinary polarization function, so this basis set
is **better** than the default double-zeta polarized one.
We will use the 11-electron Ag setup, since the semi-core p states included
in the default setup are not relevant here.
207 208

.. literalinclude::
kuismam's avatar
kuismam committed

kuismam's avatar
kuismam committed
210 211 212 213 214
We calculate the icosahedral Ag55 cluster: :download:``

This code uses ScaLAPACK parallelization with 64 cores.

.. literalinclude::
kuismam's avatar
kuismam committed

216 217 218
Code runs for approximately two hours wall-clock time.
The resulting spectrum shows already emerging plasmonic excitation
around 4 eV.
kuismam's avatar
kuismam committed
219 220 221 222
For more details, see [#Kuisma2015]_.

.. image:: fig1.png


224 225 226
Induced density

227 228 229 230 231 232 233
Plotting the induced density is especially interesting in case of plasmon
resonances. As an example, we calculate a dummy Na8 wire and write
the density to a file on every iteration.
There are certain advantages of writing the density on every iteration
instead of using the predefined frequencies and
on-the-fly Fourier transformation: Only one TDDFT run is required as
any frequency can be analysed as a post processing operation.
Hard disk requirements are large, but tolerable (1-100GB) in most cases.
235 236 237

.. literalinclude::

238 239 240 241 242 243 244
Files with extensions ``.sG`` and ``.asp`` are created, where ``.sG`` files
contain the density on the coarse grid while ``.asp`` files contain
the atomic density matrices. With these, it is possible to reconstruct
the full density.
This can now be fourier transformed at the desired frequency.
Here, we look from the produced spectrum file that plasmonic peak,
and perform Fourier transform at that frequency.
245 246 247

.. literalinclude::

248 249 250 251 252
Two cube files are created, one for the sin (imag) and cos (real)
transform at the frequency.  Usually, one is interested in the absorbing
part, i.e., the imaginary part. Below the plasmon resonance is visualized
in the Na8 wire. In their current form, these cube files contain just
the pseudo part of density.
253 254 255 256

.. image:: Na8_imag.png

257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

   Advanced tutorial - large organic molecule
   General notes
   On large organic molecules, on large conjugated systems, there will `\pi \rightarrow \pi^*`,
   `\sigma \rightarrow \sigma^*`. These states consist of only
   the valence orbitals of carbon, and they are likely by quite similar few eV's
   below and above the fermi lavel. These are thus a reason to believe that these
   states are well described with hydrogen 1s and carbon 2s and 2p valence orbitals
   around the fermi level.
   Here, we will calculate a small and a large organic molecule with lcao-tddft.
kuismam's avatar
kuismam committed
274 275 276 277

Kohn-Sham decomposition of the transition density matrix

Soon it will be possible to analyse the origin of the transitions the same way as is commonly done in Casida-based codes.
The LCAO basis will be transformed to an electron-hole basis of the Kohn-Sham system.

jensj's avatar
jensj committed

282 283 284 285

.. [#Kuisma2015]
jensj's avatar
jensj committed
   M. Kuisma, A. Sakko, T. P. Rossi, A. H. Larsen, J. Enkovaara, L. Lehtovaara, and T. T. Rantala,
287 288
   Localized surface plasmon resonance in silver nanoparticles: Atomistic first-principles time-dependent
   density functional theory calculations,
289 290 291 292 293 294 295 296
   *Phys. Rev. B* **69**, 245419 (2004).
   `doi:10.1103/PhysRevB.91.115431 <>`_

.. [#Rossi2015]
   T. P. Rossi, S. Lehtola, A. Sakko, M. J. Puska, and R. M. Nieminen,
   Nanoplasmonics simulations at the basis set limit through completeness-optimized, local numerical basis sets,
   *J. Chem. Phys.* **142**, 094114 (2015).
   `doi:10.1063/1.4913739 <>`_