# Difference between revisions of "Manual:Time-Dependent"

(43 intermediate revisions by 8 users not shown) | |||

Line 1: | Line 1: | ||

− | + | === Time evolution === | |

− | We are concerned with a set of Schrödinger-like equations for the electronic orbitals: | + | When {{Variable|CalculationMode|Calculation_Modes}} = {{code|td}}, the code performs the time-propagation of the electronic orbitals and – if required – the ionic positions. The latter task does not pose major algorithmical problems (the usual Verlet algorithms deal with that task); however the best way to propagate a Schrödinger-like equation is still unclear. Due to this fact, we provide with a rather excessive selection of possibilities for that purpose. Before describing the set of variables necessary to specify the way in which the time evolution is to be performed, it is worth making a brief introduction to the problem. |

+ | |||

+ | We are concerned with a set of Schrödinger-like equations for the electronic orbitals <math>\psi_j(t)\,\!</math>: | ||

+ | |||

+ | <math> | ||

+ | i{\partial \over \partial t}\psi_j(t) = H(t)\psi_j(t)\,\! | ||

+ | </math> | ||

+ | |||

+ | <math> | ||

+ | \psi_j(t=0) = \psi_j^{(0)}\,\! | ||

+ | </math> | ||

+ | |||

+ | Because this equation is linear (the time derivative and the Hamiltonian are both linear operators), one may formally define a linear “evolution” operator, <math>U(T, t)\,\!,</math> which transforms the initial vector into the solution at time <math>T\,\!</math>: | ||

+ | |||

+ | <math> | ||

+ | \psi_j(T) = U(T, 0)\psi_j^{(0)} | ||

+ | </math> | ||

+ | |||

+ | Moreover, there is the formally exact expression for the evolution operator | ||

+ | |||

+ | <math> | ||

+ | \psi_j(T) = \mathcal{T}\!\!\exp\left\{ -i\!\!\int_0^{T}d\tau H(\tau)\right\} \psi_j^{(0)}\,\!, | ||

+ | </math> | ||

+ | |||

+ | where <math>\mathcal{T}\!\!\exp\,\!</math> is the time-ordered exponential, which is a short-hand for: | ||

+ | |||

+ | <math> | ||

+ | \psi_j(T) = \left\{\sum_{n=0}^{\infty} \frac{\left(-i\right)^n}{n!} \int_0^t d\tau_1 \cdots \int_0^t d\tau_n H(\tau_1) \cdots H(\tau_n)\right\}\psi_j^{(0)}\,\! | ||

+ | </math> | ||

+ | |||

+ | If the Hamiltonian commutes with itself at different times, we can drop the time-ordering product, and leave a simple exponential. If the Hamiltonian is time-independent, which makes it trivially self commuting, the solution is simply written as: | ||

+ | |||

+ | <math> | ||

+ | \psi_j(T) = \exp\left\{ -iTH\right\} \psi_j^{(0)}\,\!. | ||

+ | </math> | ||

+ | |||

+ | Unfortunately, this is not the case for TDDFT when the system is exposed to external time-dependent perturbations like electric and magnetic fields or pulsed lasers. But even without an external time-dependency, there remains the intrinsic time-dependency of the Kohn-Sham Hamiltonian, which is built “self-consistently” from the varying electronic density. | ||

+ | |||

+ | The first step to tackle this problem is to split the propagation of the long interval <math>[0, T]\,\!</math> into <math>N\,\!</math> smaller steps by utilizing the group property | ||

+ | |||

+ | <math> | ||

+ | U(T, t) = U(T, t')U(t', t)\,\! | ||

+ | </math> | ||

+ | |||

+ | of the time-evolution operator. This yields the following time discretization: | ||

+ | |||

+ | <math> | ||

+ | U(T, 0) = \prod_{i=0}^{N-1}U(t_i+\Delta t, t_i)\,\!, | ||

+ | </math> | ||

+ | |||

+ | where <math>t_0=0\,\!</math>, <math>t_N=T\,\!</math>, <math>\Delta t = T/N\,\!</math>. So at each time step we are dealing with the problem of performing the short-time propagation: | ||

+ | |||

+ | <math> | ||

+ | \psi_j(t+\Delta t) = U(t+\Delta t, t)\psi_j(t) = \mathcal{T}\!\!\exp\left\{ -i\int_{t}^{t+\Delta t}d\tau H(\tau)\right\} \psi_j(t)\,\!. | ||

+ | </math> | ||

+ | |||

+ | In this way, one can monitor the evolution in the interior of <math>[0, T]\,\!</math>. In fact, the possibility of monitoring the evolution is generally a requirement. | ||

+ | |||

+ | This requirement imposes a natural restriction on the maximum size of <math>\Delta t\,\!</math>: if <math>\omega_{\mathrm{max}}\,\!</math> is the maximum frequency that we want to discern, <math>\Delta t\,\!</math> should be no larger than <math>\approx 1/\omega_{\mathrm{max}}\,\!</math>. Below this <math>\Delta t_{\mathrm{max}}\,\!</math>, we are free to choose <math>\Delta t\,\!</math> considering performance reasons: technically, the reason for the discretization is two-fold: the time-dependence of <math>H\,\!</math> is alleviated, and the norm of the exponential argument is reduced (the norm increases linearly with <math>\Delta t\,\!</math>). | ||

+ | |||

+ | Since we cannot drop the time-ordering product, the desired algorithm cannot be reduced, in principle, to the calculation of the action of the exponential of an operator over the initial vector. Some algorithms tailored to approximate the evolution operator, in fact, do not even need to peform such operator exponentials. Most of them, however, do rely on the calculation of one or more exponentials, such as the ones used by {{Octopus}}. This is why in principle we need to specify two different issues: the “evolution method”, and the “exponential method”. In other words: we need an algorithm to approximate the evolution operator <math>U(t+\Delta{t},t)\,\!</math> – which will be specified by variable {{Variable|TDPropagator|Time-Dependent}} – and, if this algorithm requires it, we will also need an algorithm to approximate the exponential of a matrix operator <math>\exp\left\{ A\right\}\,\!</math> – which will be specified by variable {{Variable|TDExponentialMethod|Time-Dependent}}. | ||

