Debian Codegraph @

doc/tutorialsexercises/opticalresponse/tddft/lcaotddft_Na8/td_pulse.py

raw
1 import numpy as np
2 from ase.units import Hartree, Bohr
3 from gpaw.external import ConstantElectricField
4 from gpaw.lcaotddft import LCAOTDDFT
5 from gpaw.lcaotddft.laser import GaussianPulse
6 from gpaw.lcaotddft.dipolemomentwriter import DipoleMomentWriter
7
8 # Temporal shape of the time-dependent potential
9 pulse = GaussianPulse(1e-5, 10e3, 1.12, 0.3, 'sin')
10 # Spatial shape of the time-dependent potential
11 ext = ConstantElectricField(Hartree / Bohr, [1., 0., 0.])
12 # Full time-dependent potential
13 td_potential = {'ext': ext, 'laser': pulse}
14
15 # Write the temporal shape to a file
16 pulse.write('pulse.dat', np.arange(0, 30e3, 10.0))
17
18 # Set up the time-propagation calculation
19 td_calc = LCAOTDDFT('gs.gpw', td_potential=td_potential,
20 txt='tdpulse.out')
21
22 # Attach the data recording and analysis tools
23 DipoleMomentWriter(td_calc, 'dmpulse.dat')
24
25 # Propagate
26 td_calc.propagate(20, 1500)
27
28 # Save the state for restarting later
29 td_calc.write('tdpulse.gpw', mode='all')