-
Notifications
You must be signed in to change notification settings - Fork 0
/
fmo_prop.f90
117 lines (97 loc) · 4.53 KB
/
fmo_prop.f90
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
program fmo_prop
use qdyn
use fmo_globals_mod
use fmo_open_close_mod
implicit none
! Local Variables
integer :: error
integer :: i
logical :: propagate_guess
! Note: variables shared between propagation and OCT are defined globally in
! the fmo_globals_mod module
character (len=error_l) :: module_name = 'fmo_prop'
!! @description: Propagate the system (for analysis)
call getarg(1, rf) ! name of runfolder must be passed as command line argument
call read_para(para, rf, configfile='config')
call debug_para_t(para, 'para', expand=1)
write (*,*) "Starting on "//trim(date_string())
call print_version_info('fmo_prop')
call init(para, grid=grid, pulses=pulses)
call init_ham(ham_x, grid, pulses, para, system='ham_x')
call load_dissipator(ham_x, join_path(rf, 'dissipator-real'), &
& join_path(rf, 'dissipator-imag'))
call init_ham(ham_y, grid, pulses, para, system='ham_y')
call load_dissipator(ham_y, join_path(rf, 'dissipator-real'), &
& join_path(rf, 'dissipator-imag'))
call init_ham(ham_z, grid, pulses, para, system='ham_z')
call load_dissipator(ham_z, join_path(rf, 'dissipator-real'), &
& join_path(rf, 'dissipator-imag'))
call init_psi(rho_in, grid, nsurf=8, spindim=1, para=para, system='rho_in')
call init_psi(rho_tgt, grid, nsurf=8, spindim=1, para=para, system='rho_tgt')
call psi_to_rho(rho_in)
call psi_to_rho(rho_tgt)
call debug_ham_t(ham_x, 'ham_x', filename=join_path(rf, 'ham.debug'), &
& expand=2)
call debug_ham_t(ham_y, 'ham_y', filename=join_path(rf, 'ham.debug'), &
& expand=2, append=.true.)
call debug_ham_t(ham_z, 'ham_z', filename=join_path(rf, 'ham.debug'), &
& expand=2, append=.true.)
call debug_state_t(rho_in, 'rho_in', filename=join_path(rf, 'rho.debug'))
call debug_state_t(rho_tgt, 'rho_tg', filename=join_path(rf, 'rho.debug'), &
& append=.true.)
call debug_pulse_t(pulses(1), 'pulse', filename=join_path(rf, 'pulse.debug'))
write(*,'("*** Pulse Initialization ***")')
! The main purpose of this program is to propagate the optimized pulses
! generated by the fmo_oct program. However, sometimes we also just want to
! propagate the guess pulse, as defined in the config file. The user-defined
! propagate_guess variable in the config file decides between the two options
call get_user_para(propagate_guess, para, 'propagate_guess')
if (propagate_guess) then
write(*,'("Using pulse as defined in config")')
else
write(*,'("Using pulse.dat (overriding config)")')
if (allocated(pulses)) deallocate(pulses)
allocate(pulses(1), stat=error)
call allocerror(module_name, 'main', error)
call read_pulse(pulses(1), join_path(rf, 'pulse.dat'), time_unit='fs')
end if
write (*,'("")')
write(*,'("*** Preparing Propagation ***")')
call set_oct_target(targets, 1, 3, rho_in, ham_x, grid, rho_tgt)
call set_oct_target(targets, 2, 3, rho_in, ham_y, grid, rho_tgt)
call set_oct_target(targets, 3, 3, rho_in, ham_z, grid, rho_tgt)
do i = 1, 3
write(*,*) "x(1), y(2), z(3) : ", i
call init_prop(targets(i)%ham, targets(i)%grid, targets(i)%prop_work, &
& para, pulses, rho=targets(i)%in_liouville_space)
end do
call dump_ascii_prop_work_t(targets(1)%prop_work, &
& filename=join_path(rf, 'prop_work.debug'))
call open_prop_files()
write (*,'("")')
write(*,'("*** Propagating ***")')
rho = targets(1)%state_initial
write(funit('pop.dat'),'(A)') ""
write(funit('pop.dat'),'(A)') ""
write(funit('pop.dat'),'(A)') "# x-direction"
call prop(rho, targets(1)%grid, targets(1)%ham, targets(1)%prop_work, &
& para, pulses, prop_info_hook=plot_rho_prop)
write(funit('pop.dat'),'(A)') ""
write(funit('pop.dat'),'(A)') ""
write(funit('pop.dat'),'(A)') "# y-direction"
rho = targets(2)%state_initial
call prop(rho, targets(2)%grid, targets(2)%ham, targets(2)%prop_work, &
& para, pulses, prop_info_hook=plot_rho_prop)
write(funit('pop.dat'),'(A)') ""
write(funit('pop.dat'),'(A)') ""
write(funit('pop.dat'),'(A)') "# z-direction"
rho = targets(3)%state_initial
call prop(rho, targets(3)%grid, targets(3)%ham, targets(3)%prop_work, &
& para, pulses, prop_info_hook=plot_rho_prop)
write (*,'("")')
! TODO: calculate and print whatever is interesting about the final propagated
! state (e.g. its fidelity)
call close_prop_files()
write (*,'("")')
write (*,'(A)') "Done: "//trim(date_string())
end program fmo_prop