+ | |||

+ | ==== Propagators for the time-dependent Kohn-Sham equations ==== | ||

+ | |||

+ | In the following, we describe the propagators available in {{Octopus}} for the time-dependent Kohn-Sham equations. These propagators solve the problem of approximating the orbitals <math>\psi_j(t+\Delta t)\,\!</math> from the knowledge of <math>\psi_j(\tau)\,\!</math> and <math>H(\tau)\,\!</math>for <math>0\le\tau\le t\,\!</math>. Some methods require the knowledge of the Hamiltonian at some points <math>\tau\,\!</math> in time between <math>t\,\!</math> and <math>t+\Delta t\,\!</math>. | ||

+ | |||

+ | This quantity can be approximated by the following procedure: | ||

+ | |||

+ | # Approximate <math>H(\tau)\,\!</math> through extrapolation of a polynomial fit to a certain number of previous time steps. | ||

+ | # Propagate <math>\psi_j(t)\,\!</math> to get <math>\psi_j(t+\Delta t)\,\!</math>. | ||

+ | # Calculate <math>H(t+\Delta t)\,\!</math> from the orbitals <math>\psi_j(t+\Delta t)\,\!</math>. | ||

+ | # Interpolate the required <math>H(\tau)\,\!</math> from <math>H(t)\,\!</math> and <math>H(t+\Delta t)\,\!</math>. | ||

+ | # Repeat the steps 2 to 4 until self-consistency is reached. | ||

+ | |||

+ | In {{Octopus}}, however, the above scheme is dropped for performance reasons and only step 1 is implemented, via a second-order extrapolation, except for the first two steps where the extrapolation obviously cannot be trusted. Instead, we rely on a sufficiently small <math>\Delta t\,\!</math>. | ||

+ | |||

+ | ===== Midpoint rules ===== | ||

+ | |||

+ | The implicit midpoint rule or Crank-Nicolson method ({{Variable|TDPropagator|Time-Dependent}}={{code|crank_nicolson}}) calculates the exponential of the Hamiltonian by a first-order Padé approximation. The Hamiltonian is evaluated at <math>t + \Delta t/2\,\!</math> and the integral is dropped: | ||

+ | |||

+ | <math> | ||

+ | U_{\mathrm{CN}}(t + \Delta t, t) = \frac{1- i \frac{\Delta t}{2}H(t+\Delta t/2)}{1+ \frac{\Delta t}{2}H(t+\Delta t/2)}\,\! | ||

+ | </math> | ||

+ | |||

+ | The calculation of the matrix fraction is transformed into the solution of the linear system | ||

+ | |||

+ | <math> | ||

+ | L \psi_j(t+\Delta t) = b\,\! | ||

+ | </math> | ||

+ | |||

+ | with the known quantities | ||

+ | |||

+ | <math> | ||

+ | L = 1+i\frac{\Delta t}{2}H(t+\Delta t/2)\,\! | ||

+ | </math> | ||

+ | |||

+ | and | ||

+ | |||

+ | <math> | ||

+ | b = \left\{1-i\frac{\Delta t}{2}H(t+\Delta t/2)\right\}\psi_j(t).\,\! | ||

+ | </math> | ||

+ | |||

+ | The Crank-Nicolson scheme is unitary and preserves time-reversal symmetry. | ||

+ | |||

+ | A simpler but similar scheme is the exponential midpoint rule | ||

+ | ({{Variable|TDPropagator|Time-Dependent}}={{code|exp_mid}}), which is unitary and time-reversal-symmetry-preserving, but has the drawback that it requires fairly small time steps: | ||

+ | |||

+ | <math> | ||

+ | U_{\mathrm{EM}}(t + \Delta t, t) = \exp\left\{-i\Delta t H(t + \Delta t/2)\right\}\,\! | ||

+ | </math> | ||

+ | |||

+ | ===== Magnus expansions ===== | ||

+ | |||

+ | Magnus expansion ({{Variable|TDPropagator|Time-Dependent}}={{code|magnus}}) is the most sophisticated propagation implemented in {{Octopus}}. According to Magnus, there exists an operator <math>\Omega(t+\Delta t, t)\,\!</math> for which holds | ||

+ | |||

+ | <math> | ||

+ | U(t+\Delta t, t) = \exp\left\{\Omega(t+\Delta t, t)\right\}\,\! | ||

+ | </math> | ||

+ | |||

+ | given by the series | ||

+ | |||

+ | <math> | ||

+ | \Omega(t + \Delta t, t) = \sum_{k=1}^\infty \Omega_k(t + \Delta t, t)\,\! | ||

+ | </math> | ||

+ | |||

+ | that converges at least for some local environment of <math>t\,\!</math>. | ||

+ | |||

+ | The operators <math>\Omega_k(t+\Delta t, t)\,\!</math> are generated with the recursive procedure | ||

+ | |||

+ | <math> | ||

+ | \Omega_k(t+\Delta t, t) = \sum_{l=0}^{k-1} \frac{B_l}{l!}\int_t^{t+\Delta t} S^l_k(\tau)d\tau,\,\! | ||

+ | </math> | ||

+ | |||

+ | <math> | ||

+ | S_1^0(\tau) = -iH(\tau), \quad S_k^0=0\ \mathrm{for}\ k>1,\,\! | ||

+ | </math> | ||

+ | |||

+ | <math> | ||

+ | S_k^j(\tau) = \sum_{m=1}^{k-l}\left[\Omega_m(t+\Delta t, t), S_{k-m}^{l-1}(\tau)\right]\ \mathrm{for}\ 1\le l\le k-1,\,\! | ||

+ | </math> | ||

+ | |||

+ | where <math>B_l\,\!</math> are Bernoulli numbers. | ||

+ | |||

+ | In {{Octopus}} we have implemented a fourth-order Magnus expansion, which means that the operator series is truncated to second order and the integrals are calculated by a second-order quadrature formula. The resulting operator is | ||

+ | |||

