Real-time dynamics with external field read from file

From Lumen wiki
Revision as of 15:46, 27 October 2025 by Wikiadmin (talk | contribs)
Jump to navigationJump to search
external field from file
external field from file

In this tutorial we will see how to generate an external field in a format compatible with Lumen and then use it to run real-time simulation (see for instance Ref. [1].

We will also prove a simple python script to do it, that you can easily modify to create your own external field.

The tutorial is divided in three sections: 1) generate external field with YamboPy; 2) generate external field with ypp_rt; 3) use the external field in the real-time calculations.

Generate external field with YamboPy

Nota bene: only linear polarized external field can generated with YamboPY (to be generlized)

Generate external field with ypp_rt

With ypp_rt one can generate all external fields that implemented in the Yambo code in the file src/modules/mod_fields.F. This can be usefull to visualize external fields used in Yambo without the need of running a real simulation. However if you want to add a new external field you have to code it in the file src/modules/mod_fields.F. The command to generate external field on file is: ypp_rt -rtplot f. This will generate the following input file:

TDplots                          # [R] TD observables plot
RTtime                           # [R] Post-Processing kind: function of time
RTfields                         # [R] Analize time-dependent fields
TimeStep= 0.010000         fs    # Time step
% TimeRange
0.000000 |100.000000 |         fs    # Time-window where processing is done
%
% EnRngeRt
  0.00000 | 20.00000 |         eV    # Energy range
%
ETStpsRt= 200                    # Total Energy steps
ChirpFac= 0.000000         fs    # Prefactor for linear chirping in frequency space
Field1_Freq= 2.000000      eV    # [RT Field1] Frequency
Field1_Int= 1000.000000       kWLm2 # [RT Field1] Intensity
Field1_Width= 0.000000     fs    # [RT Field1] Width
Field1_kind= "SIN"              # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)
Field1_pol= "linear"               # [RT Field1] Pol(linear|circular)
% Field1_Dir
  1.000000 | 0.000000 | 0.000000 |        # [RT Field1] Versor
%
Field1_Tstart= 0.010000   fs    # [RT Field1] Initial Time

In the input file you have to specify a series of parameters, in red: the time step (TimeSpep), the time range (TimeRange), the field intensity (Field1_Int), the field kind (Field1_kind), its polarization, the field direction (Field1_Dir) and its starting time (Field1_Tstart), usually the first step of the dynamics. Then you run ypp_rt with this input and it will produce a series of files: YPP_EXTFIELD1_P1.time, YPP_EXTFIELD1_P2.time, YPP_EXTFIELD1_P1.freq, YPP_EXTFIELD1_P2.freq.

These files contain the external field and its Fourier transform. In the next section we will see how to use them in real-time dynamics.

Use generated external field with yambo_rt/yambo_nl

In yambo_rt/yambo_nl you can tell to the code to read an external field from file. For example in yambo_nl you generate your input wil the command yambo_nl -u p

nloptics                         # [R] Non-linear spectroscopy
% NLBands
 7 |  10 |                           # [NL] Bands range
%
NLverbosity= "high"              # [NL] Verbosity level (low | high)
NLtime=100.000000           fs    # [NL] Simulation Time
NLintegrator= "INVINT"           # [NL] Integrator ("EULEREXP/RK2/RK4/RK2EXP/HEUN/INVINT/CRANKNIC")
NLCorrelation= "IPA"             # [NL] Correlation ("IPA/HARTREE/TDDFT/LRC/LRW/JGM/SEX/LSEX/LHF")
NLLrcAlpha= 0.000000             # [NL] Long Range Correction
NLDamping= 0.200000        eV    # [NL] Damping (or dephasing)
RADLifeTime=-1.000000      fs    # [RT] Radiative life-time (if negative RADLifeTime=Phase_LifeTime)
#EvalCurrent                   # [NL] Evaluate the current
HARRLvcs= 11529            RL    # [HA] Hartree     RL components
EXXRLvcs= 11529            RL    # [XX] Exchange    RL components
CORRLvcs= 11529            RL    # [GW] Correlation RL components
Field1_Freq= 0.100000      eV    # [RT Field1] Frequency
Field1_Int=  1000.00       kWLm2 # [RT Field1] Intensity
Field1_Width= 0.000000     fs    # [RT Field1] Width
Field1_kind= "FROM_FILE ./YPP_EXTFIELD1_P1.time" # [RT Field1] Kind(SIN|COS|RES|ANTIRES|GAUSS|DELTA|QSSIN)
Field1_pol= "linear"             # [RT Field1] Pol(linear|circular)
% Field1_Dir
   1.000000 | 0.000000 | 0.000000 |        # [RT Field1] Versor
%

You have to specify the file kind FROM_FILE and give the path of the file containing the external field. Do not forget also to specify the NLtime and the Field1_Dir versor.

Nota bene: that external field from file in yambo_nl is compatible only with the INVINT integrator. (It will be generalized to other integrators soon)

References

  1. D. Sangalli, Excitons and carriers in transient absorption and time-resolved ARPES spectroscopy: An ab initio approach, Phys. Rev. Materials 5, 083803, (2021).