# Difference between revisions of "Tutorial:Time-dependent propagation"

(→Input) |
(→Input) |
||

Line 47: | Line 47: | ||

********************************************************************** | ********************************************************************** | ||

− | 1 0.002000 -218. | + | 1 0.002000 -218.785409 1 0.064 |

− | 2 0.004000 -218. | + | 2 0.004000 -218.785409 1 0.060 |

− | 3 0.006000 -218. | + | 3 0.006000 -218.785409 1 0.067 |

</pre> | </pre> | ||

... | ... | ||

<pre> | <pre> | ||

− | 49 0.098000 -218. | + | 49 0.098000 -218.785409 1 0.062 |

− | 50 0.100000 -218. | + | 50 0.100000 -218.785409 1 0.072 |

</pre> | </pre> | ||

## Revision as of 15:27, 12 September 2016

OK, it is about time to do TDDFT. Let us perform a calculation of the time evolution of the density of the methane molecule. The reason to do ground-state DFT is that usually for a real-time calculation you will need first to do a ground-state calculation to set the initial conditions.

## Input

Run the input file below to obtain a proper ground-state (stored in the `restart` directory) as from a previous tutorial. (Now we are using a more accurate bond length than before.)

`CalculationMode`

= gs`Units`

= eV_Angstrom`Radius`

= 3.5`Spacing`

= 0.175 CH = 1.094 %`Coordinates`

"C" | 0 | 0 | 0 "H" | CH/sqrt(3) | CH/sqrt(3) | CH/sqrt(3) "H" | -CH/sqrt(3) |-CH/sqrt(3) | CH/sqrt(3) "H" | CH/sqrt(3) |-CH/sqrt(3) | -CH/sqrt(3) "H" | -CH/sqrt(3) | CH/sqrt(3) | -CH/sqrt(3) % T = 0.1 dt = 0.002`TDPropagator`

= aetrs`TDMaxSteps`

= T/dt`TDTimeStep`

= dt

Then switch on a new run mode, `CalculationMode = td` instead of `gs`, to do a time-dependent run. Octopus will run for a few seconds, depending on the speed of your machine. The most relevant chunks of the standard output are

Input: [IonsConstantVelocity = no] Input: [Thermostat = none] Input: [MoveIons = no] Input: [TDIonicTimeScale = 1.000] Input: [TDTimeStep = 0.2000E-02 hbar/eV] Input: [TDPropagationTime = 0.1000 hbar/eV] Input: [TDMaxSteps = 50] Input: [TDDynamics = ehrenfest] Input: [TDPropagator = aetrs] Input: [TDExponentialMethod = taylor]

...

********************* Time-Dependent Simulation ********************** Iter Time Energy SC Steps Elapsed Time ********************************************************************** 1 0.002000 -218.785409 1 0.064 2 0.004000 -218.785409 1 0.060 3 0.006000 -218.785409 1 0.067

...

49 0.098000 -218.785409 1 0.062 50 0.100000 -218.785409 1 0.072

It is worthwhile to comment on a few things:

- We have just performed the time-evolution of the system, departing from the ground-state, under the influence of no external perturbation. As a consequence, the electronic system does not evolve. The total energy does not change (this you may already see in the output file, the third column of numbers), nor should any other observable change. However, this kind of run is useful to check that the parameters that define the time evolution are correct.
- As the evolution is performed, the code probes some observables and prints them out. These are placed in some files under the directory
, which should show up in the working directory. In this case, only two files show up, the`td.general`, and the`td.general/energy`files. The`td.general/multipoles`file contains a large number of columns of data. Each line corresponds to one of the time steps of the evolution (except for the first three lines, that start with a`td.general/multipoles``#`symbol, which give the meaning of the numbers contained in each column, and their units). A brief overview of the information contained in this file follows:- The first column is just the iteration number.
- The second column is the time.
- The third column is the dipole moment of the electronic system, along the -direction: . Next are the - and -components of the dipole moment.
- The file
contains the different components of the total energy.`td.general/energy`