+ | <math> | ||

+ | \Omega_{M(4)}(t + \Delta t, t) = -i\frac{\Delta t}{2}\left[H(t_1)+ H(t_2)\right] - \frac{\sqrt{3}\Delta t^2}{12}\left[H(t_2), H(t_1)\right]\,\! | ||

+ | </math> | ||

+ | |||

+ | with the quadrature sampling points <math>t_{1,2} = t + \left[\frac{1}{2}\mp \frac{\sqrt{3}}{6}\right]\Delta t\,\!</math>. | ||

+ | |||

+ | With a modified Hamiltonian | ||

+ | |||

+ | <math> | ||

+ | H_{M(4)}(t, \Delta t) = \overline{H}(t, \Delta t) + i \left[T + v_{\mathrm{ext}}^{\mathrm{nonlocal}}(t), \overline{\Delta V}(t, \Delta t)\right],\,\! | ||

+ | </math> | ||

+ | |||

+ | <math> | ||

+ | \overline{H}(t, \Delta t) = T + \frac{1}{2}\left[V_{\mathrm{KS}}(t_1)+V_{\mathrm{KS}}(t_2)\right],\,\! | ||

+ | </math> | ||

+ | |||

+ | <math> | ||

+ | \overline{\Delta V}(t, \Delta t) = \frac{\sqrt{3}}{12}\Delta t\left[V_{\mathrm{KS}}(t_1)-V_{\mathrm{KS}}(t_1)\right]\,\! | ||

+ | </math> | ||

+ | |||

+ | the propagator takes the form | ||

+ | |||

+ | <math> | ||

+ | U_{M(4)}(t+\Delta t, t) = \exp\left\{-i \Delta t H_{M(4)}(t, \Delta t)\right\}.\,\! | ||

+ | </math> | ||

+ | |||

+ | Note that only the nonlocal components of the Kohn-Sham Hamiltonian contribute to the commutator and, furthermore, that we make the assumption that the nonlocal potential <math>v_{\mathrm{ext}}^{\mathrm{nonlocal}}(t)\,\!</math> does not vary significantly in the interval <math>[t, t+\Delta t]\,\!</math>. This nonlocal component stems from the ionic pseudopotentials. Consequently, its variation is caused by the ionic movement, which is negligible on the electronic time scale determining <math>\Delta t\,\!</math>. | ||

+ | |||

+ | ===== Time-reversal-symmetry based propagation ===== | ||

+ | |||

+ | Due to time-reversal symmetry, propagating backwards by <math>\Delta t/2\,\!</math> starting from <math>\psi_j(t+\Delta t)\,\!</math> should lead to the same result as propagating forwards by <math>\Delta t/2\,\!</math> starting from <math>\psi_j(t)\,\!</math>. Using the simplest approximation to the evolution operator, we end up with the condition | ||

+ | |||

+ | <math> | ||

+ | \exp\left\{+i\frac{\Delta t}{2}H(t +\Delta t)\right\} \psi_j(t+\Delta t) = \exp\left\{-i\frac{\Delta t}{2}H(t)\right\} \psi_j(t)\,\! | ||

+ | </math> | ||

+ | |||

+ | Rearranging the terms gives an approximation for the propagator: | ||

+ | |||

+ | <math> | ||

+ | U_{\mathrm{ETRS}}(t + \Delta t, t) = \exp\left\{-i \frac{\Delta t}{2} H(t + \Delta t)\right\} | ||

+ | \exp\left\{-i \frac{\Delta t}{2}H(t)\right\}\,\! | ||

+ | </math> | ||

+ | |||

+ | This ''enforced time-reversal symmetry'' method is available in {{Octopus}} by setting ({{Variable|TDPropagator|Time-Dependent}}={{code|etrs}}). | ||

+ | |||

+ | It is worthwhile to give a sidenote on the approximation of <math>H(t+\Delta t)\,\!</math>: for the {{code|etrs}} method the Hamiltonian at time <math>t+\Delta t\,\!</math> is not extrapolated, but rather built from the density <math>n' = \sum_j|\psi'_j(t+\Delta t)|^2\,\!</math>, which, in turn, is calculated from the orbital estimate | ||

+ | |||

+ | <math> | ||

+ | \psi'_j(t+\Delta t) = \exp\left\{-i\Delta t H(t)\right\}\psi_j(t).\,\! | ||

+ | </math> | ||

+ | |||

+ | There exists, however, also a variant {{Variable|TDPropagator|Time-Dependent}}={{code|aetrs}} ''(approximated enforced time-reversal symmetry)'' that performs a second-order polynomial extrapolation of <math>H(t-k\Delta t)\,\!</math>, <math>k=0,1,2\,\!</math>, to get <math>H(t+\Delta t)\,\!</math>, which is about 40 % faster than {{code|etrs}}. | ||

+ | |||

+ | ==== Approximations to the exponential of an operator ==== | ||

+ | |||

+ | Most of the evolution methods described in the previous section require the calculation of the exponential of a matrix. Before going into the details of the {{Variable|TDExponentialMethod|Time-Dependent}} that {{Octopus}} provides, one general difficulty deserves mentioning. | ||

+ | |||

+ | In principle, we would like to calculate <math>\exp\left\{A\right\}v\,\!</math> by first calculating <math>\exp\left\{A\right\}\,\!</math> and then applying this result to any vector <math>v\,\!</math>. Unfortunately, the size of our Hamiltonian matrix is of the order <math>\approx 10^5\,\!</math> which forbids its full storage in matrix form. Apart from that, methods to calculate the exponential of a matrix explicitly are limited to a few thousand matrix elements. For this reason, we have to turn to iterative solutions that calculate <math>\exp\left\{A\right\}v\,\!,</math> for a particular vector <math>v\,\!</math>. | ||

+ | |||

+ | ===== Polynomial expansions ===== | ||

+ | |||

+ | The simplest possibility is to use the definition of the exponential of a matrix | ||

+ | |||

+ | <math> | ||

+ | \exp\left\{A\right\} = \sum_{k=0}^\infty \frac{1}{k!}A^k\,\! | ||

