1
1
!
2
2
! SCID-TDSE: Simple 1-electron atomic TDSE solver
3
- ! Copyright (C) 2015-2021 Serguei Patchkovskii, [email protected]
3
+ ! Copyright (C) 2015-2022 Serguei Patchkovskii, [email protected]
4
4
!
5
5
! This program is free software: you can redistribute it and/or modify
6
6
! it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ module vectorpotential_tools
59
59
public vp_apot
60
60
public rcsid_vectorpotential_tools
61
61
!
62
- character (len= clen), save :: rcsid_vectorpotential_tools = " $Id: vectorpotential_tools.f90,v 1.19 2022/07/19 10:03:20 ps Exp $"
62
+ character (len= clen), save :: rcsid_vectorpotential_tools = " $Id: vectorpotential_tools.f90,v 1.21 2022/09/26 17:19:41 ps Exp ps $"
63
63
!
64
64
! List of vector-potential names. These are used in a couple different places;
65
65
! I would prefer any typos to cause a compile-time error!
@@ -78,6 +78,7 @@ module vectorpotential_tools
78
78
character (len=* ), parameter :: vpn_xySin2 = ' xy Sin2'
79
79
character (len=* ), parameter :: vpn_zxCW = ' zx CW'
80
80
character (len=* ), parameter :: vpn_spline = ' spline'
81
+ character (len=* ), parameter :: vpn_altspline = ' alt spline'
81
82
!
82
83
real (xk), save :: vp_scale = 0.00_xk ! Overall magnitude of the vector potential
83
84
character (len= clen), save :: vp_shape = ' ' ! Shape of the vector-potential. See vp_apot()
@@ -105,6 +106,11 @@ module vectorpotential_tools
105
106
! is described in doc/INPUT.txt, under the vp_table keyword.
106
107
! vp_scale is influential in this case; don't forget to set it.
107
108
!
109
+ ! For vp_shape='alt spline', the file should contain six individual
110
+ ! splines, which are interpreted as two vector-potentials shifted
111
+ ! in time by VP_PARAM(3)/VP_PARAM_X(3), and scaled by
112
+ ! VP_SCALE/VP_SCALE_X. See doc/INPUT.txt for details
113
+ !
108
114
! In either case, the data should be supplied in Fortran
109
115
! free-form input format, with no fixed columns or formats.
110
116
!
@@ -141,12 +147,16 @@ module vectorpotential_tools
141
147
real (xk), save :: flat_raise = 0._xk ! vp_param(11) : Duration of the raising and falling edges, in
142
148
! atomic units of time
143
149
!
144
- ! Data for vp_shape='spline', loaded from the file specified by vp_table
150
+ ! Data for vp_shape='spline' or 'alt spline' , loaded from the file specified by vp_table
145
151
!
146
- type (cs_data), save :: splines(6 ) ! We define six splines in total, two for each Cartesian direction:
152
+ type (cs_data), save :: splines(6 ) ! vp_shape='spline'
153
+ ! We define six splines in total, two for each Cartesian direction:
147
154
! 1,2: Envelope and phase for A_x
148
155
! 3,4: Ditto, for A_y
149
156
! 5,6: Ditto, for A_z
157
+ ! vp_shape='alt spline'
158
+ ! 1,2,3: X/Y/Z components of the vector-potential 1
159
+ ! 4,5,6: X/Y/Z components of the vector-potential 2
150
160
!
151
161
contains
152
162
!
@@ -252,6 +262,8 @@ function vp_apot(t,theta,phi) result(apot)
252
262
ph = atan2 (ay,ax)
253
263
case (vpn_spline)
254
264
call vp_spline(t,apot,th,ph)
265
+ case (vpn_altspline)
266
+ call vp_altspline(t,apot,th,ph)
255
267
end select
256
268
if (present (theta)) theta = th
257
269
if (present (phi) ) phi = ph
@@ -301,6 +313,8 @@ subroutine initialize
301
313
omega = vp_param(1 )
302
314
case (vpn_spline)
303
315
call init_splines
316
+ case (vpn_altspline)
317
+ call init_altsplines
304
318
end select
305
319
first = .false.
306
320
! $omp flush(first)
@@ -523,9 +537,6 @@ subroutine vp_spline(t,vpot,th,ph)
523
537
end subroutine vp_spline
524
538
!
525
539
subroutine init_splines
526
- integer (ik) :: iu, ios, ispl, npts
527
- real (xk), allocatable :: xy(:,:)
528
- character (len= clen) :: msg
529
540
character (len= 10 ), parameter :: names(6 ) = (/ ' X envelope' , ' X phase ' , &
530
541
' Y envelope' , ' Y phase ' , &
531
542
' Z envelope' , ' Z phase ' / )
@@ -534,6 +545,56 @@ subroutine init_splines
534
545
write (out ," (t5,'Loading splines from ',a)" ) trim (vp_table)
535
546
write (out ," (t5,'Scaling factor = ',g0.8)" ) vp_scale
536
547
!
548
+ call init_splines_common(names)
549
+ end subroutine init_splines
550
+ !
551
+ subroutine vp_altspline (t ,vpot ,th ,ph )
552
+ real (xk), intent (in ) :: t ! Time where we need the vector-potential
553
+ real (xk), intent (out ) :: vpot, th, ph ! Vector-potential, spherical coordinates
554
+ !
555
+ real (xk) :: vp_x, vp_y, vp_z ! Cartesian components of the vector-potential
556
+ !
557
+ vp_x = vp_scale * cs_evaluate(splines(1 ),t- vp_param (3 ))
558
+ vp_y = vp_scale * cs_evaluate(splines(2 ),t- vp_param (3 ))
559
+ vp_z = vp_scale * cs_evaluate(splines(3 ),t- vp_param (3 ))
560
+ vp_x = vp_x + vp_scale_x * cs_evaluate(splines(4 ),t- vp_param_x(3 ))
561
+ vp_y = vp_y + vp_scale_x * cs_evaluate(splines(5 ),t- vp_param_x(3 ))
562
+ vp_z = vp_z + vp_scale_x * cs_evaluate(splines(6 ),t- vp_param_x(3 ))
563
+ !
564
+ ! Special case: if the X and Y fields vanish identically, force theta and phi to be zero
565
+ ! In all other cases, the unwrap routine should take of keeping the vector-potential
566
+ ! as smooth as possible.
567
+ !
568
+ if (vp_x== 0._xk .and. vp_y== 0._xk ) then
569
+ vpot = vp_z ; th = 0._xk ; ph = 0._xk
570
+ else
571
+ vpot = sqrt (vp_x** 2 + vp_y** 2 + vp_z** 2 )
572
+ th = acos (vp_z/ vpot)
573
+ ph = atan2 (vp_y,vp_x)
574
+ end if
575
+ end subroutine vp_altspline
576
+ !
577
+ subroutine init_altsplines
578
+ character (len= 2 ), parameter :: xyz(6 ) = (/ ' X1' , ' Y1' , ' Z1' , ' X2' , ' Y2' , ' Z2' / )
579
+ !
580
+ write (out ," (/'Using cubic-spline interpolation to define the vector-potential')" )
581
+ write (out ," (t5,'Loading splines from ',a)" ) trim (vp_table)
582
+ write (out ," (t5,'Scaling factor [Field 1] = ',g24.12)" ) vp_scale
583
+ write (out ," (t5,' Time delay [Field 1] = ',g24.12)" ) vp_param(3 )
584
+ write (out ," (t5,'Scaling factor [Field 2] = ',g24.12)" ) vp_scale_x
585
+ write (out ," (t5,' Time delay [Field 2] = ',g24.12)" ) vp_param_x(3 )
586
+ write (out ," ()" )
587
+ !
588
+ call init_splines_common(xyz)
589
+ end subroutine init_altsplines
590
+
591
+ subroutine init_splines_common (codes )
592
+ character (len=* ), intent (in ) :: codes(:)
593
+ !
594
+ integer (ik) :: iu, ios, ispl, npts
595
+ real (xk), allocatable :: xy(:,:)
596
+ character (len= clen) :: msg
597
+ !
537
598
error_block: do
538
599
msg = " opening " // trim (vp_table)
539
600
open (newunit= iu,form= ' formatted' ,recl= 256 ,action= ' read' ,position= ' rewind' ,status= ' old' , &
@@ -548,7 +609,7 @@ subroutine init_splines
548
609
allocate (xy(2 ,npts),stat= ios)
549
610
if (ios/= 0 ) exit error_block
550
611
!
551
- write (out ," (t5,'spline ',i0,' defining ',a,' contains ',i0,' points.')" ) ispl, trim (names (ispl)), npts
612
+ write (out ," (t5,'spline ',i0,' defining component ',a,' contains ',i0,' points.')" ) ispl, trim (codes (ispl)), npts
552
613
!
553
614
if (npts> 0 ) then
554
615
write (msg," ('reading data points for spline #',i0,' npts = ',i0)" ) ispl, npts
@@ -568,7 +629,7 @@ subroutine init_splines
568
629
return
569
630
end do error_block
570
631
!
571
- write (out ," ('init_splines : Error ',a,'. ios = ',i0)" ) trim (msg), ios
572
- stop ' vectorpotential_tools%init_splines - error initializing splines'
573
- end subroutine init_splines
632
+ write (out ," ('init_splines_common : Error ',a,'. ios = ',i0)" ) trim (msg), ios
633
+ stop ' vectorpotential_tools%init_splines_common - error initializing splines'
634
+ end subroutine init_splines_common
574
635
end module vectorpotential_tools
0 commit comments