- The meaning of the three new variables that we have introduced in the input file is rather obvious:
`TDPropagator`

establishes which algorithm will be used to approximate the evolution operator;`TDMaxSteps`

tells the code how may time steps to perform; and`TDTimeStep`

fixes the length of each time step. And note that, for convenience, we have previously defined a couple of variables,`T`and`dt`. We have made use of one of the possible propagators,`aetrs`. The manual explains about the possible options; in practice this choice is usually good except for very long propagation where the`etrs`propagator can be more stable.

- It is possible to restart a time-dependent run. Try that now. Just increase the value of
`TDMaxSteps`

and rerun Octopus. If, however, you want to start the evolution from scratch, you should set the variable`FromScratch`

to`yes`.

## The time step

A key parameter is, of course, the time step, `TDTimeStep`

. Before making long calculations, it is worthwhile spending some time choosing the largest time-step possible, to reduce the number of steps needed. This time-step depends crucially on the system under consideration, the spacing, on the applied perturbation, and on the algorithm chosen to approximate the evolution operator.

In this example, try to change the time-step and to rerun the time-evolution. Make sure you are using `TDMaxSteps`

of at least 100, as with shorter runs an instability might not appear yet. You will see that `0.0023` is basically the largest time-step that you can use -- otherwise, the propagation gets unstable and the total energy of the system is no longer conserved. Very often it diverges rapidly or even becomes NaN.

Also, there is another input variable that we did not set explicitly, relying on its default value, `TDExponentialMethod`

. Since most propagators rely on algorithms to calculate the action of the exponential of the Hamiltonian, one can specify which algorithm can be used for this purpose.

You may want to learn about the possible options that may be taken by `TDExponentialMethod`

, and `TDPropagator`

-- take a look at the manual. You can now try some exercises:

- Fixing the propagator algorithm (for example, to the default value), investigate how the several exponentiation methods work (Taylor, Chebyshev, and Lanczos). This means finding out what maximum time-step one can use without compromising the proper evolution.

- And fixing now the
`TDExponentialMethod`

, one can now play around with the various propagators.

## Laser fields

Now we will add a time-dependent external perturbation (a laser field) to the molecular Hamiltonian. The relevant part of the input file (adding some variables) is:

`FromScratch`

= yes T = 1 dt = 0.002`TDPropagator`

= aetrs`TDMaxSteps`

= T/dt`TDTimeStep`

= dt amplitude = 1 omega = 18.0 tau0 = 0.5 t0 = tau0 %`TDExternalFields`

electric_field | 1 | 0 | 0 | omega | "envelope_cos" % %`TDFunctions`

"envelope_cos" | tdf_cosinoidal | amplitude | tau0 | t0 %`TDOutput`

= laser + multipoles

The most important variable here is the `TDExternalFields`

block. You should carefully read the manual page dedicated to this variable: the particular laser pulse that we have employed is the one whose envelope function is a cosine.

Now you are ready to set up a run with a laser field. Be careful to set a total time of propagation able to accommodate the laser shot, or even more if you want to see what happens afterwards. You may also want to consult the meaning of the variable `TDOutput`

.

A couple of important comments:

- You may supply several laser pulses: simply add more lines to the
`TDExternalFields`

block. - The laser field is printed in the file
. This is done immediately at the beginning of the run, so you can check that the laser is correct without waiting.`td.general/laser` - You can have an idea of the response to the field by looking at the dipole moment in the
. What physical observable can be calculated from the response?`td.general/multipoles` - When an external field is present, one may expect that unbound states may be excited, leading to ionization. In the calculations, this is reflected by density reaching the borders of the box. In these cases, the proper way to proceed is to setup absorbing boundaries (variables
`AbsorbingBoundaries`

,`ABWidth`

and`ABHeight`

).