+ | </math> | ||

+ | |||

+ | to get the approximation of order <math>k\,\!</math>({{Variable|TDExponentialMethod|Time-Dependent}}={{code|taylor}}): | ||

+ | |||

+ | <math> | ||

+ | \mathrm{taylor}_N\left\{A, v\right\} = \sum_{k=0}^N\frac{1}{k!}A^kv\,\! | ||

+ | </math> | ||

+ | |||

+ | <math>\mathrm{taylor}_N\left\{A, v\right\}\,\!</math> amounts to the expansion of the exponential in the standard polynomial base <math>\left\{1, x, x^2, \ldots\right\}\,\!</math>. | ||

+ | |||

+ | Experience shows that the choice <math>k=4\,\!</math> gives particularly good results for our TDDFT implementation. | ||

+ | |||

+ | The standard polynomial basis is not the only possibility; {{Octopus}} also implements the expansion of the exponential in the Chebyshev basis ({{Variable|TDExponentialMethod|Time-Dependent}}={{code|chebyshev}}): | ||

+ | |||

+ | <math> | ||

+ | \mathrm{cheb}_N\left\{A, v\right\} = \sum_{k=0}^Nc_kT_k(A)kv\,\! | ||

+ | </math> | ||

+ | |||

+ | with <math>T_k\,\!</math> being the Chebyshev polynomial of order <math>k\,\!</math>. | ||

+ | |||

+ | The truncation <math>N\,\!</math> for both these expansions can be set by the input variable {{Variable|TDExpOrder|Time-Dependent}}. | ||

+ | |||

+ | ===== Krylov-subspace projection ===== | ||

+ | |||

+ | The Krylov subspace of order <math>N\,\!</math> for a given operator <math>A\,\!</math> and vector <math>v\,\!</math> is defined as | ||

+ | |||

+ | <math> | ||

+ | \mathcal{K}_N\left\{A, v\right\} = \mathrm{span}\left\{v, Av, A^2v, \ldots, A^{N-1}v\right\}.\,\! | ||

+ | </math> | ||

+ | |||

+ | The idea is to find the element of <math>\mathcal{K}_N\left\{A, v\right\}\,\!</math> that optimally approximates <math>\exp\left\{A\right\}\,\!</math> in a least-squares sense. It can be proven that this is given by | ||

+ | |||

+ | <math> | ||

+ | \beta V_N(V_N^T\exp\left\{A\right\}V_N)e_1\,\! | ||

+ | </math> | ||

+ | |||

+ | with <math>V_N = [v_1, \ldots, v_N]\,\!</math> being an orthonormal basis of <math>\mathcal{K}_N\left\{A, v\right\}\,\!</math> calculated with the Lanczos procedure. To get rid of the exponential, the approximation | ||

<math> | <math> | ||

− | + | V_N^T\exp\left\{A\right\}V_N \approx \exp\left\{V_N^TAV_N\right\}\,\! | |

</math> | </math> | ||

+ | |||

+ | is introduced. The object <math>H_N=V_N^TAV_N\,\!</math> is also a result of the Lanczos procedure and of the small dimension <math>k\times k\,\!</math> which allows for direct calculation of the remaining exponential. So, we have | ||

+ | |||

+ | <math> | ||

+ | \mathrm{lanczos}_N\left\{A, v\right\} = V_N\exp\left\{H_N\right\}e_1,\,\!</math> | ||

+ | |||

+ | which can be selected by setting {{Variable|TDExponentialMethod|Time-Dependent}}={{code|lanczos}}. When actually calculating the exponential, {{Octopus}} recursively generates the quantities <math>H_N\,\!</math> and <math>V_N\,\!</math> until some convergence criterion – controlled by {{Variable|TDLanczosTol|Time-Dependent}} – is met or the order exceeds the maximum allowed order controlled by {{Variable|TDExpOrder|Time-Dependent}}. In the latter case, a warning is written. Care should be taken in choosing the convergence parameter small enough to avoid faulty evolutions. | ||

+ | |||

+ | === Performing a time-propagation === | ||

+ | |||

+ | To actually perform a time-propagation, a necessary prerequisite is to have the ground-state density (see [[Manual:Ground_State|Ground State]]) of the system under consideration. | ||

+ | |||

+ | Then, the {{Variable|CalculationMode|Calculation_Modes}} has to be set to {{code|td}}. | ||

+ | |||

+ | Besides the already mentioned input variables concerning the propagation method, two more important parameters have to be set: {{Variable|TDTimeStep|Time-Dependent}} and {{Variable|TDMaxSteps|Time-Dependent}}. The first one sets <math>\Delta t\,\!</math>, the second sets the number of iterations. It is convenient to define these two variables like this: | ||

+ | |||

+ | |||

+ | T = 0.1 # Length of propagation. | ||

+ | dt = 0.002 # Length of time step. | ||

+ | |||

+ | {{Variable|TDMaxSteps|Time-Dependent}} = T/dt | ||

+ | {{Variable|TDTimeStep|Time-Dependent}} = dt | ||

+ | |||

+ | |||

+ | In the absence of a perturbation, the system's total energy should be a constant. This check to determine a reasonable time step has to be done before any other calculation. | ||

+ | |||

+ | The relevant parts of {{Octopus}}' output might look like | ||

+ | |||

+ | <pre> | ||

+ | Iter Time Energy Elapsed Time | ||

+ | 1 0.002000 -541.542073 4.800 | ||

+ | 2 0.004000 -541.542073 4.560 | ||

+ | 3 0.006000 -541.542073 3.880 | ||

+ | . | ||

+ | . | ||

+ | . | ||

+ | 48 0.096000 -541.542073 7.420 | ||

+ | 49 0.098000 -541.542073 7.620 | ||

+ | 50 0.100000 -541.542073 7.490 | ||

+ | </pre> | ||

+ | |||

+ | The energy is printed in the third column and should remain constant. | ||

+ | In general, larger time steps are desirable to shorten computational propagation time but keep in mind that the size of the time step limits to the maximum frequency you will be able to observe, and, consequently, also any external perturbation to which you might wish to expose the system. | ||

