56 logical :: what(MAX_OUTPUT_TYPES)
57 integer(int64) :: how(0:MAX_OUTPUT_TYPES)
58 integer :: output_interval(0:MAX_OUTPUT_TYPES)
59 real(real64) :: pol(3)
60 real(real64) :: pvec(3)
63 integer :: ierr, integrate
64 integer :: dim, dir, idim, pdim
65 logical :: what(MAX_OUTPUT_TYPES)
66 integer :: llp(3), llpp(3)
67 real(real64) :: Emax, Emin, Estep, uEstep,uEspan(2), pol(3)
68 real(real64) :: uThstep, uThspan(2), uPhstep, uPhspan(2), pvec(3)
69 real(real64) :: center(3)
70 real(real64),
allocatable :: Lg(:,:), RR(:)
71 real(real64),
allocatable :: pmesh(:,:,:,:)
72 integer,
allocatable :: Lp(:,:,:,:,:)
73 logical :: need_pmesh, resolve_states
74 integer :: ii, i1,i2,i3, idxZero(1:3), st_range(2)
77 type(electron_space_t) :: space
78 type(ions_t),
pointer :: ions
79 type(states_elec_t) :: st
80 type(kpoints_t) :: kpoints
81 type(restart_t) :: restart
83 character(len=512) :: filename
85 logical :: have_zweight_path, use_zweight_path
86 integer :: krng(2), nkpt, kpth_dir
88 type(pesoutput_t) :: pesout
91 real(real64),
pointer :: pesP_out(:,:,:)
92 real(real64),
allocatable,
target :: pesP(:,:,:,:)
93 real(real64),
allocatable :: Ekin(:,:,:)
95 type(pes_flux_t) :: pflux
96 integer :: pes_method, option
98 type(calc_mode_par_t) :: calc_mode
99 type(multicomm_t) :: mc
100 integer(int64) :: index_range(4)
102 class(coordinate_system_t),
pointer :: coord_system
106 message(1) =
"Your Fortran compiler doesn't support command-line arguments;"
107 message(2) =
"the oct-photoelectron-spectrum command is not available."
136 pdim = space%periodic_dim
143 select case (pes_method)
144 case (option__photoelectronspectrum__pes_mask)
151 llpp(1:dim) = llp(1:dim)
156 need_pmesh = space%is_periodic()
159 case (option__photoelectronspectrum__pes_flux)
164 option = option__pes_flux_shape__sph
165 if (dim <= 2) option = option__pes_flux_shape__cub
166 if (space%is_periodic()) option = option__pes_flux_shape__pln
171 llpp(1:dim) = pflux%ll(1:dim)
175 case (option__photoelectronspectrum__pes_spm)
199 what(option__photoelectronspectrumoutput__energy_tot) = .
true.
202 have_zweight_path = kpoints%have_zero_weight_path()
203 use_zweight_path = have_zweight_path
207 if (sum(pol(1:3)**2) <=
m_epsilon) pol = (/0,0,1/)
210 if (space%is_periodic())
then
218 what(option__photoelectronspectrumoutput__velocity_map_cut) = .
true.
219 pesout%pol = (/0,1,0/)
220 pesout%pvec = (/0,0,1/)
227 what(option__photoelectronspectrumoutput__arpes) = .
true.
228 pesout%pol = (/0,0,1/)
231 if (have_zweight_path)
then
238 what(option__photoelectronspectrumoutput__arpes_cut) = .
true.
239 pesout%pol = (/0,0,1/)
240 pesout%pvec = (/0,1,0/)
249 mpi_world%size, index_range, (/ 5000, 1, 1, 1 /))
250 index_range(:) = 100000
256 message(1) =
"Unable to read time-dependent restart information."
310 what_tag_in =
'PhotoelectronSpectrumOutput', ignore_error = .
true.)
317 uthstep, uthspan, uphstep, &
318 uphspan, pol, center, pvec, integrate)
324 if (uestep > 0 .and. uestep > estep) estep = uestep
325 if (uespan(1) > 0) emin = uespan(1)
326 if (uespan(2) > 0) emax = uespan(2)
344 st_range(1:2) = (/1, st%nst/)
345 resolve_states = .false.
352 if (abs(st_range(2)-st_range(1)) > 0)resolve_states = .
true.
361 if (have_zweight_path)
then
363 if (pesout%what(option__photoelectronspectrumoutput__arpes_cut))
then
365 use_zweight_path = .
true.
370 write(
message(1),
'(a)')
'Will use a zero-weight path in reciprocal space with the following points'
378 use_zweight_path = .false.
389 nkpt = krng(2) - krng(1) + 1
393 if (use_zweight_path)
then
394 llp(1:dim) = llpp(1:dim)
395 llp(kpth_dir) = llpp(kpth_dir) * nkpt
397 llp(1:dim) = llpp(1:dim)
401 write(
message(1),
'(a,i4,i4,i4)')
'Debug : llp = ', llp(1:3)
402 write(
message(2),
'(a,i4,i4,i4)')
'Debug : llpp = ', llpp(1:3)
406 safe_allocate(pmesh(1:llp(1), 1:llp(2), 1:llp(3), 1:3 + 1))
407 safe_allocate( pesp(1:llp(1), 1:llp(2), 1:llp(3), 1:st%d%nspin))
409 select case (pes_method)
410 case (option__photoelectronspectrum__pes_mask)
411 safe_allocate(lp(1:llpp(1), 1:llpp(2), 1:llpp(3), krng(1):krng(2), 1:3))
414 case (option__photoelectronspectrum__pes_flux)
417 safe_allocate(ekin(1:llp(1), 1:llp(2), 1:llp(3)))
423 if (.not. need_pmesh)
then
429 call sort(lg(1:llp(idim), idim))
441 write(
message(1),
'(a,f10.2,a2,f10.2,a2,f10.2,a1)') &
442 "Zenith axis: (",pol(1),
", ",pol(2),
", ",pol(3),
")"
459 if (resolve_states)
then
460 do ist = st_range(1), st_range(2)
462 select case (pes_method)
463 case (option__photoelectronspectrum__pes_mask)
465 case (option__photoelectronspectrum__pes_flux)
476 select case (pes_method)
477 case (option__photoelectronspectrum__pes_mask)
479 case (option__photoelectronspectrum__pes_flux)
489 write(
message(1),
'(a)')
'Done'
498 safe_deallocate_p(ions)
508 safe_deallocate_a(pesp)
509 safe_deallocate_a(pmesh)
510 safe_deallocate_a(lp)
511 safe_deallocate_a(ekin)
512 if (.not. need_pmesh .or. pes_method == option__photoelectronspectrum__pes_mask)
then
513 safe_deallocate_a(lg)
517 function outfile(name, ist, ispin, extension)
result(fname)
518 character(len=*),
intent(in) :: name
519 integer,
intent(in) :: ist
520 integer,
intent(in) :: ispin
521 character(len=*),
optional,
intent(in) :: extension
522 character(len=512) :: fname
527 write(fname,
'(a,a,i4.4)') trim(name),
'-st', ist
531 write(fname,
'(a,a,i1)') trim(fname),
'-sp', ispin
534 if (
present(extension) .and. len(extension)>0)
then
535 fname = trim(fname)//
'.'//trim(extension)
545 pesp_out => pesp(:,:,:,1)
549 safe_allocate(pesp_out(1:llp(1), 1:llp(2), 1:llp(3)))
550 pesp_out(:,:,:) = pesp(:,:,:,1) + pesp(:,:,:,2)
554 safe_deallocate_p(pesp_out)
557 do ispin = 1, st%d%nspin
558 pesp_out => pesp(:,:,:,ispin)
574 write(
message(1),
'(a,i4)')
'State = ', ist
580 write(
message(1),
'(a,i1)')
'Spin component= ', ispin
583 write(
message(1),
'(a)')
'Spinless'
588 if (ions%latt%nonorthogonal)
then
595 if (pesout%what(option__photoelectronspectrumoutput__energy_tot))
then
598 select case (pes_method)
599 case (option__photoelectronspectrum__pes_mask)
602 case (option__photoelectronspectrum__pes_flux)
608 if (pesout%what(option__photoelectronspectrumoutput__energy_angle))
then
611 select case (pes_method)
612 case (option__photoelectronspectrum__pes_mask)
615 case (option__photoelectronspectrum__pes_flux)
622 if (pesout%what(option__photoelectronspectrumoutput__velocity_map_cut))
then
625 if (sum((pvec-(/1 ,0 ,0/))**2) <=
m_epsilon) dir = 1
626 if (sum((pvec-(/0 ,1 ,0/))**2) <=
m_epsilon) dir = 2
627 if (sum((pvec-(/0 ,0 ,1/))**2) <=
m_epsilon) dir = 3
629 if (use_zweight_path)
then
630 filename =
outfile(
'PES_velocity_map', ist, ispin,
'path')
636 write(
message(1),
'(a)')
'Unrecognized plane. Use -u to change.'
646 filename = trim(filename)//
'.i_'//trim(
index2var(integrate))
651 pos = idxzero, pmesh = pmesh)
654 pos = idxzero, lk = lg)
658 if (pesout%what(option__photoelectronspectrumoutput__energy_xy))
then
660 if (uestep > 0 .and. uestep > estep)
then
663 estep = emax/
size(lg,1)
666 select case (pes_method)
667 case (option__photoelectronspectrum__pes_mask)
670 case (option__photoelectronspectrum__pes_flux)
676 if (pesout%what(option__photoelectronspectrumoutput__energy_th_ph))
then
679 write(
message(1),
'(a,es19.12,a2,es19.12,2x,a19)') &
680 'Save PES on a spherical cut at E= ',emin,
", ",emax, &
684 if (uestep > 0 .and. uestep > estep)
then
687 estep = emax/
size(lg,1)
690 select case (pes_method)
691 case (option__photoelectronspectrum__pes_mask)
695 case (option__photoelectronspectrum__pes_flux)
701 if (pesout%what(option__photoelectronspectrumoutput__velocity_map))
then
705 if (.not. (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__netcdf) /= 0) .and. &
706 .not. (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__vtk) /= 0) .and. &
707 .not. (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__ascii) /= 0))
then
708 message(1) =
'User must specify the format with "OutputFormat".'
709 message(2) =
'Available options are: necdf, vtk, ascii.'
715 filename =
outfile(
'./PES_velocity_map', ist, ispin)
719 if (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__ascii) /= 0)
then
723 pesout%how(option__photoelectronspectrumoutput__velocity_map), &
728 pesout%how(option__photoelectronspectrumoutput__velocity_map), &
734 if (pesout%what(option__photoelectronspectrumoutput__arpes))
then
741 sign(
m_one,pmesh( i1, i2, i3, dim)) * sum(pmesh(i1, i2, i3, 1:dim)**2) /
m_two)
749 global_namespace, space, lg, llp, pesout%how(option__photoelectronspectrumoutput__arpes), &
754 if (pesout%what(option__photoelectronspectrumoutput__arpes_cut))
then
757 filename =
outfile(
'./PES_ARPES', ist, ispin,
"path")
762 safe_deallocate_p(coord_system)
769 integer,
intent(in) :: ikstart
770 integer,
intent(in) :: ikend
773 character(len=100) :: str_tmp
777 do ik = ikstart, ikend
779 write(str_tmp,
'(f12.6)') kpoints%get_weight(ik)
781 do idir = 1, kpoints%full%dim
782 write(str_tmp,
'(f12.6)') kpoints%reduced%red_point(idir, ik)
795 real(real64),
intent(out) :: lPol(:)
799 complex(real64) :: cPol(1:3)
820 message(1) =
"There is more than one external field. Polarization will be selected"
821 message(2) =
"from the first field. Use -V to change axis."
828 character(5) pure function index2var(ivar) result(ch)
829 integer,
intent(in) :: ivar
845 write(ch,
'(i1)') ivar
This is the common interface to a sorting routine. It performs the shell algorithm,...
This module handles the calculation mode.
integer, parameter, public p_strategy_domains
parallelization in domains
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
type(debug_t), save, public debug
integer, parameter, public unpolarized
Parameters...
real(real64), parameter, public m_two
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
real(real64), parameter, public m_zero
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...
subroutine, public init_octopus_globals(comm)
Initialise Octopus-specific global constants and files. This routine performs no initialisation calls...
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_one
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...
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...
subroutine, public io_end()
subroutine, public kpoints_end(this)
subroutine, public kpoints_init(this, namespace, symm, dim, periodic_dim, latt)
integer pure function, public kpoints_number(this)
subroutine, public messages_end()
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
subroutine, public messages_not_implemented(feature, namespace)
character(len=512), private msg
subroutine, public messages_init(output_dir)
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
type(mpi_grp_t), public mpi_world
This module handles the communicators for the various parallelization strategies.
subroutine, public multicomm_init(mc, namespace, base_grp, mode_para, n_node, index_range, min_range)
create index and domain communicators
type(namespace_t), public global_namespace
subroutine, public parser_init()
Initialise the Octopus parser.
subroutine, public parser_end()
End the Octopus parser.
integer function, public parse_block(namespace, name, blk, check_varinfo_)
subroutine, public pes_flux_map_from_states(this, restart, st, ll, pesP, krng, Lp, istin)
subroutine, public pes_flux_out_energy(this, pesK, file, namespace, ll, Ekin, dim)
subroutine, public pes_flux_reciprocal_mesh_gen(this, namespace, space, st, kpoints, comm, post)
subroutine, public pes_flux_pmesh(this, namespace, dim, kpoints, ll, pmesh, idxZero, krng, Lp, Ekin)
subroutine, public pes_flux_out_vmap(this, pesK, file, namespace, ll, pmesh, dim)
integer, parameter, public integrate_r
integer, parameter, public integrate_kx
subroutine, public pes_mask_pmesh(namespace, dim, kpoints, ll, LG, pmesh, idxZero, krng, Lp)
subroutine, public pes_mask_output_power_totalm(pesK, file, namespace, Lk, ll, dim, Emax, Estep, interpolate)
integer, parameter, public integrate_phi
subroutine, public pes_mask_output_ar_spherical_cut_m(pesK, file, namespace, Lk, ll, dim, dir, Emin, Emax, Estep)
integer, parameter, public integrate_none
integer, parameter, public integrate_theta
subroutine, public pes_mask_output_ar_plane_m(pesK, file, namespace, Lk, ll, dim, dir, Emax, Estep)
subroutine, public pes_mask_map_from_states(restart, st, ll, pesK, krng, Lp, istin)
integer, parameter, public integrate_ky
integer, parameter, public integrate_kz
subroutine, public pes_mask_read_info(dir, namespace, dim, Emax, Estep, ll, Lk, RR)
Read pes info.
subroutine, public pes_mask_output_ar_polar_m(pesK, file, namespace, Lk, ll, dim, dir, Emax, Estep)
subroutine, public pes_out_velocity_map_cut(namespace, pesK, file, ll, dim, pol, dir, integrate, pos, Lk, pmesh)
subroutine, public pes_out_velocity_map(pesK, file, namespace, space, Lk, ll, how, spacing, coord_system, pmesh)
subroutine, public pes_out_arpes_cut(namespace, arpes, file, dim, ll, pmesh, Ekin)
subroutine, public profiling_end(namespace)
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
subroutine, public restart_module_init(namespace)
subroutine, public restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
Initializes a restart object.
integer, parameter, public restart_td
integer, parameter, public restart_type_load
subroutine, public restart_end(restart)
This module is intended to contain "only mathematical" functions and procedures.
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)
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
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
character(len=20) pure function, public units_abbrev(this)
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.
character pure function, public index2axis(idir)
subroutine write_kpoints_info(kpoints, ikstart, ikend)
subroutine get_laser_polarization(lPol)
subroutine output_spin_pes()
character(5) pure function index2var(ivar)
program photoelectron_spectrum
character(len=512) function outfile(name, ist, ispin, extension)
Extension of space that contains the knowledge of the spin dimension.