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)
103 class(coordinate_system_t),
pointer :: coord_system
107 message(1) =
"Your Fortran compiler doesn't support command-line arguments;"
108 message(2) =
"the oct-photoelectron-spectrum command is not available."
143 pdim = space%periodic_dim
150 select case (pes_method)
151 case (option__photoelectronspectrum__pes_mask)
158 llpp(1:dim) = llp(1:dim)
163 need_pmesh = space%is_periodic()
166 case (option__photoelectronspectrum__pes_flux)
171 option = option__pes_flux_shape__sph
172 if (dim <= 2) option = option__pes_flux_shape__cub
173 if (space%is_periodic()) option = option__pes_flux_shape__pln
178 llpp(1:dim) = pflux%ll(1:dim)
182 case (option__photoelectronspectrum__pes_spm)
206 what(option__photoelectronspectrumoutput__energy_tot) = .
true.
209 have_zweight_path = kpoints%have_zero_weight_path()
210 use_zweight_path = have_zweight_path
214 if (sum(pol(1:3)**2) <=
m_epsilon) pol = (/0,0,1/)
217 if (space%is_periodic())
then
225 what(option__photoelectronspectrumoutput__velocity_map_cut) = .
true.
226 pesout%pol = (/0,1,0/)
227 pesout%pvec = (/0,0,1/)
234 what(option__photoelectronspectrumoutput__arpes) = .
true.
235 pesout%pol = (/0,0,1/)
238 if (have_zweight_path)
then
245 what(option__photoelectronspectrumoutput__arpes_cut) = .
true.
246 pesout%pol = (/0,0,1/)
247 pesout%pvec = (/0,1,0/)
256 mpi_world%size, index_range, (/ 5000, 1, 1, 1 /))
257 index_range(:) = 100000
262 message(1) =
"Unable to read time-dependent restart information."
316 what_tag_in =
'PhotoelectronSpectrumOutput', ignore_error = .
true.)
323 uthstep, uthspan, uphstep, &
324 uphspan, pol, center, pvec, integrate)
330 if (uestep > 0 .and. uestep > estep) estep = uestep
331 if (uespan(1) > 0) emin = uespan(1)
332 if (uespan(2) > 0) emax = uespan(2)
350 st_range(1:2) = (/1, st%nst/)
351 resolve_states = .false.
358 if (abs(st_range(2)-st_range(1)) > 0)resolve_states = .
true.
368 if (have_zweight_path)
then
369 if (pesout%what(option__photoelectronspectrumoutput__arpes_cut))
then
371 use_zweight_path = .
true.
376 write(
message(1),
'(a)')
'Will use a zero-weight path in reciprocal space with the following points'
384 use_zweight_path = .false.
393 nkpt = krng(2) - krng(1) + 1
397 if (use_zweight_path)
then
398 llp(1:dim) = llpp(1:dim)
399 llp(kpth_dir) = llpp(kpth_dir) * nkpt
401 llp(1:dim) = llpp(1:dim)
404 write(
message(1),
'(a,i4,i4,i4)')
'Debug : llp = ', llp(1:3)
405 write(
message(2),
'(a,i4,i4,i4)')
'Debug : llpp = ', llpp(1:3)
408 safe_allocate(pmesh(1:llp(1), 1:llp(2), 1:llp(3), 1:3 + 1))
409 safe_allocate( pesp(1:llp(1), 1:llp(2), 1:llp(3), 1:st%d%nspin))
411 select case (pes_method)
412 case (option__photoelectronspectrum__pes_mask)
413 safe_allocate(lp(1:llpp(1), 1:llpp(2), 1:llpp(3), krng(1):krng(2), 1:3))
416 case (option__photoelectronspectrum__pes_flux)
419 safe_allocate(ekin(1:llp(1), 1:llp(2), 1:llp(3)))
423 call pes_flux_pmesh(pflux,
global_namespace, dim, kpoints, llpp, pmesh, idxzero, krng, nspin, lp, ekin)
427 if (.not. need_pmesh)
then
433 call sort(lg(1:llp(idim), idim))
445 write(
message(1),
'(a,f10.2,a2,f10.2,a2,f10.2,a1)') &
446 "Zenith axis: (",pol(1),
", ",pol(2),
", ",pol(3),
")"
463 if (resolve_states)
then
464 do ist = st_range(1), st_range(2)
466 select case (pes_method)
467 case (option__photoelectronspectrum__pes_mask)
469 case (option__photoelectronspectrum__pes_flux)
480 select case (pes_method)
481 case (option__photoelectronspectrum__pes_mask)
483 case (option__photoelectronspectrum__pes_flux)
493 write(
message(1),
'(a)')
'Done'
502 safe_deallocate_p(ions)
512 safe_deallocate_a(pesp)
513 safe_deallocate_a(pmesh)
514 safe_deallocate_a(lp)
515 safe_deallocate_a(ekin)
516 if (.not. need_pmesh .or. pes_method == option__photoelectronspectrum__pes_mask)
then
517 safe_deallocate_a(lg)
521 function outfile(name, ist, ispin, extension)
result(fname)
522 character(len=*),
intent(in) :: name
523 integer,
intent(in) :: ist
524 integer,
intent(in) :: ispin
525 character(len=*),
optional,
intent(in) :: extension
526 character(len=512) :: fname
531 write(fname,
'(a,a,i4.4)') trim(name),
'-st', ist
535 write(fname,
'(a,a,i1)') trim(fname),
'-sp', ispin
538 if (
present(extension) .and. len(extension)>0)
then
539 fname = trim(fname)//
'.'//trim(extension)
549 pesp_out => pesp(:,:,:,1)
553 safe_allocate(pesp_out(1:llp(1), 1:llp(2), 1:llp(3)))
554 pesp_out(:,:,:) = pesp(:,:,:,1) + pesp(:,:,:,2)
558 safe_deallocate_p(pesp_out)
561 do ispin = 1, st%d%nspin
562 pesp_out => pesp(:,:,:,ispin)
578 write(
message(1),
'(a,i4)')
'State = ', ist
584 write(
message(1),
'(a,i1)')
'Spin component= ', ispin
587 write(
message(1),
'(a)')
'Spinless'
592 if (ions%latt%nonorthogonal)
then
599 if (pesout%what(option__photoelectronspectrumoutput__energy_tot))
then
602 select case (pes_method)
603 case (option__photoelectronspectrum__pes_mask)
606 case (option__photoelectronspectrum__pes_flux)
612 if (pesout%what(option__photoelectronspectrumoutput__energy_angle))
then
615 select case (pes_method)
616 case (option__photoelectronspectrum__pes_mask)
619 case (option__photoelectronspectrum__pes_flux)
626 if (pesout%what(option__photoelectronspectrumoutput__velocity_map_cut))
then
629 if (sum((pvec-(/1 ,0 ,0/))**2) <=
m_epsilon) dir = 1
630 if (sum((pvec-(/0 ,1 ,0/))**2) <=
m_epsilon) dir = 2
631 if (sum((pvec-(/0 ,0 ,1/))**2) <=
m_epsilon) dir = 3
633 if (use_zweight_path)
then
634 filename =
outfile(
'PES_velocity_map', ist, ispin,
'path')
640 write(
message(1),
'(a)')
'Unrecognized plane. Use -u to change.'
650 filename = trim(filename)//
'.i_'//trim(
index2var(integrate))
655 pos = idxzero, pmesh = pmesh)
658 pos = idxzero, lk = lg)
662 if (pesout%what(option__photoelectronspectrumoutput__energy_xy))
then
664 if (uestep > 0 .and. uestep > estep)
then
667 estep = emax/
size(lg,1)
670 select case (pes_method)
671 case (option__photoelectronspectrum__pes_mask)
674 case (option__photoelectronspectrum__pes_flux)
680 if (pesout%what(option__photoelectronspectrumoutput__energy_th_ph))
then
683 write(
message(1),
'(a,es19.12,a2,es19.12,2x,a19)') &
684 'Save PES on a spherical cut at E= ',emin,
", ",emax, &
688 if (uestep > 0 .and. uestep > estep)
then
691 estep = emax/
size(lg,1)
694 select case (pes_method)
695 case (option__photoelectronspectrum__pes_mask)
699 case (option__photoelectronspectrum__pes_flux)
705 if (pesout%what(option__photoelectronspectrumoutput__velocity_map))
then
709 if (.not. (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__netcdf) /= 0) .and. &
710 .not. (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__vtk) /= 0) .and. &
711 .not. (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__ascii) /= 0))
then
712 message(1) =
'User must specify the format with "OutputFormat".'
713 message(2) =
'Available options are: necdf, vtk, ascii.'
719 filename =
outfile(
'./PES_velocity_map', ist, ispin)
723 if (
bitand(pesout%how(option__photoelectronspectrumoutput__velocity_map), option__outputformat__ascii) /= 0)
then
727 pesout%how(option__photoelectronspectrumoutput__velocity_map), &
732 pesout%how(option__photoelectronspectrumoutput__velocity_map), &
738 if (pesout%what(option__photoelectronspectrumoutput__arpes))
then
745 sign(
m_one,pmesh( i1, i2, i3, dim)) * sum(pmesh(i1, i2, i3, 1:dim)**2) /
m_two)
753 global_namespace, space, lg, llp, pesout%how(option__photoelectronspectrumoutput__arpes), &
758 if (pesout%what(option__photoelectronspectrumoutput__arpes_cut))
then
761 filename =
outfile(
'./PES_ARPES', ist, ispin,
"path")
766 safe_deallocate_p(coord_system)
773 integer,
intent(in) :: ikstart
774 integer,
intent(in) :: ikend
777 character(len=100) :: str_tmp
781 do ik = ikstart, ikend
783 write(str_tmp,
'(f12.6)') kpoints%get_weight(ik)
785 do idir = 1, kpoints%full%dim
786 write(str_tmp,
'(f12.6)') kpoints%reduced%red_point(idir, ik)
799 real(real64),
intent(out) :: lPol(:)
803 complex(real64) :: cPol(1:3)
824 message(1) =
"There is more than one external field. Polarization will be selected"
825 message(2) =
"from the first field. Use -V to change axis."
832 character(5) pure function index2var(ivar) result(ch)
833 integer,
intent(in) :: ivar
849 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
integer, parameter, public unpolarized
Parameters...
integer, parameter, public spin_polarized
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_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)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
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_pmesh(this, namespace, dim, kpoints, ll, pmesh, idxZero, krng, nspin, Lp, Ekin)
subroutine, public pes_flux_reciprocal_mesh_gen(this, namespace, space, st, kpoints, comm, post)
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.
integer, parameter, public restart_td
integer, parameter, public restart_type_load
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, 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
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.