+ | |||

+ | === External fields === | ||

+ | |||

+ | |||

+ | |||

+ | ===== Delta kick: Calculating an absorption spectrum ===== | ||

+ | |||

+ | To obtain the linear optical absorption spectrum of the system, we follow the scheme proposed by Yabana and Bertsch, and | ||

+ | excite all frequencies of the system by giving some small | ||

+ | momentum (<math>{\mathcal K}</math>) to the electrons. This is achieved by transforming the ground-state wavefunctions according to: | ||

<math> | <math> | ||

− | \ | + | \varphi_i(r, \delta t) = e^{i {\mathcal K} z} \varphi_i(r, 0) |

+ | \,, | ||

</math> | </math> | ||

− | + | and then propagating these wavefunctions for some (finite) time. | |

+ | The spectrum can then be obtained from the expression for the dipole | ||

+ | strength function <math>S(\omega)</math>: | ||

<math> | <math> | ||

− | \ | + | S(\omega) = \frac{2 \omega}{\pi} {\mathcal Im} \alpha(\omega) |

+ | \,, | ||

</math> | </math> | ||

− | + | where the dynamical polarizability, <math>\alpha(\omega)</math>, is | |

+ | essentially the Fourier transform of the dipole moment of the system | ||

+ | <math>d(t)</math>: | ||

<math> | <math> | ||

− | \ | + | \alpha(\omega) = \frac{1}{\mathcal{K}}\int\!\! dt \; |

+ | e^{i\omega t} \left[d(t)-d(0)\right]\,. | ||

</math> | </math> | ||

− | + | With this definition, the Thomas-Reiche-Kuhn ''f''-sum rule | |

+ | for the number of electrons, <math>N</math>, is given by the | ||

+ | integral: | ||

<math> | <math> | ||

− | \ | + | N = \int\!\! d\omega\;S(\omega)\,. |

</math> | </math> | ||

− | + | This sum rule can be used to check the quality of the calculations. Another check | |

+ | is energy conservation, which TDDFT respects when no external field is applied. | ||

+ | |||

+ | To obtain a spectrum with such a recipe in {{Octopus}} one has to follow the steps: | ||

+ | |||

+ | # Choose a system of linearly independent (can be non-orthogonal) axes (defined by the variable {{variable|TDPolarization|Time-Dependent}}). The defaults are the 3 Cartesian axes. | ||

+ | # Add an electric kick using the variable {{variable|TDDeltaStrength|Time-Dependent}}. Its value should be small so that we remain in the linear regime, but large enough to avoid numerical errors. | ||

+ | # Run a time-dependent simulation for the 3 independent directions. This involves running {{octopus}} 3 times, changing the value of {{variable|TDPolarizationDirection|Time-Dependent}} each time. After each run, move the file <tt>td.general/multipoles</tt> to <tt>td.general/multipoles.X<tt>, where <tt>X</tt> is 1, 2, or 3. | ||

+ | # Run the utility [[Manual:External_utilities:oct-propagation_spectrum|oct-propagation_spectrum]]. | ||

+ | |||

+ | ===== Lasers ===== | ||

+ | |||

+ | To calculate non-linear optical properties, we follow | ||

+ | the evolution of the system under the influence of a laser field that is treated | ||

+ | in the dipole approximation (although this constraint can be removed). | ||

+ | The harmonic emission spectrum can then be calculated from | ||

+ | the acceleration of the dipole moment: | ||

+ | |||

+ | <math> | ||

+ | H(\omega) \propto \left| \int\!\! dt \; e^{i\omega t} \frac{d^2}{dt^2} d(t) \right|^2\,. | ||

+ | </math> | ||

− | + | During the propagation, charge density is absorbed at the boundaries | |

+ | of the simulation region, either by an imaginary absorbing potential | ||

+ | or a mask function. In the first case, we add to the Kohn-Sham potential a term | ||

<math> | <math> | ||

− | + | V_{\rm eff}(r, t) = V_{\rm KS}(r,t) - i V_{\rm abs}(r) | |

+ | \,, | ||

</math> | </math> | ||

− | where | + | where <math>V_{\rm abs}</math> is zero in the inner region of the simulation box, and |

+ | rises smoothly till the edges. By adjusting both the height and | ||

+ | the shape of the potential, we can select which momenta are absorbed | ||

+ | and prevent the unwanted reflections at the boundary. | ||

+ | When using a mask, the wavefunction is multiplied in each time-step | ||

+ | by a function which is 1 in the inner simulation region and gradually | ||

+ | goes to 0 at the borders: | ||

<math> | <math> | ||

− | \ | + | \varphi(r, t) \rightarrow M(r) \varphi(r, t) |

+ | \,. | ||

</math> | </math> | ||

− | + | The absorbed charge can be interpreted as an ionization probability | |

+ | and can be used to estimate the photo-electron spectra. | ||

+ | The box size has to be big enough so that the physical system is not | ||

+ | perturbed by the absorbing boundaries. Note that the wavefunctions are no | ||

+ | longer normalized as the system slowly gets charged. | ||

+ | |||

+ | |||

+ | === Symmetries === | ||

+ | |||

+ | The dynamic polarizability (trivially related to optical absorption) is, in its most general form, a 3x3 tensor. The reason is that we can shine light on the system polarized in any of the three Cartesian axes, and for each of these three cases measure how the dipole of the molecule oscillates along the three Cartesian axes. This usually means that to obtain the full dynamic polarizability of the molecule we usually need to apply 3 different perturbations along <math>x, y, z\,</math>, by setting {{variable|TDPolarizationDirection|Time-Dependent}} to 1, 2, or 3. | ||

+ | |||

