-
Notifications
You must be signed in to change notification settings - Fork 4
/
Omega_eldest.py
executable file
·562 lines (465 loc) · 23.8 KB
/
Omega_eldest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
#!/usr/bin/python
##########################################################################
# ELDEST #
# Investigating Electronic Decay Processes with Streaking #
##########################################################################
# Purpose: #
# - A program to simulate the streaking process of electronic #
# decay processes. #
# #
##########################################################################
# written by: Elke Fasshauer May 2018 #
##########################################################################
import scipy
import scipy.integrate as integrate
from scipy.signal import argrelextrema
from scipy.special import erf
import numpy as np
import sciconv
import complex_integration as ci
import res_anal_integ as aires
import dir_anal_integ as aidir
import in_out
import sys
import warnings
# don't print warnings unless python -W ... is used
if not sys.warnoptions:
warnings.simplefilter("ignore")
infile = sys.argv[1]
print infile
#-------------------------------------------------------------------------
# open outputfile
outfile = open("eldest.out", mode='w')
pure_out = open('full.dat', mode='w')
outfile.write("The results were obtained with Omega_eldest.py \n")
#-------------------------------------------------------------------------
# read inputfile
(rdg_au, cdg_au,
Er_eV, E_fin_eV, tau_s,
Omega_eV, n_X, I_X, X_sinsq, X_gauss, Xshape,
omega_eV, n_L, I_L, Lshape, delta_t_s, shift_step_s, phi, q,
tmax_s, timestep_s, E_step_eV,
E_min_eV, E_max_eV,
integ, integ_outer
) = in_out.read_input(infile, outfile)
#-------------------------------------------------------------------------
# Convert input parameters to atomic units
#-------------------------------------------------------------------------
Er_au = sciconv.ev_to_hartree(Er_eV)
E_fin_au = sciconv.ev_to_hartree(E_fin_eV)
tau_au = sciconv.second_to_atu(tau_s)
Gamma_au = 1. / tau_au
# laser parameters
Omega_au = sciconv.ev_to_hartree(Omega_eV)
if (X_sinsq):
TX_au = n_X * 2 * np.pi / Omega_au
elif(X_gauss):
sigma = np.pi * n_X / (Omega_au * np.sqrt(np.log(2)))
FWHM = 2 * np.sqrt( 2 * np.log(2)) * sigma
TX_au = 5 * sigma
print 'sigma = ', sciconv.atu_to_second(sigma)
print 'FWHM = ', sciconv.atu_to_second(FWHM)
outfile.write('sigma = ' + str(sciconv.atu_to_second(sigma)) + '\n')
outfile.write('FWHM = ' + str(sciconv.atu_to_second(FWHM)) + '\n')
print 'end of the first pulse = ', sciconv.atu_to_second(TX_au/2)
outfile.write('end of the first pulse = ' + str(sciconv.atu_to_second(TX_au)) + '\n')
I_X_au = sciconv.Wcm2_to_aiu(I_X)
#print 'I_X_au = ', I_X_au
outfile.write('I_X = ' + str(I_X) + '\n')
outfile.write('I_X_au = ' + str(I_X_au) + '\n')
E0X = np.sqrt(I_X_au)
A0X = E0X / Omega_au
omega_au = sciconv.ev_to_hartree(omega_eV)
if (Lshape == "sinsq"):
TL_au = n_L * 2 * np.pi / omega_au
elif(Lshape == "gauss"):
sigma_L = np.pi * n_L / (omega_au * np.sqrt(np.log(2)))
FWHM_L = 2 * np.sqrt( 2 * np.log(2)) * sigma_L
TL_au = 5 * sigma_L
print 'sigma_L = ', sciconv.atu_to_second(sigma_L)
print 'FWHM_L = ', sciconv.atu_to_second(FWHM_L)
outfile.write('sigma_L = ' + str(sciconv.atu_to_second(sigma_L)) + '\n')
outfile.write('FWHM_L = ' + str(sciconv.atu_to_second(FWHM_L)) + '\n')
print 'TL_s = ', sciconv.atu_to_second(TL_au)
print 'start of IR pulse = ', delta_t_s - sciconv.atu_to_second(TL_au/2)
print 'end of IR pulse = ', delta_t_s + sciconv.atu_to_second(TL_au/2)
outfile.write('start of IR pulse = ' + str( delta_t_s - sciconv.atu_to_second(TL_au/2))
+ '\n')
outfile.write('end of IR pulse = ' + str(delta_t_s + sciconv.atu_to_second(TL_au/2))
+ '\n')
I_L_au = sciconv.Wcm2_to_aiu(I_L)
outfile.write('I_L = ' + str(I_L) + '\n')
outfile.write('I_L_au = ' + str(I_L_au) + '\n')
E0L = np.sqrt(I_L_au)
#print 'E0L', E0L
A0L = E0L / omega_au
#print 'A0L = ', A0L
delta_t_au = sciconv.second_to_atu(delta_t_s)
# parameters of the simulation
tmax_au = sciconv.second_to_atu(tmax_s)
timestep_au = sciconv.second_to_atu(timestep_s)
E_step_au = sciconv.ev_to_hartree(E_step_eV)
E_min_au = sciconv.ev_to_hartree(E_min_eV)
E_max_au = sciconv.ev_to_hartree(E_max_eV)
VEr_au = np.sqrt(Gamma_au/ (2*np.pi))
cdg_au = rdg_au / ( q * np.pi * VEr_au)
#cdg_au = 0
#-------------------------------------------------------------------------
in_out.check_input(Er_au, E_fin_au, Gamma_au,
Omega_au, TX_au, n_X, A0X,
omega_au, TL_au, A0L, delta_t_au,
tmax_au, timestep_au, E_step_au)
#-------------------------------------------------------------------------
# physical defintions of functions
# XUV pulse
if (X_sinsq):
print 'use sinsq function'
f_t1 = lambda t1: 1./4 * ( np.exp(2j * np.pi * (t1 + TX_au/2) / TX_au)
+ 2
+ np.exp(-2j * np.pi * (t1 + TX_au/2) /TX_au) )
fp_t1 = lambda t1: np.pi/(2j*TX_au) * ( - np.exp(2j*np.pi* (t1 + TX_au/2) / TX_au)
+ np.exp(-2j*np.pi* (t1 + TX_au/2) / TX_au) )
elif (X_gauss):
print 'use gauss function'
f_t1 = lambda t1: ( 1./ np.sqrt(2*np.pi * sigma**2)
* np.exp(-t1**2 / (2*sigma**2)))
fp_t1 = lambda t1: ( -t1 / np.sqrt(2*np.pi) / sigma**3
* np.exp(-t1**2 / (2*sigma**2)))
else:
print 'no pulse shape selected'
FX_t1 = lambda t1: (- A0X * np.cos(Omega_au * t1) * fp_t1(t1)
+ A0X * Omega_au * np.sin(Omega_au * (t1)) * f_t1(t1)
)
# IR pulse
A_IR = lambda t3: A0L * np.sin(np.pi * (t3 - delta_t_au + TL_au/2) / TL_au)**2 \
* np.cos(omega_au * t3 + phi)
#integ_IR = lambda t3: (p_au + A_IR(t3))**2
if (Lshape == "sinsq"):
IR_during = lambda t1: np.exp(-1j * p_au**2/2 * (t_au - t1)) \
* np.exp(-1j * p_au * A0L / 4
* (np.sin(2*np.pi/TL_au * (t_au - delta_t_au)
- omega_au * (t_au - delta_t_au) - phi)
/ (2*np.pi/TL_au - omega_au)
- np.sin(2*np.pi/TL_au * (t1 - delta_t_au)
- omega_au * (t1 - delta_t_au) - phi)
/ (2*np.pi/TL_au - omega_au)
+ np.sin(2*np.pi/TL_au * (t_au - delta_t_au)
+ omega_au * (t_au - delta_t_au) + phi)
/ (2*np.pi/TL_au + omega_au)
- np.sin(2*np.pi/TL_au * (t1 - delta_t_au)
+ omega_au * (t1 - delta_t_au) + phi)
/ (2*np.pi/TL_au + omega_au)
+ 2./omega_au * np.sin(omega_au * (t_au - delta_t_au) + phi)
- 2./omega_au * np.sin(omega_au * (t1 - delta_t_au) + phi)
)
)
IR_after = lambda t1: np.exp(-1j * p_au**2/2 * (t_au - t1)) \
* np.exp(-1j * p_au * A0L / 4
* (np.sin(np.pi - omega_au * TL_au/2 - phi)
/ (2*np.pi/TL_au - omega_au)
- np.sin(2*np.pi/TL_au * (t1 - delta_t_au)
- omega_au * (t1 - delta_t_au) - phi)
/ (2*np.pi/TL_au - omega_au)
+ np.sin(np.pi + omega_au * TL_au/2 + phi)
/ (2*np.pi/TL_au + omega_au)
- np.sin(2*np.pi/TL_au * (t1 - delta_t_au)
+ omega_au * (t1 - delta_t_au) + phi)
/ (2*np.pi/TL_au + omega_au)
+ 2./omega_au * np.sin(omega_au * TL_au/2 + phi)
- 2./omega_au * np.sin(omega_au * (t1 - delta_t_au) + phi)
)
)
elif (Lshape == "gauss"):
IR_during = lambda t1: np.exp(-1j * p_au**2/2 * (t_au - t1)) \
* np.exp(-A0L * p_au / 4 * np.exp(1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* (erf((t_au - delta_t_au - 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
-erf((t1 - delta_t_au - 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
)
) \
* np.exp(-A0L * p_au / 4 * np.exp(-1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* (erf((t_au - delta_t_au + 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
-erf((t1 - delta_t_au + 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
)
)
IR_after = lambda t1: np.exp(-1j * p_au**2/2 * (t_au - t1)) \
* np.exp(-A0L * p_au / 4 * np.exp(1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* (erf((TL_au/2 - 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
-erf((t1 - delta_t_au - 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
)
) \
* np.exp(-A0L * p_au / 4 * np.exp(-1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* (erf((TL_au/2 + 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
-erf((t1 - delta_t_au + 1j*sigma_L**2 * omega_au)
/ np.sqrt(2) / sigma_L)
)
)
#-------------------------------------------------------------------------
# technical defintions of functions
#direct ionization
fun_t_dir_1 = lambda t1: FX_t1(t1) * np.exp(1j * E_fin_au * t1) \
* np.exp(1j * p_au**2/2 * (t1-t_au))
fun_TX2_dir_1 = lambda t1: FX_t1(t1) * np.exp(1j * E_fin_au * (t1-t_au)) \
* np.exp(1j * p_au**2/2 * (t1-TX_au/2))
dress_I = lambda t1: integrate.quad(integ_IR,t1,t_au)[0]
dress = lambda t1: np.exp(-1j/2 * dress_I(t1))
dress_I_after = lambda t1: integrate.quad(integ_IR,t1,(delta_t_au + TL_au/2))[0]
dress_after = lambda t1: np.exp(-1j/2 * dress_I_after(t1))
#fun_dress_after = lambda t1: (FX_t1(t1)
# * np.exp(1j * E_fin_au * t1) \
# * np.exp(1j * E_kin_au * ((delta_t_au + TL_au/2)-t_au)) \
# * dress_after(t1)
# )
fun_dress_after = lambda t1: (FX_t1(t1)
* np.exp(1j * E_fin_au * (t1-t_au)) \
* IR_after(t1)
)
#fun_IR_dir = lambda t1: FX_t1(t1) * np.exp(1j * E_fin_au * t1) \
# * dress(t1)
fun_IR_dir = lambda t1: FX_t1(t1) * np.exp(1j * E_fin_au * (t1-t_au)) \
* IR_during(t1)
#-------------------------------------------------------------------------
# resonant state functions
if (Lshape == "sinsq"):
inner_prefac = lambda x,y: np.exp(-1j * y * (p_au**2/2 + E_fin_au)) \
* np.exp(-1j * p_au * A0L / (4*(2*np.pi/TL_au - omega_au))
*np.sin(2*np.pi/TL_au * (x - delta_t_au)
- omega_au * (x - delta_t_au) - phi) ) \
* np.exp(-1j * p_au * A0L / (4*(2*np.pi/TL_au + omega_au))
*np.sin(2*np.pi/TL_au * (x - delta_t_au)
+ omega_au * (x + delta_t_au) + phi) ) \
* np.exp(-1j * p_au * A0L / (2*omega_au)
*np.sin(omega_au * (x - delta_t_au) + phi) )
inner_int_part = lambda x,y: 1./(complex(-np.pi * VEr_au**2, p_au**2/2 + E_fin_au - Er_au)
+1j*p_au*A0L/4
* np.cos(2*np.pi/TL_au * (x-delta_t_au)
+ omega_au * (x-delta_t_au) + phi)
+1j*p_au*A0L/4
* np.cos(2*np.pi/TL_au * (x-delta_t_au)
- omega_au * (x-delta_t_au) - phi)
+1j*A0L*p_au / 2
* np.cos(omega_au * (x-delta_t_au) + phi)
) \
*(np.exp(y*(complex(-np.pi * VEr_au**2, p_au**2/2 + E_fin_au - Er_au)))
*np.exp(1j*A0L*p_au /(4*(2*np.pi/TL_au - omega_au))
* np.sin(2*np.pi/TL_au * (x - delta_t_au)
- omega_au * (x-delta_t_au) - phi) )
*np.exp(1j*A0L*p_au /(4*(2*np.pi/TL_au + omega_au))
* np.sin(2*np.pi/TL_au * (x - delta_t_au)
+ omega_au * (x-delta_t_au) + phi) )
*np.exp(1j*A0L*p_au / (2 * omega_au)
* np.sin(omega_au * (x-delta_t_au) + phi) )
)
elif (Lshape == "gauss"):
inner_prefac = lambda x,y: np.exp(-1j * y * (p_au**2/2 + E_fin_au)) \
* np.exp(-1j*A0L*p_au/4 * np.exp(1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* erf((x - delta_t_au - 1j*sigma_L**2 * omega_au)
/ (np.sqrt(2) * sigma_L)
)
) \
* np.exp(-1j*A0L*p_au/4 * np.exp(-1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* erf((x - delta_t_au + 1j*sigma_L**2 * omega_au)
/ (np.sqrt(2) * sigma_L)
)
)
inner_int_part = lambda x,y: 1./(complex(-np.pi * VEr_au**2, p_au**2/2 + E_fin_au - Er_au)
+1j*p_au*A0L/2 / np.sqrt(np.pi) * np.exp(1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* np.exp(-(x - delta_t_au - 1j*sigma_L**2 * omega_au)**2
/ (2*sigma_L**2)
)
+1j*p_au*A0L/2 / np.sqrt(np.pi) * np.exp(-1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* np.exp(-(x - delta_t_au + 1j*sigma_L**2 * omega_au)**2
/ (2*sigma_L**2)
)
) \
*(np.exp(y*(complex(-np.pi * VEr_au**2, p_au**2/2 + E_fin_au - Er_au)))
*np.exp(1j*A0L*p_au /4 * np.exp(1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* erf((x-delta_t_au-1j*sigma_L**2*omega_au)
/ (np.sqrt(2) * sigma_L))
)
*np.exp(1j*A0L*p_au /4 * np.exp(-1j*phi)
* np.exp(-sigma_L**2 * omega_au**2 / 2)
* erf((x-delta_t_au+1j*sigma_L**2*omega_au)
/ (np.sqrt(2) * sigma_L))
)
)
res_inner_fun = lambda t2: np.exp(-t2 * (np.pi * VEr_au**2 + 1j*(Er_au))) \
* IR_during(t2)
if (integ == 'romberg'):
res_inner = lambda t1: ci.complex_romberg(res_inner_fun, t1, t_au)
elif (integ == 'quadrature'):
res_inner = lambda t1: ci.complex.quadrature(res_inner_fun, t1, t_au)[0]
elif (integ == 'analytic'):
res_inner = lambda t1: inner_prefac(t_au,t_au) * \
(inner_int_part(t_au,t_au) - inner_int_part(t1,t1))
res_outer_fun = lambda t1: FX_t1(t1) * np.exp(t1 * (np.pi* VEr_au**2 + 1j*Er_au)) \
* res_inner(t1)
# after the pulse
res_inner_after = lambda t2: np.exp(-t2 * (np.pi * VEr_au**2 + 1j*(Er_au))) \
* IR_after(t2)
if (integ == 'romberg'):
res_inner_a = lambda t1: ci.complex_romberg(res_inner_after, t1, t_au)
elif (integ == 'quadrature'):
res_inner_a = lambda t1: ci.complex_quadrature(res_inner_after, t1, t_au)[0]
elif (integ == 'analytic'):
res_inner_a = lambda t1: inner_prefac(delta_t_au + TL_au/2,t_au) * \
(inner_int_part(delta_t_au + TL_au/2,t_au) - inner_int_part(t1,t1))
res_outer_after = lambda t1: FX_t1(t1) * np.exp(t1 * (np.pi* VEr_au**2 + 1j*Er_au)) \
* res_inner_a(t1)
#-------------------------------------------------------------------------
# initialization
t_au = -TX_au/2
# construct list of energy points
Ekins = []
E_kin_au = E_min_au
while (E_kin_au <= E_max_au):
Ekins.append(sciconv.hartree_to_ev(E_kin_au))
E_kin_au = E_kin_au + E_step_au
#-------------------------------------------------------------------------
# constants / prefactors
prefac_res = VEr_au * rdg_au
prefac_indir = -1j * np.pi * VEr_au**2 * cdg_au
#prefac_indir = 0
prefac_dir = 1j * cdg_au
#-------------------------------------------------------------------------
while ((t_au <= TX_au/2) and (t_au <= tmax_au)):
#-------------------------------------------------------------------------
outfile.write('during the XUV pulse \n')
print 'during the XUV pulse'
outlines = []
squares = np.array([])
E_kin_au = E_min_au
print 't_s = ', sciconv.atu_to_second(t_au)
outfile.write('t_s = ' + str(sciconv.atu_to_second(t_au)) + '\n')
while (E_kin_au <= E_max_au):
p_au = -A_IR(t_au) + np.sqrt(A_IR(t_au)**2 + 2 * E_kin_au)
# integral 1
#I = ci.complex_quadrature(fun_IR_dir, (-TX_au/2), t_au)
#res_I = ci.complex_quadrature(res_outer_fun, (-TX_au/2), t_au)
I = ci.complex_romberg(fun_IR_dir, (-TX_au/2), t_au)
res_I = ci.complex_romberg(res_outer_fun, (-TX_au/2), t_au)
#dir_J = prefac_dir * I[0]
#res_J = prefac_res * res_I[0]
#indir_J = prefac_indir * res_I[0]
dir_J = prefac_dir * I
res_J = prefac_res * res_I
indir_J = prefac_indir * res_I
J = (0
+ dir_J
+ res_J
+ indir_J
)
square = np.absolute(J)**2
squares = np.append(squares, square)
string = in_out.prep_output(square, E_kin_au, t_au)
outlines.append(string)
E_kin_au = E_kin_au + E_step_au
in_out.doout_1f(pure_out, outlines)
max_pos = argrelextrema(squares, np.greater)[0]
if (len(max_pos > 0)):
for i in range (0, len(max_pos)):
print Ekins[max_pos[i]], squares[max_pos[i]]
outfile.write(str(Ekins[max_pos[i]]) + ' ' + str(squares[max_pos[i]]) + '\n')
t_au = t_au + timestep_au
outfile.write('\n')
#-------------------------------------------------------------------------
while (t_au >= TX_au/2 and t_au <= (delta_t_au + TL_au/2) and (t_au <= tmax_au)):
#-------------------------------------------------------------------------
outfile.write('only IR pulse \n')
print 'only IR pulse'
outlines = []
squares = np.array([])
E_kin_au = E_min_au
print 't_s = ', sciconv.atu_to_second(t_au)
outfile.write('t_s = ' + str(sciconv.atu_to_second(t_au)) + '\n')
while (E_kin_au <= E_max_au):
p_au = -A_IR(t_au) + np.sqrt(A_IR(t_au)**2 + 2 * E_kin_au)
# integral 1
#I1 = ci.complex_quadrature(fun_IR_dir, (-TX_au/2), TX_au/2)
#res_I = ci.complex_quadrature(res_outer_fun, (-TX_au/2), TX_au/2)
I1 = ci.complex_romberg(fun_IR_dir, (-TX_au/2), TX_au/2)
res_I = ci.complex_romberg(res_outer_fun, (-TX_au/2), TX_au/2)
#dir_J = prefac_dir * I1[0]
#res_J = prefac_res * res_I[0]
#indir_J = prefac_indir * res_I[0]
dir_J = prefac_dir * I1
res_J = prefac_res * res_I
indir_J = prefac_indir * res_I
J = (0
+ dir_J
+ res_J
+ indir_J
)
square = np.absolute(J)**2
squares = np.append(squares, square)
string = in_out.prep_output(square, E_kin_au, t_au)
outlines.append(string)
E_kin_au = E_kin_au + E_step_au
in_out.doout_1f(pure_out,outlines)
max_pos = argrelextrema(squares, np.greater)[0]
if (len(max_pos > 0)):
for i in range (0, len(max_pos)):
print Ekins[max_pos[i]], squares[max_pos[i]]
outfile.write(str(Ekins[max_pos[i]]) + ' ' + str(squares[max_pos[i]]) + '\n')
t_au = t_au + timestep_au
outfile.write('\n')
#-------------------------------------------------------------------------
# after the second pulse
while (t_au >= (delta_t_au + TL_au/2)
and (t_au <= tmax_au)):
#-------------------------------------------------------------------------
outfile.write('after both pulses \n')
print 'after both pulses'
outlines = []
squares = np.array([])
E_kin_au = E_min_au
print 't_s = ', sciconv.atu_to_second(t_au)
outfile.write('t_s = ' + str(sciconv.atu_to_second(t_au)) + '\n')
while (E_kin_au <= E_max_au):
p_au = np.sqrt(2 * E_kin_au)
# integral 1
#I1 = ci.complex_quadrature(fun_dress_after, (-TX_au/2), TX_au/2)
#res_I = ci.complex_quadrature(res_outer_after, (-TX_au/2), TX_au/2)
I1 = ci.complex_romberg(fun_dress_after, (-TX_au/2), TX_au/2)
res_I = ci.complex_romberg(res_outer_after, (-TX_au/2), TX_au/2)
#dir_J = prefac_dir * I1[0]
#res_J = prefac_res * res_I[0]
#indir_J = prefac_indir * res_I[0]
dir_J = prefac_dir * I1
res_J = prefac_res * res_I
indir_J = prefac_indir * res_I
J = (0
+ dir_J
+ res_J
+ indir_J
)
square = np.absolute(J)**2
squares = np.append(squares, square)
string = in_out.prep_output(square, E_kin_au, t_au)
outlines.append(string)
E_kin_au = E_kin_au + E_step_au
in_out.doout_1f(pure_out,outlines)
max_pos = argrelextrema(squares, np.greater)[0]
if (len(max_pos > 0)):
for i in range (0, len(max_pos)):
print Ekins[max_pos[i]], squares[max_pos[i]]
outfile.write(str(Ekins[max_pos[i]]) + ' ' + str(squares[max_pos[i]]) + '\n')
t_au = t_au + timestep_au
outfile.write('\n')
outfile.close
pure_out.close