Octopus
photoelectron_spectrum.F90
Go to the documentation of this file.
1!! Copyright (C) 2011 U. De Giovannini
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
27 use debug_oct_m
29 use global_oct_m
32 use io_oct_m
33 use ions_oct_m
37 use parser_oct_m
43 use sort_oct_m
44 use space_oct_m
45 use string_oct_m
48 use unit_oct_m
50 use utils_oct_m
51 use mpi_oct_m
52
53 implicit none
54
55 private
57
58contains
59
60 subroutine photoelectron_spectrum_main() bind(c)
61 type pesoutput_t
62 logical :: what(MAX_OUTPUT_TYPES)
63 integer(int64) :: how(0:MAX_OUTPUT_TYPES)
64 integer :: output_interval(0:MAX_OUTPUT_TYPES)
65 real(real64) :: pol(3)
66 real(real64) :: pvec(3)
67 end type pesoutput_t
68
69 integer :: ierr, integrate
70 integer :: dim, dir, idim, pdim
71 logical :: what(MAX_OUTPUT_TYPES)
72 integer :: llp(3), llpp(3)
73 real(real64) :: Emax, Emin, Estep, uEstep,uEspan(2), pol(3)
74 real(real64) :: uThstep, uThspan(2), uPhstep, uPhspan(2), pvec(3)
75 real(real64) :: center(3)
76 real(real64), allocatable :: Lg(:,:), RR(:)
77 real(real64), allocatable :: pmesh(:,:,:,:)
78 integer, allocatable :: Lp(:,:,:,:,:)
79 logical :: need_pmesh, resolve_states
80 integer :: ii, i1,i2,i3, idxZero(1:3), st_range(2)
81 type(block_t) :: blk
82
83 type(electron_space_t) :: space
84 type(ions_t), pointer :: ions
85 type(states_elec_t) :: st
86 type(kpoints_t) :: kpoints
87 type(restart_t) :: restart
88
89 character(len=512) :: filename
90
91 logical :: have_zweight_path, use_zweight_path
92 integer :: krng(2), nkpt, kpth_dir
94 type(pesoutput_t) :: pesout
95
96 integer :: ist, ispin
97 real(real64), pointer :: pesP_out(:,:,:)
98 real(real64), allocatable, target :: pesP(:,:,:,:)
99 real(real64), allocatable :: Ekin(:,:,:)
100
101 type(pes_flux_t) :: pflux
102 integer :: pes_method, option
103
104 type(calc_mode_par_t) :: calc_mode
105 type(multicomm_t) :: mc
106 integer(int64) :: index_range(4)
107 integer :: nspin
108
109 class(coordinate_system_t), pointer :: coord_system
110
111 call getopt_init(ierr)
112 if (ierr /= 0) then
113 message(1) = "Your Fortran compiler doesn't support command-line arguments;"
114 message(2) = "the oct-photoelectron-spectrum command is not available."
115 call messages_fatal(2)
116 end if
117
119
120 call parser_init()
121
122 call messages_init()
123 call io_init()
125
126 !* In order to initialize k-points
128
131
132 ! we need k-points for periodic systems
133 call kpoints_init(kpoints, global_namespace, ions%symm, space%dim, space%periodic_dim, ions%latt, mpi_world)
134 call states_elec_init(st, global_namespace, space, ions%val_charge(), kpoints)
135 !*
136
137 !Initialize variables
138 llp(:) = 1
139 llpp(:) = 1
140
141 ! Only the pes_mask branch below assigns these; they must not be left
142 ! uninitialized as they are compared against user values for all methods
143 estep = m_zero
144 emin = m_zero
145 emax = m_zero
146
147 need_pmesh = .false.
148 dim = space%dim ! The dimensionality dim = [1,2,3]
149 pdim = space%periodic_dim
150
151 call messages_print_with_emphasis(msg="Postprocessing", namespace=global_namespace)
152
153 !Figure out which method has been used to calculate the photoelectron data
154 call parse_variable(global_namespace, 'PhotoElectronSpectrum', option__photoelectronspectrum__none, pes_method)
155
156 select case (pes_method)
157 case (option__photoelectronspectrum__pes_mask)
158 call messages_write('Will process mask-method data.')
159 call messages_new_line()
160
161 ! Note that Lg(:,:) is allocated inside pes_mask_read_info
162 call pes_mask_read_info("td.general/", global_namespace, dim, emax, estep, llp(:), lg, rr)
163 ! Keep a copy the original dimensions vector
164 llpp(1:dim) = llp(1:dim)
165
166 call messages_write('Read PES_MASK info file.')
167 call messages_info()
168
169 need_pmesh = space%is_periodic()
170
171
172 case (option__photoelectronspectrum__pes_flux)
173 call messages_write('Will process flux-method data.')
174 call messages_new_line()
175 call messages_info()
176
177 option = option__pes_flux_shape__sph
178 if (dim <= 2) option = option__pes_flux_shape__cub
179 if (space%is_periodic()) option = option__pes_flux_shape__pln
180
181 call parse_variable(global_namespace, 'PES_Flux_Shape', option, pflux%surf_shape)
182 call pes_flux_reciprocal_mesh_gen(pflux, global_namespace, space, st, kpoints, mpi_comm_null, post = .true.)
183
184 llpp(1:dim) = pflux%ll(1:dim)
185 need_pmesh = .true.
186
187
188 case (option__photoelectronspectrum__pes_spm)
189 call messages_not_implemented('Postprocessing SPM data')
190 call messages_fatal()
191
192 case default
193 call messages_write('Could not find any photoelectron data')
194 call messages_fatal()
195
196 end select
197
198
199 !set default values
200
201
202 integrate = integrate_none
203 uestep = -1
204 uespan = (/-1,-1/)
205 uthstep = -1
206 uthspan = (/-1,-1/)
207 uphstep = -1
208 uphspan = (/-1,-1/)
209 center = (/0,0,0/)
210 pvec = (/1,0,0/)
211
212 what(:) = .false.
213 what(option__photoelectronspectrumoutput__energy_tot) = .true.
214 pesout%pvec = pvec
215
216 have_zweight_path = kpoints%have_zero_weight_path()
217 use_zweight_path = have_zweight_path
218
219 call get_laser_polarization(pol)
220 ! if there is no laser set pol along the z-axis
221 if (sum(pol(1:3)**2) <= m_epsilon) pol = (/0,0,1/)
222
223 ! more defaults
224 if (space%is_periodic()) then
225 what(:) = .false.
226
227 if (dim == 2) then
228 ! write the velocity map on plane pz=0 as it contains all the information
229 pol = (/0,1,0/)
230 pvec = (/0,0,1/)
231
232 what(option__photoelectronspectrumoutput__velocity_map_cut) = .true.
233 pesout%pol = (/0,1,0/)
234 pesout%pvec = (/0,0,1/)
235 end if
236
237 if (dim == 3) then
238 ! write the full ARPES in vtk format (this could be a big file)
239 pol = (/0,0,1/)
240
241 what(option__photoelectronspectrumoutput__arpes) = .true.
242 pesout%pol = (/0,0,1/)
243 end if
244
245 if (have_zweight_path) then
246 ! In this case the output is well defined only on a path in reciprocal space
247 ! so we are going to have only a 2D slice regardless of dim=2 or 3
248 pol = (/0,0,1/)
249 pvec = (/0,1,0/)
250
251 what(:) = .false.
252 what(option__photoelectronspectrumoutput__arpes_cut) = .true.
253 pesout%pol = (/0,0,1/)
254 pesout%pvec = (/0,1,0/)
255 end if
256
257 end if
258
259
260 ! Initialize mc
261 call calc_mode%unset_parallelization(p_strategy_domains)
262 call multicomm_init(mc, global_namespace, mpi_world, calc_mode, &
263 mpi_world%size, index_range, (/ 5000, 1, 1, 1 /))
264 index_range(:) = 100000
265
266
267 call restart%init(global_namespace, restart_td, restart_type_load, mc, ierr)
268 if (ierr /= 0) then
269 message(1) = "Unable to read time-dependent restart information."
270 call messages_fatal(1)
271 end if
272
273 !%Variable PhotoelectronSpectrumOutput
274 !%Type block
275 !%Default none
276 !%Section Utilities::oct-photoelectron_spectrum
277 !%Description
278 !% Specifies what to output when extracting the photoelectron cross-section information.
279 !% When we use polar coordinates the zenith axis is set by vec (default is the first
280 !% laser field polarization vector), theta is the inclination angle measured from
281 !% vec (from 0 to \pi), and phi is the azimuthal angle on a plane perpendicular to
282 !% vec (from 0 to 2\pi).
283 !% Each option must be in a separate row. Optionally individual output formats can be defined
284 !% for each row or they can be read separately from <tt>OutputFormat</tt> variable
285 !% in the input file.
286 !%
287 !% Example (minimal):
288 !% <br><br><tt>%PhotoelectronSpectrumOutput
289 !% <br>&nbsp;&nbsp;energy_tot
290 !% <br>&nbsp;&nbsp;velocity_map
291 !% <br>%<br></tt>
292 !%
293 !% Example (with OutputFormat):
294 !% <br><br><tt>%PhotoelectronSpectrumOutput
295 !% <br>&nbsp;&nbsp;arpes | vtk
296 !% <br>&nbsp;&nbsp;velocity_map | ncdf
297 !% <br>%<br></tt>
298 !%
299 !%Option energy_tot 1
300 !% Output the energy-resolved photoelectron spectrum: E.
301 !%Option energy_angle 2
302 !% Output the energy and angle resolved spectrum: (theta, E)
303 !% The result is integrated over phi.
304 !%Option velocity_map_cut 3
305 !% Velocity map on a plane orthogonal to pvec: (px, py). The allowed cutting planes
306 !% (pvec) can only be parallel to the x,y,z=0 planes.
307 !% Space is oriented so that the z-axis is along vec. Supports the -I option.
308 !%Option energy_xy 4
309 !% Angle and energy-resolved spectrum on the inclination plane: (Ex, Ey).
310 !% The result is integrated over ph;
311 !%Option energy_th_ph 5
312 !% Ionization probability integrated on spherical cuts: (theta, phi).
313 !%Option velocity_map 6
314 !% Full momentum-resolved ionization probability: (px, py, pz).
315 !% The output format can be controlled with <tt>OutputHow</tt> and can be vtk, ncdf or ascii.
316 !%Option arpes 7
317 !% Full ARPES for semi-periodic systems (vtk).
318 !%Option arpes_cut 8
319 !% ARPES cut on a plane following a zero-weight path in reciprocal space.
320 !%End
321 pesout%what = what
322 call io_function_read_what_how_when(global_namespace, space, pesout%what, pesout%how, pesout%output_interval, &
323 what_tag_in = 'PhotoelectronSpectrumOutput', ignore_error = .true.)
324
325 ! TODO: I think it would be better to move these options in the
326 ! input file to have more flexibility to combine and to keep
327 ! track of them. UDG
328 ! Read options from command line
329 call getopt_photoelectron_spectrum(uestep, uespan,&
330 uthstep, uthspan, uphstep, &
331 uphspan, pol, center, pvec, integrate)
332
333 call getopt_end()
334
335
336 !! set user values
337 if (uestep > 0 .and. uestep > estep) estep = uestep
338 if (uespan(1) > 0) emin = uespan(1)
339 if (uespan(2) > 0) emax = uespan(2)
340
341
342
343 !%Variable PhotoelectronSpectrumResolveStates
344 !%Type block
345 !%Default
346 !%Section Utilities::oct-photoelectron_spectrum
347 !%Description
348 !% If <tt>yes</tt> calculate the photoelectron spectrum resolved in each K.S. state.
349 !% Optionally a range of states can be given as two slot block where the
350 !% first slot is the lower state index and the second is the highest one.
351 !% For example to calculate the spectra from state i to state j:
352 !%
353 !% <tt>%PhotoelectronSpectrumResolveStates
354 !% <br> i | j
355 !% <br>%</tt>
356 !%End
357 st_range(1:2) = (/1, st%nst/)
358 resolve_states = .false.
359 if (parse_block(global_namespace, 'PhotoelectronSpectrumResolveStates', blk) == 0) then
360 if (parse_block_cols(blk,0) < 2) call messages_input_error(global_namespace, 'PhotoelectronSpectrumResolveStates')
361 do idim = 1, 2
362 call parse_block_integer(blk, 0, idim - 1, st_range(idim))
363 end do
364 call parse_block_end(blk)
365 if (abs(st_range(2)-st_range(1)) > 0)resolve_states = .true.
366 else
367 call parse_variable(global_namespace, 'PhotoelectronSpectrumResolveStates', .false., resolve_states)
368 end if
369
370
371 ! Determine the range of k-points used in the PES calculation
372 krng(1) = 1
373 krng(2) = kpoints_number(kpoints)
374
375 if (have_zweight_path) then
376 if (pesout%what(option__photoelectronspectrumoutput__arpes_cut)) then
377 !Use the path only when asked for ARPES on a cutting curve in reciprocal space(the path)
378 use_zweight_path = .true.
379
380 krng(1) = kpoints_number(kpoints) - kpoints%nik_skip + 1
381
382 call messages_print_with_emphasis(msg="Kpoint selection", namespace=global_namespace)
383 write(message(1), '(a)') 'Will use a zero-weight path in reciprocal space with the following points'
384 call messages_info(1)
385
386 kpth_dir = 1
387 pvec = (/0,1,0/)
388
389
390 else
391 use_zweight_path = .false.
392 krng(2) = kpoints_number(kpoints) - kpoints%nik_skip
393
394 end if
395 end if
396
397 call write_kpoints_info(kpoints, krng(1), krng(2))
399
400 nkpt = krng(2) - krng(1) + 1
401
402
403
404 if (use_zweight_path) then
405 llp(1:dim) = llpp(1:dim)
406 llp(kpth_dir) = llpp(kpth_dir) * nkpt
407 else
408 llp(1:dim) = llpp(1:dim)
409 end if
410
411 write(message(1),'(a,i4,i4,i4)') 'Debug : llp = ', llp(1:3)
412 write(message(2),'(a,i4,i4,i4)') 'Debug : llpp = ', llpp(1:3)
413 call messages_info(2, debug_only=.true.)
414
415 safe_allocate(pmesh(1:llp(1), 1:llp(2), 1:llp(3), 1:3 + 1))
416 safe_allocate( pesp(1:llp(1), 1:llp(2), 1:llp(3), 1:st%d%nspin))
417
418 select case (pes_method)
419 case (option__photoelectronspectrum__pes_mask)
420 safe_allocate(lp(1:llpp(1), 1:llpp(2), 1:llpp(3), krng(1):krng(2), 1:3))
421 call pes_mask_pmesh(global_namespace, dim, kpoints, llpp, lg, pmesh, idxzero, krng, lp)
422
423 case (option__photoelectronspectrum__pes_flux)
424 ! Lp is allocated inside pes_flux_pmesh to comply with the
425 ! declinations of the different surfaces
426 safe_allocate(ekin(1:llp(1), 1:llp(2), 1:llp(3)))
427 ekin = m_zero
428 nspin = 1
429 if (st%d%ispin == spin_polarized) nspin = 2
430 call pes_flux_pmesh(pflux, global_namespace, dim, kpoints, llpp, pmesh, idxzero, krng, nspin, lp, ekin)
431 end select
432
433
434 if (.not. need_pmesh) then
435 ! There is no need to use pmesh we just need to sort Lg in place
436 ! in order to have a coordinate ordering coherent with pesP
437 ! NOTE: this works only for the mask_method since Lg is well-defined
438 ! only in this case
439 do idim = 1, dim
440 call sort(lg(1:llp(idim), idim))
441 end do
442 end if
443
444
445 call messages_write('Read PES restart files.')
446 call messages_info()
447
448
449
451
452 write(message(1),'(a,f10.2,a2,f10.2,a2,f10.2,a1)') &
453 "Zenith axis: (",pol(1),", ",pol(2),", ",pol(3),")"
454 call messages_info(1)
455
456
457 ! Convert the grid units
458 if (need_pmesh) then
459 do ii = 1,3
460 do i3 = 1, llp(3)
461 do i2 = 1, llp(2)
462 do i1 = 1, llp(1)
463 pmesh(i1, i2, i3, ii) = units_from_atomic(sqrt(units_out%energy), pmesh(i1, i2, i3, ii))
464 end do
465 end do
466 end do
467 end do
468 end if
469
470 if (resolve_states) then
471 do ist = st_range(1), st_range(2)
472
473 select case (pes_method)
474 case (option__photoelectronspectrum__pes_mask)
475 call pes_mask_map_from_states(restart, st, llpp, pesp, krng, lp, ist)
476 case (option__photoelectronspectrum__pes_flux)
477 call pes_flux_map_from_states(pflux, restart, st, llpp, pesp, krng, lp, ist)
478 end select
479
480 if (mpi_world%is_root()) call output_spin_pes()
481 end do
482
483 else
484 ! Read the data
485 ist = 0
486
487 select case (pes_method)
488 case (option__photoelectronspectrum__pes_mask)
489 call pes_mask_map_from_states(restart, st, llpp, pesp, krng, lp)
490 case (option__photoelectronspectrum__pes_flux)
491 call pes_flux_map_from_states(pflux, restart, st, llpp, pesp, krng, lp)
492 end select
493
494 if (mpi_world%is_root()) call output_spin_pes()
495
496 end if
497
498
499
500 write(message(1), '(a)') 'Done'
501 call messages_info(1)
502
504
505 call restart%end()
506
507 call states_elec_end(st)
508
509 safe_deallocate_p(ions)
510 call kpoints_end(kpoints)
511
513 call io_end()
514 call messages_end()
515
516 call parser_end()
517 call global_end()
518
519 safe_deallocate_a(pesp)
520 safe_deallocate_a(pmesh)
521 safe_deallocate_a(lp)
522 safe_deallocate_a(ekin)
523 if (.not. need_pmesh .or. pes_method == option__photoelectronspectrum__pes_mask) then
524 safe_deallocate_a(lg)
525 end if
526 contains
527
528 function outfile(name, ist, ispin, extension) result(fname)
529 character(len=*), intent(in) :: name
530 integer, intent(in) :: ist
531 integer, intent(in) :: ispin
532 character(len=*), optional, intent(in) :: extension
533 character(len=512) :: fname
534
535 if (ist == 0) then
536 fname = trim(name)
537 else
538 write(fname, '(a,a,i4.4)') trim(name), '-st', ist
539 end if
540
541 if (ispin >0) then
542 write(fname, '(a,a,i1)') trim(fname),'-sp', ispin
543 end if
544
545 if (present(extension)) then
546 if (len(extension) > 0) fname = trim(fname)//'.'//trim(extension)
547 end if
548
549 end function outfile
550
551 subroutine output_spin_pes()
552
553 ! Write total quantities (summed over spin)
554 ispin = 0
555 if (st%d%ispin == unpolarized) then
556 pesp_out => pesp(:,:,:,1)
557 call output_pes()
558 else
559 ! Write total quantities (summed over spin)
560 safe_allocate(pesp_out(1:llp(1), 1:llp(2), 1:llp(3)))
561 pesp_out(:,:,:) = pesp(:,:,:,1) + pesp(:,:,:,2)
562
563 call output_pes()
564
565 safe_deallocate_p(pesp_out)
566
567 ! spin-resolved
568 do ispin = 1, st%d%nspin
569 pesp_out => pesp(:,:,:,ispin)
570 call output_pes()
571 end do
572 end if
573 end subroutine output_spin_pes
574
575 subroutine output_pes()
576
577 ! choose what to calculate
578 ! these functions are defined in pes_mask_out_inc.F90
579
580 if (st%d%ispin /= unpolarized .or. ist>0) then
582 end if
583
584 if (ist > 0) then
585 write(message(1), '(a,i4)') 'State = ', ist
586 call messages_info(1)
587 end if
588
589 if (st%d%ispin /= unpolarized) then
590 if (ispin > 0) then
591 write(message(1), '(a,i1)') 'Spin component= ', ispin
592 call messages_info(1)
593 else
594 write(message(1), '(a)') 'Spinless'
595 call messages_info(1)
596 end if
597 end if
598
599 if (ions%latt%nonorthogonal) then
600 coord_system => affine_coordinates_t(global_namespace, space%dim, ions%latt%rlattice_primitive)
601 else
602 coord_system => cartesian_t(global_namespace, space%dim)
603 end if
604
605
606 if (pesout%what(option__photoelectronspectrumoutput__energy_tot)) then
607 call messages_print_with_emphasis(msg="Energy-resolved PES", namespace=global_namespace)
608
609 select case (pes_method)
610 case (option__photoelectronspectrum__pes_mask)
611 call pes_mask_output_power_totalm(pesp_out,outfile('./PES_energy',ist, ispin, 'sum'), &
612 global_namespace, lg, llp, dim, emax, estep, interpolate = .true.)
613 case (option__photoelectronspectrum__pes_flux)
614 call pes_flux_out_energy(pflux, pesp_out, outfile('./PES_energy',ist, ispin, 'sum'), global_namespace, llp, ekin, dim)
615 end select
616
617 end if
618
619 if (pesout%what(option__photoelectronspectrumoutput__energy_angle)) then
620 call messages_print_with_emphasis(msg="Angle- and energy-resolved PES", namespace=global_namespace)
621
622 select case (pes_method)
623 case (option__photoelectronspectrum__pes_mask)
624 call pes_mask_output_ar_polar_m(pesp_out,outfile('./PES_angle_energy',ist, ispin, 'map'), &
625 global_namespace, lg, llp, dim, pol, emax, estep)
626 case (option__photoelectronspectrum__pes_flux)
627 call messages_not_implemented("Angle- and energy-resolved PES for the flux method")
628 end select
629
630
631 end if
632
633 if (pesout%what(option__photoelectronspectrumoutput__velocity_map_cut)) then
634 call messages_print_with_emphasis(msg="Velocity map on a plane", namespace=global_namespace)
635 dir = -1
636 if (sum((pvec-(/1 ,0 ,0/))**2) <= m_epsilon) dir = 1
637 if (sum((pvec-(/0 ,1 ,0/))**2) <= m_epsilon) dir = 2
638 if (sum((pvec-(/0 ,0 ,1/))**2) <= m_epsilon) dir = 3
639
640 if (use_zweight_path) then
641 filename = outfile('PES_velocity_map', ist, ispin, 'path')
642 else
643 filename = outfile('PES_velocity_map', ist, ispin, 'p'//index2axis(dir)//'=0')
644 end if
645
646 if (dir == -1) then
647 write(message(1), '(a)') 'Unrecognized plane. Use -u to change.'
648 call messages_fatal(1)
649 else
650 write(message(1), '(a)') 'Save velocity map on plane: '//index2axis(dir)//" = 0"
651 call messages_info(1)
652 end if
653
654 if (integrate /= integrate_none) then
655 write(message(1), '(a)') 'Integrate on: '//index2var(integrate)
656 call messages_info(1)
657 filename = trim(filename)//'.i_'//trim(index2var(integrate))
658 end if
659
660 if (need_pmesh) then
661 call pes_out_velocity_map_cut(global_namespace, pesp_out, filename, llp, dim, pol, dir, integrate, &
662 pos = idxzero, pmesh = pmesh)
663 else
664 call pes_out_velocity_map_cut(global_namespace, pesp_out, filename, llp, dim, pol, dir, integrate, &
665 pos = idxzero, lk = lg)
666 end if
667 end if
668
669 if (pesout%what(option__photoelectronspectrumoutput__energy_xy)) then
670 call messages_print_with_emphasis(msg="Angle and energy-resolved on a plane", namespace=global_namespace)
671 if (uestep > 0 .and. uestep > estep) then
672 estep = uestep
673 else
674 estep = emax/size(lg,1)
675 end if
676
677 select case (pes_method)
678 case (option__photoelectronspectrum__pes_mask)
679 call pes_mask_output_ar_plane_m(pesp_out,outfile('./PES_energy', ist, ispin, 'map'), &
680 global_namespace, lg, llp, dim, pol, emax, estep)
681 case (option__photoelectronspectrum__pes_flux)
682 call messages_not_implemented("Angle and energy-resolved on a plane for the flux method")
683 end select
684
685 end if
686
687 if (pesout%what(option__photoelectronspectrumoutput__energy_th_ph)) then
688 call messages_print_with_emphasis(msg="PES on spherical cuts", namespace=global_namespace)
689
690 write(message(1), '(a,es19.12,a2,es19.12,2x,a19)') &
691 'Save PES on a spherical cut at E= ',emin,", ",emax, &
692 str_center('['//trim(units_abbrev(units_out%energy)) // ']', 19)
693 call messages_info(1)
694
695 if (uestep > 0 .and. uestep > estep) then
696 estep = uestep
697 else
698 estep = emax/size(lg,1)
699 end if
700
701 select case (pes_method)
702 case (option__photoelectronspectrum__pes_mask)
703 call pes_mask_output_ar_spherical_cut_m(pesp_out,outfile('./PES_sphere', ist, ispin, 'map'), &
704 global_namespace, lg, llp, dim, pol, emin, emax, estep)
705
706 case (option__photoelectronspectrum__pes_flux)
707 call messages_not_implemented("PES on spherical cuts for the flux method")
708 end select
709
710 end if
711
712 if (pesout%what(option__photoelectronspectrumoutput__velocity_map)) then
713
714 call messages_print_with_emphasis(msg="Full velocity map", namespace=global_namespace)
715
716 if (.not. (bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__netcdf) /= 0) .and. &
717 .not. (bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__vtk) /= 0) .and. &
718 .not. (bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__ascii) /= 0)) then
719 message(1) = 'User must specify the format with "OutputFormat".'
720 message(2) = 'Available options are: necdf, vtk, ascii.'
721 call messages_fatal(2)
722
723 end if
724
725
726 filename = outfile('./PES_velocity_map', ist, ispin)
727 if (need_pmesh) then
728 !force vtk output
729! how = io_function_fill_how("VTK")
730 if (bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__ascii) /= 0) then
731 call pes_flux_out_vmap(pflux, pesp_out, filename, global_namespace, llp, pmesh, space%dim)
732 else
733 ! Lg is only allocated by the mask method, and is unused when pmesh is given
734 call pes_out_velocity_map(pesp_out, filename, global_namespace, space, ll = llp, &
735 how = pesout%how(option__photoelectronspectrumoutput__velocity_map), &
736 spacing = (/m_one, m_one, m_one/), coord_system = coord_system, pmesh = pmesh)
737 end if
738 else
739 call pes_out_velocity_map(pesp_out, filename, global_namespace, space, lg, llp, &
740 pesout%how(option__photoelectronspectrumoutput__velocity_map), &
741 (/m_one, m_one, m_one/), coord_system)
742 end if
743
744 end if
745
746 if (pesout%what(option__photoelectronspectrumoutput__arpes)) then
747 call messages_print_with_emphasis(msg="ARPES", namespace=global_namespace)
748
749 do i3 = 1, llp(3)
750 do i2 = 1, llp(2)
751 do i1 = 1, llp(1)
752 pmesh(i1, i2, i3, dim) = units_from_atomic(units_out%energy, &
753 sign(m_one,pmesh( i1, i2, i3, dim)) * sum(pmesh(i1, i2, i3, 1:dim)**2) / m_two)
754 end do
755 end do
756 end do
757
758 pesout%how(option__photoelectronspectrumoutput__arpes) = io_function_fill_how("VTK")
759
760 call pes_out_velocity_map(pesp_out, outfile('./PES_ARPES', ist, ispin), &
761 global_namespace, space, ll = llp, &
762 how = pesout%how(option__photoelectronspectrumoutput__arpes), &
763 spacing = (/m_one, m_one, m_one/), coord_system = coord_system, pmesh = pmesh)
764 end if
765
766
767 if (pesout%what(option__photoelectronspectrumoutput__arpes_cut)) then
768 call messages_print_with_emphasis(msg="ARPES cut on reciprocal space path", namespace=global_namespace)
769
770 filename = outfile('./PES_ARPES', ist, ispin, "path")
771 call pes_out_arpes_cut(global_namespace, pesp_out, filename, dim, llp, pmesh, ekin)
772
773 end if
774
775 safe_deallocate_p(coord_system)
776
777 end subroutine output_pes
778
779
780 subroutine write_kpoints_info(kpoints, ikstart, ikend)
781 type(kpoints_t), intent(in) :: kpoints
782 integer, intent(in) :: ikstart
783 integer, intent(in) :: ikend
784
785 integer :: ik, idir
786 character(len=100) :: str_tmp
787
788 push_sub(write_kpoints_info)
789
790 do ik = ikstart, ikend
791 write(message(1),'(i8,1x)') ik
792 write(str_tmp,'(f12.6)') kpoints%get_weight(ik)
793 message(1) = trim(message(1)) // trim(str_tmp)//' |'
794 do idir = 1, kpoints%full%dim
795 write(str_tmp,'(f12.6)') kpoints%reduced%red_point(idir, ik)
796 message(1) = trim(message(1)) // trim(str_tmp)
797 end do
798 message(1) = trim(message(1)) //' |'
799 call messages_info(1)
800 end do
801
802 call messages_info(1)
803
804 pop_sub(write_kpoints_info)
805 end subroutine write_kpoints_info
806
807 subroutine get_laser_polarization(lPol)
808 real(real64), contiguous, intent(out) :: lPol(:)
809
810 type(block_t) :: blk
811 integer :: no_l
812 complex(real64) :: cPol(1:3)
813
814 push_sub(get_laser_polarization)
815
816 cpol = m_zero
817
818 no_l = 0
819 if (parse_block(global_namespace, 'TDExternalFields', blk) == 0) then
820 no_l = parse_block_n(blk)
821
822 call parse_block_cmplx(blk, 0, 1, cpol(1))
823 call parse_block_cmplx(blk, 0, 2, cpol(2))
824 call parse_block_cmplx(blk, 0, 3, cpol(3))
825
826
827 call parse_block_end(blk)
828 end if
829
830 lpol(:) = abs(cpol)
831
832 if (no_l > 1) then
833 message(1) = "There is more than one external field. Polarization will be selected"
834 message(2) = "from the first field. Use -V to change axis."
835 call messages_info(2)
836 end if
837
839 end subroutine get_laser_polarization
840
841 character(5) pure function index2var(ivar) result(ch)
842 integer, intent(in) :: ivar
843
844 select case (ivar)
845 case (integrate_phi)
846 ch = 'phi'
847 case (integrate_theta)
848 ch = 'theta'
849 case (integrate_r)
850 ch = 'r'
851 case (integrate_kx)
852 ch = 'kx'
853 case (integrate_ky)
854 ch = 'ky'
855 case (integrate_kz)
856 ch = 'kz'
857 case default
858 write(ch,'(i1)') ivar
859 end select
860 end function index2var
861 end subroutine photoelectron_spectrum_main
863
864!! Local Variables:
865!! mode: f90
866!! coding: utf-8
867!! End:
This is the common interface to a sorting routine. It performs the shell algorithm,...
Definition: sort.F90:133
This module handles the calculation mode.
integer, parameter, public p_strategy_domains
parallelization in domains
This module provides an interface to the getopt C library, so that the command line arguments can be ...
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spin_polarized
real(real64), parameter, public m_two
Definition: global.F90:175
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
Definition: global.F90:500
real(real64), parameter, public m_zero
Definition: global.F90:173
type(mpi_comm), parameter, public serial_dummy_comm
Alias MPI_COMM_UNDEFINED for the specific use case of initialising Octopus utilities with no MPI supp...
Definition: global.F90:268
subroutine, public init_octopus_globals(comm)
Initialise Octopus-specific global constants and files. This routine performs no initialisation calls...
Definition: global.F90:438
real(real64), parameter, public m_epsilon
Definition: global.F90:189
real(real64), parameter, public m_one
Definition: global.F90:174
subroutine, public io_function_read_what_how_when(namespace, space, what, how, output_interval, what_tag_in, how_tag_in, output_interval_tag_in, ignore_error)
integer(int64) function, public io_function_fill_how(where)
Use this function to quickly plot functions for debugging purposes: call dio_function_output(io_funct...
Definition: io.F90:93
subroutine, public io_init(defaults)
If the argument defaults is present and set to true, then the routine will not try to read anything f...
Definition: io.F90:142
subroutine, public io_end()
Definition: io.F90:248
subroutine, public kpoints_end(this)
Definition: kpoints.F90:1045
subroutine, public kpoints_init(this, namespace, symm, dim, periodic_dim, latt, grp)
Definition: kpoints.F90:396
integer pure function, public kpoints_number(this)
Definition: kpoints.F90:1205
subroutine, public messages_end()
Definition: messages.F90:249
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
Definition: messages.F90:878
subroutine, public messages_not_implemented(feature, namespace)
Definition: messages.F90:1048
character(len=512), private msg
Definition: messages.F90:143
subroutine, public messages_init(output_dir)
Definition: messages.F90:196
subroutine, public messages_new_line()
Definition: messages.F90:1069
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:138
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:386
subroutine, public messages_input_error(namespace, var, details, row, column)
Definition: messages.F90:671
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:570
type(mpi_grp_t), public mpi_world
Definition: mpi.F90:317
This module handles the communicators for the various parallelization strategies.
Definition: multicomm.F90:124
subroutine, public multicomm_init(mc, namespace, base_grp, mode_para, n_processes, index_range, min_range)
create index and domain communicators
Definition: multicomm.F90:250
type(namespace_t), public global_namespace
Definition: namespace.F90:112
subroutine, public parser_init()
Initialise the Octopus parser.
Definition: parser.F90:387
subroutine, public parser_end()
End the Octopus parser.
Definition: parser.F90:419
integer function, public parse_block(namespace, name, blk, check_varinfo_)
Definition: parser.F90:600
subroutine, public pes_flux_map_from_states(this, restart, st, ll, pesP, krng, Lp, istin)
Definition: pes_flux.F90:3358
subroutine, public pes_flux_out_energy(this, pesK, file, namespace, ll, Ekin, dim)
Definition: pes_flux.F90:4031
subroutine, public pes_flux_pmesh(this, namespace, dim, kpoints, ll, pmesh, idxZero, krng, nspin, Lp, Ekin)
Definition: pes_flux.F90:3317
subroutine, public pes_flux_reciprocal_mesh_gen(this, namespace, space, st, kpoints, comm, post)
Definition: pes_flux.F90:834
subroutine, public pes_flux_out_vmap(this, pesK, file, namespace, ll, pmesh, dim)
Definition: pes_flux.F90:4192
integer, parameter, public integrate_r
Definition: pes_mask.F90:241
integer, parameter, public integrate_kx
Definition: pes_mask.F90:241
subroutine, public pes_mask_pmesh(namespace, dim, kpoints, ll, LG, pmesh, idxZero, krng, Lp)
Definition: pes_mask.F90:1516
subroutine, public pes_mask_output_power_totalm(pesK, file, namespace, Lk, ll, dim, Emax, Estep, interpolate)
Definition: pes_mask.F90:3130
integer, parameter, public integrate_phi
Definition: pes_mask.F90:241
subroutine, public pes_mask_output_ar_spherical_cut_m(pesK, file, namespace, Lk, ll, dim, dir, Emin, Emax, Estep)
Definition: pes_mask.F90:2859
integer, parameter, public integrate_none
Definition: pes_mask.F90:241
integer, parameter, public integrate_theta
Definition: pes_mask.F90:241
subroutine, public pes_mask_output_ar_plane_m(pesK, file, namespace, Lk, ll, dim, dir, Emax, Estep)
Definition: pes_mask.F90:2729
subroutine, public pes_mask_map_from_states(restart, st, ll, pesK, krng, Lp, istin)
Definition: pes_mask.F90:1756
integer, parameter, public integrate_ky
Definition: pes_mask.F90:241
integer, parameter, public integrate_kz
Definition: pes_mask.F90:241
subroutine, public pes_mask_read_info(dir, namespace, dim, Emax, Estep, ll, Lk, RR)
Read pes info.
Definition: pes_mask.F90:3453
subroutine, public pes_mask_output_ar_polar_m(pesK, file, namespace, Lk, ll, dim, dir, Emax, Estep)
Definition: pes_mask.F90:2610
subroutine, public pes_out_velocity_map_cut(namespace, pesK, file, ll, dim, pol, dir, integrate, pos, Lk, pmesh)
Definition: pes_out.F90:273
subroutine, public pes_out_velocity_map(pesK, file, namespace, space, Lk, ll, how, spacing, coord_system, pmesh)
Definition: pes_out.F90:141
subroutine, public pes_out_arpes_cut(namespace, arpes, file, dim, ll, pmesh, Ekin)
Definition: pes_out.F90:197
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
Definition: profiling.F90:122
subroutine, public profiling_end(namespace)
Definition: profiling.F90:455
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
Definition: profiling.F90:264
integer, parameter, public restart_td
Definition: restart.F90:133
integer, parameter, public restart_type_load
Definition: restart.F90:161
This module is intended to contain "only mathematical" functions and procedures.
Definition: sort.F90:96
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public states_elec_end(st)
finalize the states_elec_t object
subroutine, public states_elec_init(st, namespace, space, valence_charge, kpoints, calc_mode_id)
Initialize a new states_elec_t object.
character(len=80) function, public str_center(s_in, l_in)
puts space around string, so that it is centered
Definition: string.F90:153
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
Definition: unit.F90:111
character(len=20) pure function, public units_abbrev(this)
Definition: unit.F90:202
This module defines the unit system, used for input and output.
type(unit_system_t), public units_out
subroutine, public unit_system_init(namespace)
This module is intended to contain simple general-purpose utility functions and procedures.
Definition: utils.F90:99
character pure function, public index2axis(idir)
Definition: utils.F90:191
subroutine get_laser_polarization(lPol)
subroutine output_spin_pes()
subroutine write_kpoints_info(kpoints, ikstart, ikend)
character(5) pure function index2var(ivar)
subroutine output_pes()
character(len=512) function outfile(name, ist, ispin, extension)
Extension of space that contains the knowledge of the spin dimension.
int true(void)