+ | However, if the molecule has some symmetries, it is in general possible to reduce the total number of calculations from 3 to 2, or even 1. This is explained in detail [http://nano-bio.ehu.es/node/576 here]. To use this formalism in {{octopus}}, you can use the variables {{variable|TDPolarization|Time-Dependent}}, {{variable|TDPolarizationDirection|Time-Dependent}}, {{variable|TDPolarizationEquivAxes|Time-Dependent}}, and {{variable|TDPolarizationWprime|Time-Dependent}}. The block {{variable|TDPolarization|Time-Dependent}} defines a basis (not necessarily orthogonal) chosen to maximize the number of equivalent axes, and {{variable|TDPolarizationDirection|Time-Dependent}}, and {{variable|TDPolarizationWprime|Time-Dependent}} are vectors specified in that basis. | ||

+ | Let us give a couple of examples. | ||

+ | |||

+ | The methane molecule has <math>T_d</math> symmetry, which means that the response is identical for all directions. This means that we only need one propagation to obtain the whole tensor. This propagation can be performed in any direction we wish. So we could use the input | ||

+ | |||

+ | %{{variable|TDPolarization|Time-Dependent}} | ||

+ | 1 | 0 | 0 | ||

+ | 0 | 1 | 0 | ||

+ | 0 | 0 | 1 | ||

+ | % | ||

+ | {{variable|TDPolarizationDirection|Time-Dependent}} = 1 | ||

+ | {{variable|TDPolarizationEquivAxes|Time-Dependent}} = 3 | ||

+ | %{{variable|TDPolarizationWprime|Time-Dependent}} | ||

+ | 0 | 0 | 1 | ||

+ | % | ||

+ | |||

+ | Note that we could have omitted the blocks {{variable|TDPolarization|Time-Dependent}} and {{variable|TDPolarizationWprime|Time-Dependent}} in the previous input file, as these are their default values. | ||

+ | |||

+ | Now let us look at a linear molecule. In this case, you might think that we need two calculations to obtain the whole tensor, one for the direction along the axis of the molecule, and another for the axis perpendicular to the molecule. The fact is that we need only one, in a specially chosen direction, so that our field has components both along the axis of the molecule and perpendicular to it. Let us assume that the axis of the molecule is oriented along the <math>x</math>-axis. Then we can use | ||

+ | |||

+ | %{{variable|TDPolarization|Time-Dependent}} | ||

+ | 1/sqrt(2) | -1/sqrt(2) | 0 | ||

+ | 1/sqrt(2) | 1/sqrt(2) | 0 | ||

+ | 1/sqrt(2) | 0 | 1/sqrt(2) | ||

+ | % | ||

+ | {{variable|TDPolarizationDirection|Time-Dependent}} = 1 | ||

+ | {{variable|TDPolarizationEquivAxes|Time-Dependent}} = 3 | ||

+ | %{{variable|TDPolarizationWprime|Time-Dependent}} | ||

+ | 0 | 0 | 1 | ||

+ | % | ||

+ | |||

+ | You should try to convince yourself that the three axes are indeed equivalent and linearly independent. | ||

+ | |||

+ | Finally, let us look at a general planar molecule (in the ''xy'' plane). In principle we need only two calculations (reduced to one if more symmetries are present, as for benzene). In this case we chose one of the polarization axes on the plane, and the other two rotated 45 degrees out of plane: | ||

+ | |||

+ | %{{variable|TDPolarizationDirection|TDPolarization}} | ||

+ | 1/sqrt(2) | 0 | 1/sqrt(2) | ||

+ | 1/sqrt(2) | 0 |-1/sqrt(2) | ||

+ | 0 | 1 | 0 | ||

+ | % | ||

+ | |||

+ | {{variable|TDPolarizationEquivAxes|Time-Dependent}} = 2 | ||

+ | |||

+ | In this case, we need two runs, one for {{variable|TDPolarizationDirection|Time-Dependent}} equal to 1, and another for it equal to 3. Note that if there are fewer than 3 equivalent axes, {{variable|TDPolarizationWprime|Time-Dependent}} is irrelevant. | ||

− | |||

− | + | {{Manual_foot|prev=Manual:Ground_State|next=Manual:Casida}} | |

− |

## Latest revision as of 12:41, 27 November 2020

### Time evolution

When `CalculationMode`

= `td`

, the code performs the time-propagation of the electronic orbitals and – if required – the ionic positions. The latter task does not pose major algorithmical problems (the usual Verlet algorithms deal with that task); however the best way to propagate a Schrödinger-like equation is still unclear. Due to this fact, we provide with a rather excessive selection of possibilities for that purpose. Before describing the set of variables necessary to specify the way in which the time evolution is to be performed, it is worth making a brief introduction to the problem.

We are concerned with a set of Schrödinger-like equations for the electronic orbitals :

Because this equation is linear (the time derivative and the Hamiltonian are both linear operators), one may formally define a linear “evolution” operator, which transforms the initial vector into the solution at time :

Moreover, there is the formally exact expression for the evolution operator

where is the time-ordered exponential, which is a short-hand for:

If the Hamiltonian commutes with itself at different times, we can drop the time-ordering product, and leave a simple exponential. If the Hamiltonian is time-independent, which makes it trivially self commuting, the solution is simply written as:

Unfortunately, this is not the case for TDDFT when the system is exposed to external time-dependent perturbations like electric and magnetic fields or pulsed lasers. But even without an external time-dependency, there remains the intrinsic time-dependency of the Kohn-Sham Hamiltonian, which is built “self-consistently” from the varying electronic density.

The first step to tackle this problem is to split the propagation of the long interval into smaller steps by utilizing the group property

of the time-evolution operator. This yields the following time discretization:

where , , . So at each time step we are dealing with the problem of performing the short-time propagation:

In this way, one can monitor the evolution in the interior of . In fact, the possibility of monitoring the evolution is generally a requirement.

This requirement imposes a natural restriction on the maximum size of : if is the maximum frequency that we want to discern, should be no larger than . Below this , we are free to choose considering performance reasons: technically, the reason for the discretization is two-fold: the time-dependence of is alleviated, and the norm of the exponential argument is reduced (the norm increases linearly with ).

Since we cannot drop the time-ordering product, the desired algorithm cannot be reduced, in principle, to the calculation of the action of the exponential of an operator over the initial vector. Some algorithms tailored to approximate the evolution operator, in fact, do not even need to peform such operator exponentials. Most of them, however, do rely on the calculation of one or more exponentials, such as the ones used by Octopus. This is why in principle we need to specify two different issues: the “evolution method”, and the “exponential method”. In other words: we need an algorithm to approximate the evolution operator – which will be specified by variable `TDPropagator`

– and, if this algorithm requires it, we will also need an algorithm to approximate the exponential of a matrix operator – which will be specified by variable `TDExponentialMethod`

.

#### Propagators for the time-dependent Kohn-Sham equations

In the following, we describe the propagators available in Octopus for the time-dependent Kohn-Sham equations. These propagators solve the problem of approximating the orbitals from the knowledge of and for . Some methods require the knowledge of the Hamiltonian at some points in time between and .

This quantity can be approximated by the following procedure:

- Approximate through extrapolation of a polynomial fit to a certain number of previous time steps.
- Propagate to get .
- Calculate from the orbitals .
- Interpolate the required from and .
- Repeat the steps 2 to 4 until self-consistency is reached.

In Octopus, however, the above scheme is dropped for performance reasons and only step 1 is implemented, via a second-order extrapolation, except for the first two steps where the extrapolation obviously cannot be trusted. Instead, we rely on a sufficiently small .

##### Midpoint rules

The implicit midpoint rule or Crank-Nicolson method (`TDPropagator`

=`crank_nicolson`

) calculates the exponential of the Hamiltonian by a first-order Padé approximation. The Hamiltonian is evaluated at and the integral is dropped:

The calculation of the matrix fraction is transformed into the solution of the linear system

with the known quantities

and

The Crank-Nicolson scheme is unitary and preserves time-reversal symmetry.

A simpler but similar scheme is the exponential midpoint rule
(`TDPropagator`

=`exp_mid`

), which is unitary and time-reversal-symmetry-preserving, but has the drawback that it requires fairly small time steps:

##### Magnus expansions

Magnus expansion (`TDPropagator`

=`magnus`

) is the most sophisticated propagation implemented in Octopus. According to Magnus, there exists an operator for which holds

given by the series

that converges at least for some local environment of .

The operators are generated with the recursive procedure

where are Bernoulli numbers.

In Octopus we have implemented a fourth-order Magnus expansion, which means that the operator series is truncated to second order and the integrals are calculated by a second-order quadrature formula. The resulting operator is

with the quadrature sampling points .

With a modified Hamiltonian

the propagator takes the form

Note that only the nonlocal components of the Kohn-Sham Hamiltonian contribute to the commutator and, furthermore, that we make the assumption that the nonlocal potential does not vary significantly in the interval . This nonlocal component stems from the ionic pseudopotentials. Consequently, its variation is caused by the ionic movement, which is negligible on the electronic time scale determining .

##### Time-reversal-symmetry based propagation

Due to time-reversal symmetry, propagating backwards by starting from should lead to the same result as propagating forwards by starting from . Using the simplest approximation to the evolution operator, we end up with the condition

Rearranging the terms gives an approximation for the propagator:

This *enforced time-reversal symmetry* method is available in Octopus by setting (`TDPropagator`

=`etrs`

).

It is worthwhile to give a sidenote on the approximation of : for the `etrs`

method the Hamiltonian at time is not extrapolated, but rather built from the density , which, in turn, is calculated from the orbital estimate

There exists, however, also a variant `TDPropagator`

=`aetrs`

*(approximated enforced time-reversal symmetry)* that performs a second-order polynomial extrapolation of , , to get , which is about 40 % faster than `etrs`

.

#### Approximations to the exponential of an operator

Most of the evolution methods described in the previous section require the calculation of the exponential of a matrix. Before going into the details of the `TDExponentialMethod`

that Octopus provides, one general difficulty deserves mentioning.

In principle, we would like to calculate by first calculating and then applying this result to any vector . Unfortunately, the size of our Hamiltonian matrix is of the order which forbids its full storage in matrix form. Apart from that, methods to calculate the exponential of a matrix explicitly are limited to a few thousand matrix elements. For this reason, we have to turn to iterative solutions that calculate for a particular vector .

##### Polynomial expansions

The simplest possibility is to use the definition of the exponential of a matrix

to get the approximation of order (`TDExponentialMethod`

=`taylor`

):

amounts to the expansion of the exponential in the standard polynomial base .

Experience shows that the choice gives particularly good results for our TDDFT implementation.

The standard polynomial basis is not the only possibility; Octopus also implements the expansion of the exponential in the Chebyshev basis (`TDExponentialMethod`

=`chebyshev`

):

with being the Chebyshev polynomial of order .

The truncation for both these expansions can be set by the input variable `TDExpOrder`

.

##### Krylov-subspace projection

The Krylov subspace of order for a given operator and vector is defined as

The idea is to find the element of that optimally approximates in a least-squares sense. It can be proven that this is given by

with being an orthonormal basis of calculated with the Lanczos procedure. To get rid of the exponential, the approximation

is introduced. The object is also a result of the Lanczos procedure and of the small dimension which allows for direct calculation of the remaining exponential. So, we have

which can be selected by setting `TDExponentialMethod`

=`lanczos`

. When actually calculating the exponential, Octopus recursively generates the quantities and until some convergence criterion – controlled by `TDLanczosTol`

– is met or the order exceeds the maximum allowed order controlled by `TDExpOrder`

. In the latter case, a warning is written. Care should be taken in choosing the convergence parameter small enough to avoid faulty evolutions.

### Performing a time-propagation

To actually perform a time-propagation, a necessary prerequisite is to have the ground-state density (see Ground State) of the system under consideration.

Then, the `CalculationMode`

has to be set to `td`

.

Besides the already mentioned input variables concerning the propagation method, two more important parameters have to be set: `TDTimeStep`

and `TDMaxSteps`

. The first one sets , the second sets the number of iterations. It is convenient to define these two variables like this:

T = 0.1 # Length of propagation. dt = 0.002 # Length of time step.`TDMaxSteps`

= T/dt`TDTimeStep`

= dt

In the absence of a perturbation, the system's total energy should be a constant. This check to determine a reasonable time step has to be done before any other calculation.

The relevant parts of Octopus' output might look like

Iter Time Energy Elapsed Time 1 0.002000 -541.542073 4.800 2 0.004000 -541.542073 4.560 3 0.006000 -541.542073 3.880 . . . 48 0.096000 -541.542073 7.420 49 0.098000 -541.542073 7.620 50 0.100000 -541.542073 7.490

The energy is printed in the third column and should remain constant. In general, larger time steps are desirable to shorten computational propagation time but keep in mind that the size of the time step limits to the maximum frequency you will be able to observe, and, consequently, also any external perturbation to which you might wish to expose the system.

### External fields

##### Delta kick: Calculating an absorption spectrum

To obtain the linear optical absorption spectrum of the system, we follow the scheme proposed by Yabana and Bertsch, and excite all frequencies of the system by giving some small momentum () to the electrons. This is achieved by transforming the ground-state wavefunctions according to:

and then propagating these wavefunctions for some (finite) time. The spectrum can then be obtained from the expression for the dipole strength function :

where the dynamical polarizability, , is essentially the Fourier transform of the dipole moment of the system :

With this definition, the Thomas-Reiche-Kuhn *f*-sum rule
for the number of electrons, , is given by the
integral:

This sum rule can be used to check the quality of the calculations. Another check is energy conservation, which TDDFT respects when no external field is applied.

To obtain a spectrum with such a recipe in Octopus one has to follow the steps:

- Choose a system of linearly independent (can be non-orthogonal) axes (defined by the variable
`TDPolarization`

). The defaults are the 3 Cartesian axes. - Add an electric kick using the variable
`TDDeltaStrength`

. Its value should be small so that we remain in the linear regime, but large enough to avoid numerical errors. - Run a time-dependent simulation for the 3 independent directions. This involves running Octopus 3 times, changing the value of
`TDPolarizationDirection`

each time. After each run, move the file`td.general/multipoles`to`td.general/multipoles.X``, where``X`is 1, 2, or 3. - Run the utility oct-propagation_spectrum.

##### Lasers

To calculate non-linear optical properties, we follow the evolution of the system under the influence of a laser field that is treated in the dipole approximation (although this constraint can be removed). The harmonic emission spectrum can then be calculated from the acceleration of the dipole moment:

During the propagation, charge density is absorbed at the boundaries of the simulation region, either by an imaginary absorbing potential or a mask function. In the first case, we add to the Kohn-Sham potential a term

where is zero in the inner region of the simulation box, and rises smoothly till the edges. By adjusting both the height and the shape of the potential, we can select which momenta are absorbed and prevent the unwanted reflections at the boundary. When using a mask, the wavefunction is multiplied in each time-step by a function which is 1 in the inner simulation region and gradually goes to 0 at the borders:

The absorbed charge can be interpreted as an ionization probability and can be used to estimate the photo-electron spectra. The box size has to be big enough so that the physical system is not perturbed by the absorbing boundaries. Note that the wavefunctions are no longer normalized as the system slowly gets charged.

### Symmetries

The dynamic polarizability (trivially related to optical absorption) is, in its most general form, a 3x3 tensor. The reason is that we can shine light on the system polarized in any of the three Cartesian axes, and for each of these three cases measure how the dipole of the molecule oscillates along the three Cartesian axes. This usually means that to obtain the full dynamic polarizability of the molecule we usually need to apply 3 different perturbations along , by setting `TDPolarizationDirection`

to 1, 2, or 3.

However, if the molecule has some symmetries, it is in general possible to reduce the total number of calculations from 3 to 2, or even 1. This is explained in detail here. To use this formalism in Octopus, you can use the variables `TDPolarization`

, `TDPolarizationDirection`

, `TDPolarizationEquivAxes`

, and `TDPolarizationWprime`

. The block `TDPolarization`

defines a basis (not necessarily orthogonal) chosen to maximize the number of equivalent axes, and `TDPolarizationDirection`

, and `TDPolarizationWprime`

are vectors specified in that basis.
Let us give a couple of examples.

The methane molecule has symmetry, which means that the response is identical for all directions. This means that we only need one propagation to obtain the whole tensor. This propagation can be performed in any direction we wish. So we could use the input

%`TDPolarization`

1 | 0 | 0 0 | 1 | 0 0 | 0 | 1 %`TDPolarizationDirection`

= 1`TDPolarizationEquivAxes`

= 3 %`TDPolarizationWprime`

0 | 0 | 1 %

Note that we could have omitted the blocks `TDPolarization`

and `TDPolarizationWprime`

in the previous input file, as these are their default values.

Now let us look at a linear molecule. In this case, you might think that we need two calculations to obtain the whole tensor, one for the direction along the axis of the molecule, and another for the axis perpendicular to the molecule. The fact is that we need only one, in a specially chosen direction, so that our field has components both along the axis of the molecule and perpendicular to it. Let us assume that the axis of the molecule is oriented along the -axis. Then we can use

%`TDPolarization`

1/sqrt(2) | -1/sqrt(2) | 0 1/sqrt(2) | 1/sqrt(2) | 0 1/sqrt(2) | 0 | 1/sqrt(2) %`TDPolarizationDirection`

= 1`TDPolarizationEquivAxes`

= 3 %`TDPolarizationWprime`

0 | 0 | 1 %

You should try to convince yourself that the three axes are indeed equivalent and linearly independent.

Finally, let us look at a general planar molecule (in the *xy* plane). In principle we need only two calculations (reduced to one if more symmetries are present, as for benzene). In this case we chose one of the polarization axes on the plane, and the other two rotated 45 degrees out of plane:

%`TDPolarizationDirection`

1/sqrt(2) | 0 | 1/sqrt(2) 1/sqrt(2) | 0 |-1/sqrt(2) 0 | 1 | 0 %`TDPolarizationEquivAxes`

= 2

In this case, we need two runs, one for `TDPolarizationDirection`

equal to 1, and another for it equal to 3. Note that if there are fewer than 3 equivalent axes, `TDPolarizationWprime`

is irrelevant.