30 use,
intrinsic :: iso_fortran_env
71 integer,
public,
parameter :: &
72 SPECTRUM_DAMP_NONE = 0, &
78 integer,
public,
parameter :: &
79 SPECTRUM_TRANSFORM_LAPLACE = 1, &
83 integer,
public,
parameter :: &
84 SPECTRUM_ABSORPTION = 1, &
89 integer,
public,
parameter :: &
90 SPECTRUM_FOURIER = 1, &
94 real(real64) :: start_time
95 real(real64) :: end_time
96 real(real64) :: energy_step
97 real(real64) :: min_energy
98 real(real64) :: max_energy
101 real(real64) :: damp_factor
104 real(real64) :: noise
105 logical,
private :: sigma_diag
111 real(real64) :: time_step_, energy_step_
112 complex(real64),
allocatable :: func_(:),func_ar_(:,:),pos_(:,:),tret_(:), funcw_(:)
113 type(fft_t),
save :: fft_handler
114 integer :: is_, ie_, default
124 subroutine spectrum_init(spectrum, namespace, default_energy_step, default_max_energy)
125 type(spectrum_t),
intent(inout) :: spectrum
126 type(namespace_t),
intent(in) :: namespace
127 real(real64),
optional,
intent(in) :: default_energy_step
128 real(real64),
optional,
intent(in) :: default_max_energy
130 real(real64) :: fdefault
152 call parse_variable(namespace,
'PropagationSpectrumType', spectrum_absorption, spectrum%spectype)
170 call parse_variable(namespace,
'SpectrumMethod', spectrum_fourier, spectrum%method)
188 call parse_variable(namespace,
'SpectrumSignalNoise', 0.0_real64, spectrum%noise)
213 call parse_variable(namespace,
'PropagationSpectrumDampMode', default, spectrum%damp)
221 message(1) =
'Using damping with compressed sensing, this is not required'
222 message(2) =
'and can introduce noise in the spectra.'
279 if (
present(default_energy_step)) fdefault = default_energy_step
280 call parse_variable(namespace,
'PropagationSpectrumEnergyStep', fdefault, spectrum%energy_step,
units_inp%energy)
304 if (
present(default_max_energy)) fdefault = default_max_energy
305 call parse_variable(namespace,
'PropagationSpectrumMaxEnergy', fdefault, spectrum%max_energy,
units_inp%energy)
331 call parse_variable(namespace,
'PropagationSpectrumSigmaDiagonalization', .false., spectrum%sigma_diag)
344 integer,
intent(in) :: out_file
345 integer,
intent(in) :: in_file(:)
347 integer :: nspin, energy_steps, ie, is, equiv_axes, n_files, trash
348 real(real64),
allocatable ::
sigma(:, :, :, :), sigmap(:, :, :, :), sigmau(:, :, :), &
349 sigmav(:, :, :), sigmaw(:, :, :), ip(:, :)
350 real(real64) :: dw, dump
355 n_files =
size(in_file)
356 equiv_axes = 3 - n_files + 1
362 safe_allocate(
sigma(1:3, 1:3, 1:energy_steps, 1:nspin))
363 safe_allocate(sigmap(1:3, 1:3, 1:energy_steps, 1:nspin))
364 safe_allocate(sigmau(1:3, 1:energy_steps, 1:nspin))
365 safe_allocate(sigmav(1:3, 1:energy_steps, 1:nspin))
366 safe_allocate(sigmaw(1:3, 1:energy_steps, 1:nspin))
367 safe_allocate( ip(1:3, 1:3))
369 select case (equiv_axes)
373 do ie = 1, energy_steps
374 read(in_file(1), *) dump, (sigmau(1:3, ie, is), is = 1, nspin)
379 do ie = 1, energy_steps
380 sigmap(1, 1, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 1))
381 sigmap(1, 2, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 2))
382 sigmap(1, 3, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 3))
387 sigmap(2, 2, :, :) = sigmap(1, 1, :, :)
388 sigmap(3, 3, :, :) = sigmap(1, 1, :, :)
391 sigmap(2, 1, :, :) = sigmap(1, 2, :, :)
392 sigmap(3, 1, :, :) = sigmap(1, 3, :, :)
396 do ie = 1, energy_steps
397 sigmap(2, 3, ie, is) = sum(sigmau(1:3, ie, is) * kick%wprime(1:3))
398 sigmap(3, 2, ie, is) = sigmap(2, 3, ie, is)
407 do ie = 1, energy_steps
408 read(in_file(1), *) dump, (sigmau(1:3, ie, is), is = 1, nspin)
409 read(in_file(2), *) dump, (sigmaw(1:3, ie, is), is = 1, nspin)
414 do ie = 1, energy_steps
415 sigmap(1, 1, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 1))
416 sigmap(1, 2, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 2))
417 sigmap(1, 3, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 3))
423 do ie = 1, energy_steps
424 sigmap(3, 1, ie, is) = sum(sigmaw(1:3, ie, is) * kick%pol(1:3, 1))
425 sigmap(3, 2, ie, is) = sum(sigmaw(1:3, ie, is) * kick%pol(1:3, 2))
426 sigmap(3, 3, ie, is) = sum(sigmaw(1:3, ie, is) * kick%pol(1:3, 3))
431 sigmap(2, 2, :, :) = sigmap(1, 1, :, :)
434 sigmap(2, 1, :, :) = sigmap(1, 2, :, :)
435 sigmap(2, 3, :, :) = sigmap(3, 2, :, :)
444 do ie = 1, energy_steps
445 read(in_file(1), *) dump, (sigmau(1:3, ie, is), is = 1, nspin)
446 read(in_file(2), *) dump, (sigmav(1:3, ie, is), is = 1, nspin)
447 read(in_file(3), *) dump, (sigmaw(1:3, ie, is), is = 1, nspin)
451 do ie = 1, energy_steps
452 sigmap(1, 1, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 1))
453 sigmap(1, 2, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 2))
454 sigmap(1, 3, ie, is) = sum(sigmau(1:3, ie, is) * kick%pol(1:3, 3))
458 do ie = 1, energy_steps
459 sigmap(2, 1, ie, is) = sum(sigmav(1:3, ie, is) * kick%pol(1:3, 1))
460 sigmap(2, 2, ie, is) = sum(sigmav(1:3, ie, is) * kick%pol(1:3, 2))
461 sigmap(2, 3, ie, is) = sum(sigmav(1:3, ie, is) * kick%pol(1:3, 3))
465 do ie = 1, energy_steps
466 sigmap(3, 1, ie, is) = sum(sigmaw(1:3, ie, is) * kick%pol(1:3, 1))
467 sigmap(3, 2, ie, is) = sum(sigmaw(1:3, ie, is) * kick%pol(1:3, 2))
468 sigmap(3, 3, ie, is) = sum(sigmaw(1:3, ie, is) * kick%pol(1:3, 3))
475 ip(1:3, 1:3) = kick%pol(1:3, 1:3)
478 do ie = 1, energy_steps
479 sigma(:, :, ie, is) = matmul(transpose(ip), matmul(sigmap(:, :, ie, is), ip))
485 spectrum%min_energy, energy_steps, kick)
488 if (spectrum%sigma_diag)
then
492 safe_deallocate_a(
sigma)
493 safe_deallocate_a(sigmap)
494 safe_deallocate_a(sigmau)
495 safe_deallocate_a(sigmav)
496 safe_deallocate_a(sigmaw)
497 safe_deallocate_a(ip)
505 integer,
intent(in) :: out_file
506 real(real64),
intent(in) ::
sigma(:, :, :, :)
507 integer,
intent(in) :: nspin
508 real(real64),
intent(in) :: energy_step, min_energy
509 integer,
intent(in) :: energy_steps
510 type(
kick_t),
optional,
intent(in) :: kick
512 integer :: is, idir, jdir, ie, ii
513 real(real64) :: average, anisotropy
514 real(real64),
allocatable :: pp(:,:), pp2(:,:), ip(:,:)
515 logical :: spins_singlet, spins_triplet
516 character(len=20) :: header_string
520 spins_singlet = .
true.
521 spins_triplet = .false.
522 if (
present(kick))
then
523 write(out_file,
'(a15,i2)')
'# nspin ', nspin
527 spins_triplet = .
true.
528 spins_singlet = .false.
530 spins_triplet = .
true.
534 write(out_file,
'(a1, a20)', advance =
'no')
'#',
str_center(
"Energy", 20)
535 write(out_file,
'(a20)', advance =
'no')
str_center(
"(1/3)*Tr[sigma]", 20)
536 write(out_file,
'(a20)', advance =
'no')
str_center(
"Anisotropy[sigma]", 20)
537 if (spins_triplet .and. spins_singlet)
then
538 write(out_file,
'(a20)', advance =
'no')
str_center(
"(1/3)*Tr[sigma-]", 20)
543 write(header_string,
'(a6,i1,a1,i1,a1,i1,a1)')
'sigma(', idir,
',', jdir,
',', is,
')'
544 write(out_file,
'(a20)', advance =
'no')
str_center(trim(header_string), 20)
548 write(out_file,
'(1x)')
550 if (spins_triplet .and. spins_singlet)
then
553 do ii = 1, 2 + nspin * 9
556 write(out_file,
'(1x)')
571 safe_allocate(pp(1:3, 1:3))
572 if (spins_triplet .and. spins_singlet)
then
573 safe_allocate(pp2(1:3, 1:3))
575 safe_allocate(ip(1:3, 1:3))
577 do ie = 1, energy_steps
579 pp(:, :) =
sigma(:, :, ie, 1)
581 if (spins_singlet .and. spins_triplet)
then
582 pp2(:, :) = pp(:, :) -
sigma(:, :, ie, 2)
583 pp(:, :) = pp(:, :) +
sigma(:, :, ie, 2)
584 elseif (spins_triplet .and. .not. spins_singlet)
then
585 pp(:, :) = pp(:, :) -
sigma(:, :, ie, 2)
586 elseif (spins_singlet .and. .not. spins_triplet)
then
587 pp(:, :) = pp(:, :) +
sigma(:, :, ie, 2)
591 average =
m_third * (pp(1, 1) + pp(2, 2) + pp(3, 3))
600 if (spins_singlet .and. spins_triplet)
then
601 average =
m_third * (pp2(1, 1) + pp2(2, 2) + pp2(3, 3))
602 write(out_file,
'(1e20.8)', advance =
'no') average
606 write(out_file,
'(9e20.8)', advance =
'no')
sigma(1:3, 1:3, ie, is)
608 write(out_file,
'(1x)')
611 safe_deallocate_a(pp)
612 if (spins_triplet .and. spins_singlet)
then
613 safe_deallocate_a(pp2)
615 safe_deallocate_a(ip)
624 integer,
intent(in) :: in_file
625 integer,
intent(in) :: out_file
626 integer,
optional,
intent(in) :: ref_file
628 character(len=20) :: header_string
629 integer :: nspin, ref_nspin, lmax, ref_lmax, time_steps, &
630 ref_time_steps, istart, iend, ntiter, it, ii, isp, no_e, ie, idir
631 real(real64) :: dt, ref_dt, energy, ewsum, polsum
632 type(
kick_t) :: kick, ref_kick
633 real(real64),
allocatable :: dipole(:, :, :), ref_dipole(:, :, :), sigma(:, :, :), sf(:, :)
635 type(
batch_t) :: dipoleb, sigmab
643 call spectrum_mult_info(namespace, in_file, nspin, kick, time_steps, dt, file_units, lmax=lmax)
645 if (
present(ref_file))
then
647 ref_time_steps, ref_dt, ref_file_units, lmax = ref_lmax)
648 if ((nspin /= ref_nspin) .or. &
649 (time_steps /= ref_time_steps) .or. &
650 (.not.(abs(dt-ref_dt)< 1e-10_real64)) .or. &
651 (lmax /= ref_lmax))
then
652 write(
message(1),
'(a)')
'The multipoles and reference multipoles files do not match.'
659 message(1) =
'Multipoles file should contain the dipole -- and only the dipole.'
664 message(1) =
"Kick function must have been dipole to run this utility."
668 if (kick%pol_dir < 1)
then
669 message(1) =
"Kick polarization direction is not set. Probably no kick was used."
676 safe_allocate(dipole(0:time_steps, 1:3, 1:nspin))
679 if (
present(ref_file))
then
680 safe_allocate(ref_dipole(0:time_steps, 1:3, 1:nspin))
693 if (
present(ref_file))
then
694 dipole = dipole - ref_dipole
696 do it = 1, time_steps
697 dipole(it, :, :) = dipole(it, :, :) - dipole(0, :, :)
702 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt*time_steps)
706 safe_allocate(sigma(1:no_e, 1:3, 1:nspin))
716 write(out_file,
'(a59)')
"# Cross-section spectrum contains full local field effects."
723 call spectrum_signal_damp(spectrum%damp, spectrum%damp_factor, istart + 1, iend + 1, kick%time, dt, dipoleb)
725 istart + 1, iend + 1, kick%time, dt, dipoleb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, sigmab)
732 if (pcm%run_pcm)
then
737 safe_deallocate_a(dipole)
738 if (
present(ref_file))
then
739 safe_deallocate_a(ref_dipole)
742 safe_allocate(sf(1:no_e, nspin))
744 if (abs(kick%delta_strength) < 1e-12_real64) kick%delta_strength =
m_one
746 energy = (ie-1) * spectrum%energy_step + spectrum%min_energy
748 sf(ie, isp) = sum(sigma(ie, 1:3, isp)*kick%pol(1:3, kick%pol_dir))
750 sf(ie, 1:nspin) = -sf(ie, 1:nspin) * (energy *
m_two) / (
m_pi * kick%delta_strength)
751 sigma(ie, 1:3, 1:nspin) = -sigma(ie, 1:3, 1:nspin)*(
m_four*
m_pi*energy/
p_c)/kick%delta_strength
756 ewsum = sum(sf(1, 1:nspin))
760 energy = (ie-1) * spectrum%energy_step + spectrum%min_energy
761 ewsum = ewsum + sum(sf(ie, 1:nspin))
762 polsum = polsum + sum(sf(ie, 1:nspin)) / energy**2
765 ewsum = ewsum * spectrum%energy_step
766 polsum = polsum * spectrum%energy_step
769 write(out_file,
'(a15,i2)')
'# nspin ', nspin
771 write(out_file,
'(a)')
'#%'
772 write(out_file,
'(a,i8)')
'# Number of time steps = ', time_steps
774 write(out_file,
'(a)')
'#%'
776 write(out_file,
'(a,f16.6)')
'# Electronic sum rule = ', ewsum
777 write(out_file,
'(a,f16.6,1x,a)')
'# Static polarizability (from sum rule) = ', &
779 write(out_file,
'(a)')
'#%'
782 write(out_file,
'(a1,a20)', advance =
'no')
'#',
str_center(
"Energy", 20)
785 write(header_string,
'(a6,i1,a8,i1,a1)')
'sigma(', idir,
', nspin=', isp,
')'
786 write(out_file,
'(a20)', advance =
'no')
str_center(trim(header_string), 20)
790 write(header_string,
'(a18,i1,a1)')
'StrengthFunction(', isp,
')'
791 write(out_file,
'(a20)', advance =
'no')
str_center(trim(header_string), 20)
793 write(out_file,
'(1x)')
801 write(out_file,
'(1x)')
805 (ie-1) * spectrum%energy_step + spectrum%min_energy)
813 write(out_file,
'(1x)')
816 safe_deallocate_a(sigma)
824 integer,
intent(in) :: in_file
825 real(real64),
intent(out) :: dipole(0:, :, :)
827 integer :: nspin, lmax, time_steps, trash, it, idir, ispin
828 real(real64) :: dt, dump
836 call spectrum_mult_info(namespace, in_file, nspin, kick, time_steps, dt, file_units, lmax = lmax)
841 do it = 0, time_steps
843 read(in_file, *) trash, dump, (dump, (dipole(it, idir, ispin), idir = 1, kick%dim), ispin = 1, nspin)
855 real(real64),
intent(inout) :: dipole(0:, :, :)
856 integer,
intent(in) :: time_steps
857 integer,
intent(in) :: nspin
860 real(real64) :: dipole_pcm(1:3)
864 integer :: asc_unit_test
865 integer :: cavity_unit
866 integer :: asc_vs_t_unit, asc_vs_t_unit_check
867 integer :: dipole_vs_t_unit_check, dipole_vs_t_unit_check1
870 real(real64) :: aux_float, aux_float1, aux_vec(1:3)
871 character(len=23) :: asc_vs_t_unit_format
872 character(len=16) :: asc_vs_t_unit_format_tail
879 asc_unit_test =
io_open(
pcm_dir//
'ASC_e.dat', namespace, action=
'read')
882 do while(iocheck >= 0)
883 read(asc_unit_test,*,iostat=iocheck) aux_vec(1:3), aux_float, aux_int
884 if (iocheck >= 0) pcm%n_tesserae = pcm%n_tesserae + 1
889 safe_allocate(pcm%tess(1:pcm%n_tesserae))
890 safe_allocate(pcm%q_e(1:pcm%n_tesserae))
891 safe_allocate(pcm%q_e_in(1:pcm%n_tesserae))
895 asc_unit_test =
io_open(
pcm_dir//
'ASC_e.dat', namespace, action=
'read')
896 cavity_unit =
io_open(
pcm_dir//
'cavity_check.xyz', namespace, action=
'write')
897 write(cavity_unit,
'(I3)') pcm%n_tesserae
899 do ia = 1, pcm%n_tesserae
900 read(asc_unit_test,*) pcm%tess(ia)%point(1:3), aux_float, aux_int
901 write(cavity_unit,
'(A1,3(1X,F14.8))')
'H', pcm%tess(ia)%point(1:3)
906 write (asc_vs_t_unit_format_tail,
'(I5,A11)') pcm%n_tesserae,
'(1X,F14.8))'
907 write (asc_vs_t_unit_format,
'(A)')
'(F14.8,'//trim(adjustl(asc_vs_t_unit_format_tail))
916 asc_vs_t_unit =
io_open(
pcm_dir//
'ASC_e_vs_t.dat', namespace, action=
'read', form=
'formatted')
917 asc_vs_t_unit_check =
io_open(
pcm_dir//
'ASC_e_vs_t_check.dat', namespace, action=
'write', form=
'formatted')
920 dipole_vs_t_unit_check =
io_open(
pcm_dir//
'dipole_e_vs_t_check.dat', namespace, action=
'write', form=
'formatted')
921 dipole_vs_t_unit_check1 =
io_open(
pcm_dir//
'dipole_e_vs_t_check1.dat', namespace, action=
'write', form=
'formatted')
924 read(asc_vs_t_unit,trim(adjustl(asc_vs_t_unit_format))) aux_float1, ( pcm%q_e_in(ia) , ia=1,pcm%n_tesserae)
926 do it = 1, time_steps
929 read(asc_vs_t_unit,trim(adjustl(asc_vs_t_unit_format))) aux_float, ( pcm%q_e(ia) , ia=1,pcm%n_tesserae)
932 call pcm_dipole(dipole_pcm(1:3), -pcm%q_e(1:pcm%n_tesserae), pcm%tess, pcm%n_tesserae)
935 dipole(it, 1, 1:nspin) = dipole(it, 1, 1:nspin) + dipole_pcm(1)
936 dipole(it, 2, 1:nspin) = dipole(it, 2, 1:nspin) + dipole_pcm(2)
937 dipole(it, 3, 1:nspin) = dipole(it, 3, 1:nspin) + dipole_pcm(3)
943 dipole(0, 1, 1:nspin) = dipole(1, 1, 1:nspin)
944 dipole(0, 2, 1:nspin) = dipole(1, 2, 1:nspin)
945 dipole(0, 3, 1:nspin) = dipole(1, 3, 1:nspin)
949 write(asc_vs_t_unit_check,trim(adjustl(asc_vs_t_unit_format))) aux_float, (pcm%q_e(ia), ia=1,pcm%n_tesserae)
950 write(dipole_vs_t_unit_check,
'(F14.8,3(1X,F14.8))') aux_float, dipole_pcm
951 write(dipole_vs_t_unit_check1,
'(F14.8,3(1X,F14.8))') aux_float, dipole(it,:,1)
958 call io_close(dipole_vs_t_unit_check)
959 call io_close(dipole_vs_t_unit_check1)
962 safe_deallocate_a(pcm%tess)
963 safe_deallocate_a(pcm%q_e)
964 safe_deallocate_a(pcm%q_e_in)
975 real(real64),
allocatable,
intent(inout) :: sigma(:, :, :)
976 real(real64),
allocatable,
intent(in) :: dipole(:, :, :)
977 integer,
intent(in) :: nspin
978 real(real64),
intent(in) :: kick_time
979 integer,
intent(in) :: istart, iend
980 real(real64),
intent(in) :: dt
981 integer,
intent(in) :: no_e
983 real(real64),
allocatable :: sigmap(:, :, :)
984 type(
batch_t) :: dipoleb, sigmab
988 complex(real64),
allocatable :: eps(:)
997 call spectrum_signal_damp(spectrum%damp, spectrum%damp_factor, istart + 1, iend + 1, kick_time, dt, dipoleb)
999 istart + 1, iend + 1, kick_time, dt, dipoleb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, sigmab)
1006 safe_allocate(sigmap(1:no_e, 1:3, 1:nspin))
1008 call batch_init(dipoleb, 3, 1, nspin, dipole)
1011 call spectrum_signal_damp(spectrum%damp, spectrum%damp_factor, istart + 1, iend + 1, kick_time, dt, dipoleb)
1013 istart + 1, iend + 1, kick_time, dt, dipoleb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, sigmab)
1018 safe_allocate(eps(1:no_e))
1023 call pcm_eps(pcm, eps(ie), (ie-1)*spectrum%energy_step + spectrum%min_energy)
1024 sigma(ie, 1:3, 1:nspin) = sigma(ie, 1:3, 1:nspin) * real(eps(ie), real64) + sigmap(ie, 1:3, 1:nspin) *aimag(eps(ie))
1027 safe_deallocate_a(sigmap)
1028 safe_deallocate_a(eps)
1039 real(real64),
allocatable,
intent(inout) :: sigma(:, :, :)
1040 integer,
intent(in) :: nspin
1041 integer,
intent(in) :: no_e
1045 complex(real64),
allocatable :: eps(:)
1049 safe_allocate(eps(1:no_e))
1054 call pcm_eps(pcm, eps(ie), (ie-1)*spectrum%energy_step + spectrum%min_energy)
1055 sigma(ie, 1:3, 1:nspin) = sigma(ie, 1:3, 1:nspin) /
sqrt(0.5_real64 * (abs(eps(ie)) + real(eps(ie), real64)))
1058 safe_deallocate_a(eps)
1068 integer,
intent(in) :: in_file
1069 integer,
intent(in) :: out_file
1071 character(len=20) :: header_string
1072 integer :: nspin, lmax, time_steps, istart, iend, ntiter, it, ii, isp, no_e, ie, idir
1074 real(real64),
allocatable :: dipole(:, :, :), transform_cos(:, :, :), transform_sin(:, :, :), power(:, :, :)
1076 type(
batch_t) :: dipoleb, transformb_cos, transformb_sin
1083 call spectrum_mult_info(namespace, in_file, nspin, kick, time_steps, dt, file_units, lmax=lmax)
1087 message(1) =
'Multipoles file should contain the dipole -- and only the dipole.'
1094 safe_allocate(dipole(0:time_steps, 1:3, 1:nspin))
1098 do it = 1, time_steps
1099 dipole(it, :, :) = dipole(it, :, :) - dipole(0, :, :)
1103 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt*time_steps)
1107 safe_allocate(transform_cos(1:no_e, 1:3, 1:nspin))
1108 safe_allocate(transform_sin(1:no_e, 1:3, 1:nspin))
1109 safe_allocate(power(1:no_e, 1:3, 1:nspin))
1112 call batch_init(dipoleb, 3, 1, nspin, dipole)
1113 call batch_init(transformb_cos, 3, 1, nspin, transform_cos)
1114 call batch_init(transformb_sin, 3, 1, nspin, transform_sin)
1116 call spectrum_signal_damp(spectrum%damp, spectrum%damp_factor, istart + 1, iend + 1, spectrum%start_time, dt, dipoleb)
1119 istart + 1, iend + 1, spectrum%start_time, dt, dipoleb, spectrum%min_energy, &
1120 spectrum%max_energy, spectrum%energy_step, transformb_cos)
1122 istart + 1, iend + 1, spectrum%start_time, dt, dipoleb, spectrum%min_energy, &
1123 spectrum%max_energy, spectrum%energy_step, transformb_sin)
1126 power(ie, :, :) = (transform_sin(ie, :, :)**2 + transform_cos(ie, :, :)**2)
1130 call transformb_cos%end()
1131 call transformb_sin%end()
1133 safe_deallocate_a(dipole)
1134 safe_deallocate_a(transform_sin)
1135 safe_deallocate_a(transform_cos)
1137 write(out_file,
'(a15,i2)')
'# nspin ', nspin
1138 write(out_file,
'(a)')
'#%'
1139 write(out_file,
'(a,i8)')
'# Number of time steps = ', time_steps
1141 write(out_file,
'(a)')
'#%'
1143 write(out_file,
'(a1,a20,1x)', advance =
'no')
'#',
str_center(
"Energy", 20)
1146 write(header_string,
'(a6,i1,a8,i1,a1)')
'power(', idir,
', nspin=', isp,
')'
1147 write(out_file,
'(a20)', advance =
'no')
str_center(trim(header_string), 20)
1150 write(out_file,
'(1x)')
1152 do ii = 1, nspin * 3
1155 write(out_file,
'(1x)')
1159 (ie-1) * spectrum%energy_step + spectrum%min_energy)
1164 write(out_file,
'(1x)')
1167 safe_deallocate_a(power)
1176 integer,
intent(in) :: in_file_sin, in_file_cos
1177 integer,
intent(in) :: out_file
1179 character(len=20) :: header_string
1180 integer :: time_steps, time_steps_sin, time_steps_cos
1181 integer :: istart, iend, ntiter, it, jj, ii, no_e, ie, trash
1182 real(real64) :: dt, dt_sin, dt_cos
1183 real(real64) :: dump, dummy1, dummy2, dummy3, dummy4, energy, fsum
1185 complex(real64) :: xx
1186 complex(real64),
allocatable :: ftchd(:), chi(:), damp(:)
1188 character(len=100) :: line
1192 safe_allocate(kick%qvector(1:3, 1:1))
1199 read(in_file_sin, *)
1200 read(in_file_sin, *)
1201 read(in_file_sin,
'(15x,i2)') kick%qkick_mode
1202 read(in_file_sin,
'(10x,3f9.5)') kick%qvector
1203 read(in_file_sin,
'(15x,f18.12)') kick%delta_strength
1206 read(in_file_sin, *)
1207 read(in_file_sin,
'(a)') line
1212 ii = index(line,
'eV')
1223 if (.not.
is_close(dt_sin, dt_cos))
then
1224 message(1) =
"dt is different in ftchds.cos and ftchds.sin!"
1228 time_steps = min(time_steps_sin, time_steps_cos)
1238 safe_allocate(ftchd(0:time_steps))
1239 do it = 0, time_steps
1240 read(in_file_sin, *) trash, dump, dummy1, dummy2
1241 read(in_file_cos, *) trash, dump, dummy3, dummy4
1242 ftchd(it) = cmplx(dummy3-dummy2, dummy4+dummy1, real64)
1246 do it = 1, time_steps
1247 ftchd(it) = ftchd(it) - ftchd(0)
1251 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt*time_steps)
1256 safe_allocate(chi(1:no_e))
1260 safe_allocate(damp(istart:iend))
1261 do it = istart, iend
1263 select case (spectrum%damp)
1264 case (spectrum_damp_none)
1267 damp(it)=
exp(-jj * dt * spectrum%damp_factor)
1269 damp(it) =
m_one -
m_three * (real(jj, real64) / ntiter)**2 &
1270 +
m_two * (real(jj, real64) / ntiter)**3
1272 damp(it)=
exp(-(jj * dt)**2 * spectrum%damp_factor**2)
1277 if (abs(kick%delta_strength) < 1.d-12) kick%delta_strength =
m_one
1279 energy = (ie-1) * spectrum%energy_step + spectrum%min_energy
1280 do it = istart, iend
1283 xx =
exp(
m_zi * energy * jj * dt)
1284 chi(ie) = chi(ie) + xx * damp(it) * ftchd(it)
1287 chi(ie) = chi(ie) * dt / kick%delta_strength /
m_pi
1293 energy = (ie-1) * spectrum%energy_step + spectrum%min_energy
1294 fsum = fsum + energy * aimag(chi(ie))
1296 fsum = spectrum%energy_step * fsum * 2/sum(kick%qvector(:,1)**2)
1298 write(out_file,
'(a)')
'#%'
1299 write(out_file,
'(a,i8)')
'# Number of time steps = ', time_steps
1301 write(out_file,
'(a,3f9.5)')
'# qvector : ', kick%qvector
1302 write(out_file,
'(a,f10.4)')
'# F-sum rule : ', fsum
1303 write(out_file,
'(a)')
'#%'
1305 write(out_file,
'(a1,a20)', advance =
'no')
'#',
str_center(
"Energy", 20)
1306 write(header_string,
'(a3)')
'chi'
1307 write(out_file,
'(a20)', advance =
'no')
str_center(trim(header_string), 20)
1308 write(out_file,
'(1x)')
1311 write(out_file,
'(1x)')
1315 (ie-1) * spectrum%energy_step + spectrum%min_energy)
1317 write(out_file,
'(1x)')
1320 safe_deallocate_a(ftchd)
1321 safe_deallocate_a(chi)
1331 integer,
intent(in) :: in_file
1332 integer,
intent(in) :: out_file
1334 integer :: istart, iend, ntiter, ie, idir, time_steps, no_e, nspin, trash, it
1335 real(real64) :: dump, dt, energy
1337 complex(real64) :: sum1, sum2, sp
1338 real(real64),
allocatable :: angular(:, :), resp(:), imsp(:)
1339 type(
batch_t) :: angularb, respb, imspb
1347 if (kick%dim /= 3)
then
1348 message(1) =
"Rotatory strength can only be computed for 3D systems."
1353 safe_allocate(angular(0:time_steps, 1:3))
1355 do ie = 0, time_steps
1356 read(in_file, *) trash, dump, (angular(ie, idir), idir = 1, 3)
1361 angular(:, idir) = angular(:, idir) - angular(0, idir)
1364 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt*time_steps)
1368 do it = istart, iend
1369 angular(it, 1) = sum(angular(it, 1:3)*kick%pol(1:3, kick%pol_dir))
1372 safe_allocate(resp(1:no_e))
1373 safe_allocate(imsp(1:no_e))
1379 call spectrum_signal_damp(spectrum%damp, spectrum%damp_factor, istart + 1, iend + 1, kick%time, dt, angularb)
1382 istart + 1, iend + 1, kick%time, dt, angularb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, respb)
1384 istart + 1, iend + 1, kick%time, dt, angularb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, imspb)
1392 if (abs(kick%delta_strength) < 1.d-12) kick%delta_strength =
m_one
1394 energy = (ie-1) * spectrum%energy_step + spectrum%min_energy
1396 sp = cmplx(resp(ie), imsp(ie), real64)
1400 sum1 = sum1 + spectrum%energy_step*sp
1401 sum2 = sum2 + spectrum%energy_step*sp*energy**2
1403 resp(ie) = real(sp, real64)
1404 imsp(ie) = aimag(sp)
1407 safe_deallocate_a(angular)
1410 write(
message(1),
'(a,i8)')
'Number of time steps = ', ntiter
1411 write(
message(2),
'(a,i4)')
'PropagationSpectrumDampMode = ', spectrum%damp
1418 write(
message(9),
'(a,5e15.6,5e15.6)')
'R(0) sum rule = ', sum1
1419 write(
message(10),
'(a,5e15.6,5e15.6)')
'R(2) sum rule = ', sum2
1424 write(out_file,
'(a15,i2)')
'# nspin ', nspin
1426 write(out_file,
'(a1,a20,a20,a20)')
'#',
str_center(
"Energy", 20),
str_center(
"R", 20),
str_center(
"Re[beta]", 20)
1430 write(out_file,
'(a,5e15.6,5e15.6)')
'# R(0) sum rule = ', sum1
1431 write(out_file,
'(a,5e15.6,5e15.6)')
'# R(2) sum rule = ', sum2
1433 write(out_file,
'(e20.8,e20.8,e20.8)')
units_from_atomic(
units_out%energy, (ie-1)*spectrum%energy_step+spectrum%min_energy), &
1438 safe_deallocate_a(resp)
1439 safe_deallocate_a(imsp)
1448 real(real64),
intent(in) :: dt
1449 integer,
intent(in) :: is, ie, niter
1450 complex(real64),
intent(in) :: acc(:)
1452 integer :: nn(3), j, optimize_parity(3)
1461 energy_step_ = (
m_two *
m_pi) / (niter * time_step_)
1462 safe_allocate(func_(0:niter))
1463 safe_allocate(funcw_(0:niter))
1466 nn(1:3) = (/ niter, 1, 1 /)
1468 optimize_parity(1:3) = -1
1471 call zfft_forward(fft_handler, func_(0:niter-1), funcw_(0:niter-1))
1473 funcw_(j) = -abs(funcw_(j))**2 * dt**2
1488 safe_deallocate_a(func_)
1489 safe_deallocate_a(funcw_)
1498 real(real64),
intent(in) :: aa, bb
1499 real(real64),
intent(out) :: omega_min, func_min
1502 real(real64) :: xx, hsval, minhsval, ww, xa, xb, hxa, hxb
1513 ie = int(aa/energy_step_)
1514 ww = ie * energy_step_
1517 ww = ie * energy_step_
1519 xx = ie * energy_step_
1520 minhsval = real(funcw_(ie), real64)
1522 hsval = real(funcw_(ie), real64)
1523 if (hsval < minhsval)
then
1528 ww = ie * energy_step_
1533 xa = max(xx-energy_step_, aa)
1534 xb = min(xx+energy_step_, bb)
1538 if (hxa <= minhsval)
then
1541 elseif (hxb <= minhsval)
then
1549 write(
message(1),
'(a,f14.6,a)')
'spectrum_hsfunction_min: The maximum at', xx,
' was not properly converged.'
1550 write(
message(2),
'(a,i12)')
'Error code: ', ierr
1564 real(real64),
intent(in) :: omega
1565 real(real64),
intent(out) :: power
1567 complex(real64) :: cc, ez1, ez, zz
1572 zz =
m_zi * omega * time_step_
1575 if (
allocated(func_ar_))
then
1578 ez1 =
exp((is_ - 1) * zz)
1584 cc = cc + ez1 * func_ar_(dir,jj) &
1585 *
exp(-
m_zi * omega * tret_(jj))
1587 power = power - abs(cc)**2 * time_step_**2
1593 ez1 =
exp((is_ - 1) * zz)
1596 cc = cc + ez1 * func_(jj)
1598 power = -abs(cc)**2 * time_step_**2
1608 real(real64),
intent(in) :: dt
1609 integer,
intent(in) :: is, ie, niter
1610 complex(real64),
intent(in) :: acc(:,:),pos(:,:),tret(:)
1617 safe_allocate(func_ar_(1:3, 0:niter))
1618 safe_allocate(pos_(1:3, 0:niter))
1619 safe_allocate(tret_(0:niter))
1636 safe_deallocate_a(func_ar_)
1637 safe_deallocate_a(pos_)
1638 safe_deallocate_a(tret_)
1648 character(len=*),
intent(in) :: out_file
1649 real(real64),
intent(in) :: vec(:)
1650 real(real64),
optional,
intent(in) :: w0
1652 integer :: istep, trash, iunit, nspin, time_steps, istart, iend, ntiter, lmax, ierr, jj, idir, ispin
1653 real(real64) :: dt, dump, aa(3)
1654 complex(real64) :: nn(3)
1656 real(real64),
allocatable :: dd(:,:)
1657 complex(real64),
allocatable :: acc(:,:),pp(:,:),pos(:,:),tret(:)
1658 real(real64) :: vv(3)
1667 safe_allocate(acc(1:3, 0:time_steps))
1668 safe_allocate(pp(1:3, 0:time_steps))
1669 safe_allocate(pos(1:3, 0:time_steps))
1670 safe_allocate(tret(0:time_steps))
1679 do istep = 0, time_steps-1
1681 read(iunit,
'(28x,e20.12)', advance =
'no', iostat = ierr) aa(1)
1683 do while((ierr == 0) .and. (jj <= 3))
1684 read(iunit,
'(e20.12)', advance =
'no', iostat = ierr) aa(jj)
1698 iunit =
io_open(
'multipoles', namespace, action=
'read', status=
'old', die=.false.)
1699 if (iunit == -1)
then
1700 iunit =
io_open(
'td.general/multipoles', namespace, action=
'read', status=
'old')
1708 safe_allocate(dd(1:3, 1:nspin))
1709 do istep = 0, time_steps-1
1711 read(iunit, *) trash, dump, (dump, (dd(idir, ispin), idir = 1, kick%dim), ispin = 1, nspin)
1712 pos(1:3, istep) = -sum(dd(1:3, :),2)
1715 safe_deallocate_a(dd)
1726 do istep = 0, time_steps - 1
1727 nn(:) = vv(:)-pos(:,istep)
1728 nn(:) = nn(:)/norm2(abs(nn(:)))
1729 tret(istep) = dot_product(vv(:), real(pos(:,istep), real64))/
p_c
1735 call spectrum_hs(spectrum, namespace, out_file,
'a', w0)
1738 safe_deallocate_a(acc)
1739 safe_deallocate_a(pp)
1740 safe_deallocate_a(pos)
1741 safe_deallocate_a(tret)
1752 character(len=*),
intent(in) :: out_file
1753 real(real64),
intent(in) :: vec(:)
1754 real(real64),
optional,
intent(in) :: w0
1756 integer :: istep, trash, iunit, nspin, time_steps, istart, iend, ntiter, lmax, idir, ispin
1757 real(real64) :: dt, dump
1759 real(real64),
allocatable :: dd(:,:)
1760 complex(real64),
allocatable :: dipole(:,:), ddipole(:,:), pp(:,:), tret(:)
1761 complex(real64) :: vv(3)
1767 iunit =
io_open(
'multipoles', namespace, action=
'read', status=
'old', die=.false.)
1768 if (iunit == -1)
then
1769 iunit =
io_open(
'td.general/multipoles', namespace, action=
'read', status=
'old')
1771 call spectrum_mult_info(namespace, iunit, nspin, kick, time_steps, dt, file_units, lmax=lmax)
1777 safe_allocate(dipole(1:3, 0:time_steps))
1778 safe_allocate(ddipole(1:3, 0:time_steps))
1779 safe_allocate(pp(1:3, 0:time_steps))
1780 safe_allocate(tret(0:time_steps))
1781 safe_allocate(dd(1:3, 1:nspin))
1788 do istep = 1, time_steps
1790 read(iunit, *) trash, dump, (dump, (dd(idir, ispin), idir = 1, kick%dim), ispin = 1, nspin)
1791 dipole(1:3, istep) = -sum(dd(1:3, :),2)
1794 safe_deallocate_a(dd)
1795 dipole(:,0) = dipole(:,1)
1800 do istep = 1, time_steps - 1
1801 ddipole(:,istep) = (dipole(:,istep - 1) + dipole(:,istep + 1) -
m_two * dipole(:,istep)) / dt**2
1804 ddipole(1,time_steps - 3:time_steps - 1), &
1806 ddipole(1,time_steps))
1808 ddipole(2,time_steps - 3:time_steps - 1), &
1810 ddipole(2,time_steps))
1812 ddipole(3,time_steps - 3:time_steps - 1), &
1814 ddipole(3,time_steps))
1817 vv(1:3) = vec(1:3) / norm2(vec(1:3))
1820 do istep = 1, time_steps - 1
1822 tret(istep) = dot_product(vv(:), dipole(:,istep))/
p_c
1831 call spectrum_hs(spectrum, namespace, out_file,
'a', w0)
1834 safe_deallocate_a(dipole)
1835 safe_deallocate_a(ddipole)
1836 safe_deallocate_a(pp)
1837 safe_deallocate_a(tret)
1849 character(len=*),
intent(in) :: out_file
1850 character,
intent(in) :: pol
1851 real(real64),
intent(in) :: vec(:)
1852 real(real64),
optional,
intent(in) :: w0
1854 integer :: istep, trash, iunit, nspin, time_steps, istart, iend, ntiter, lmax, no_e, ie, idir, ispin
1855 real(real64) :: dt, dump, vv(3)
1857 real(real64),
allocatable :: dd(:,:)
1858 real(real64),
allocatable :: sps(:), spc(:), racc(:)
1859 complex(real64),
allocatable :: dipole(:), ddipole(:)
1860 type(
batch_t) :: acc_batch, sps_batch, spc_batch
1865 iunit =
io_open(
'multipoles', namespace, action=
'read', status=
'old', die=.false.)
1866 if (iunit == -1)
then
1867 iunit =
io_open(
'td.general/multipoles', namespace, action=
'read', status=
'old')
1869 call spectrum_mult_info(namespace, iunit, nspin, kick, time_steps, dt, file_units, lmax=lmax)
1872 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt*time_steps)
1877 safe_allocate(dipole(0:time_steps))
1878 safe_allocate(ddipole(0:time_steps))
1879 safe_allocate(dd(1:3, 1:nspin))
1881 vv(1:3) = vec(1:3) / norm2(vec(1:3))
1883 do istep = 1, time_steps
1885 read(iunit, *) trash, dump, (dump, (dd(idir, ispin), idir = 1, kick%dim), ispin = 1, nspin)
1888 dipole(istep) = -sum(dd(1, :))
1890 dipole(istep) = -sum(dd(2, :))
1892 dipole(istep) = sum(dd(3, :))
1894 dipole(istep) = -sum(cmplx(dd(1, :), dd(2, :), real64)) /
sqrt(
m_two)
1896 dipole(istep) = -sum(cmplx(dd(1, :), -dd(2, :), real64)) /
sqrt(
m_two)
1898 dipole(istep) = -sum(vv(1)*dd(1, :) + vv(2)*dd(2, :) + vv(3)*dd(3, :))
1902 safe_deallocate_a(dd)
1903 dipole(0) = dipole(1)
1908 do istep = 1, time_steps - 1
1909 ddipole(istep) = (dipole(istep - 1) + dipole(istep + 1) -
m_two * dipole(istep)) / dt**2
1912 ddipole(time_steps - 3:time_steps - 1), &
1914 ddipole(time_steps))
1916 if (
present(w0))
then
1919 call spectrum_hs(spectrum, namespace, out_file, pol, w0)
1924 safe_allocate(racc(0:time_steps))
1925 racc = real(ddipole, real64)
1928 safe_allocate(sps(1:no_e))
1929 safe_allocate(spc(1:no_e))
1938 istart + 1, iend + 1,
m_zero, dt, acc_batch, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, spc_batch)
1940 istart + 1, iend + 1,
m_zero, dt, acc_batch, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, sps_batch)
1943 sps(ie) = (sps(ie)**2 + spc(ie)**2)
1948 call acc_batch%end()
1949 call sps_batch%end()
1950 call spc_batch%end()
1952 safe_deallocate_a(racc)
1956 safe_deallocate_a(dipole)
1957 safe_deallocate_a(ddipole)
1968 character(len=*),
intent(in) :: out_file
1969 character,
intent(in) :: pol
1970 real(real64),
intent(in) :: vec(:)
1971 real(real64),
optional,
intent(in) :: w0
1973 integer :: istep, jj, iunit, time_steps, istart, iend, ntiter, ierr, no_e, ie
1974 real(real64) :: dt, aa(3), vv(3)
1975 complex(real64),
allocatable :: acc(:)
1976 real(real64),
allocatable :: racc(:), sps(:), spc(:)
1977 type(
batch_t) :: acc_batch, sps_batch, spc_batch
1984 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt*time_steps)
1987 safe_allocate(acc(0:time_steps))
1989 vv = vec / norm2(vec(:))
1992 do istep = 1, time_steps
1994 read(iunit,
'(28x,e20.12)', advance =
'no', iostat = ierr) aa(1)
1996 do while((ierr == 0) .and. (jj <= 3))
1997 read(iunit,
'(e20.12)', advance =
'no', iostat = ierr) aa(jj)
2008 acc(istep) = cmplx(aa(1), aa(2), real64) /
sqrt(
m_two)
2010 acc(istep) = cmplx(aa(1), -aa(2), real64) /
sqrt(
m_two)
2012 acc(istep) = vv(1)*aa(1) + vv(2)*aa(2) + vv(3)*aa(3)
2018 if (
present(w0))
then
2021 call spectrum_hs(spectrum, namespace, out_file, pol, w0)
2026 safe_allocate(racc(0:time_steps))
2027 racc = real(acc, real64)
2030 safe_allocate(sps(1:no_e))
2031 safe_allocate(spc(1:no_e))
2040 istart + 1, iend + 1,
m_zero, dt, acc_batch, spectrum%min_energy, &
2041 spectrum%max_energy, spectrum%energy_step, spc_batch)
2043 istart + 1, iend + 1,
m_zero, dt, acc_batch, spectrum%min_energy, &
2044 spectrum%max_energy, spectrum%energy_step, sps_batch)
2047 sps(ie) = (sps(ie)**2 + spc(ie)**2)
2052 call acc_batch%end()
2053 call sps_batch%end()
2054 call spc_batch%end()
2056 safe_deallocate_a(racc)
2060 safe_deallocate_a(acc)
2069 character(len=*),
intent(in) :: out_file
2070 character,
intent(in) :: pol
2071 real(real64),
intent(in) :: vec(:)
2072 real(real64),
optional,
intent(in) :: w0
2074 integer :: istep, jj, iunit, time_steps, istart, iend, ntiter, ierr, no_e, ie
2075 real(real64) :: dt, cc(3), vv(3)
2076 complex(real64),
allocatable :: cur(:)
2077 real(real64),
allocatable :: rcur(:), sps(:), spc(:)
2078 type(
batch_t) :: cur_batch, sps_batch, spc_batch
2085 if (spectrum%energy_step <=
m_zero) spectrum%energy_step =
m_two *
m_pi / (dt * time_steps)
2088 safe_allocate(cur(0:time_steps))
2090 vv = vec / norm2(vec(:))
2093 do istep = 1, time_steps
2095 read(iunit,
'(28x,e20.12)', advance =
'no', iostat = ierr) cc(1)
2097 do while((ierr == 0) .and. (jj <= 3))
2098 read(iunit,
'(e20.12)', advance =
'no', iostat = ierr) cc(jj)
2109 cur(istep) = cmplx(cc(1), cc(2), real64) /
sqrt(
m_two)
2111 cur(istep) = cmplx(cc(1), -cc(2), real64) /
sqrt(
m_two)
2113 cur(istep) = vv(1)*cc(1) + vv(2)*cc(2) + vv(3)*cc(3)
2119 if (
present(w0))
then
2122 call spectrum_hs(spectrum, namespace, out_file, pol, w0)
2127 safe_allocate(rcur(0:time_steps))
2128 rcur = real(cur, real64)
2131 safe_allocate(sps(1:no_e))
2132 safe_allocate(spc(1:no_e))
2141 istart + 1, iend + 1,
m_zero, dt, cur_batch, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, spc_batch)
2143 istart + 1, iend + 1,
m_zero, dt, cur_batch, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, sps_batch)
2146 sps(ie) = (sps(ie)**2 + spc(ie)**2) * ((ie-1) * spectrum%energy_step + spectrum%min_energy)**2
2151 call cur_batch%end()
2152 call sps_batch%end()
2153 call spc_batch%end()
2155 safe_deallocate_a(rcur)
2159 safe_deallocate_a(cur)
2165 subroutine spectrum_hs(spectrum, namespace, out_file, pol, w0)
2168 character(len=*),
intent(in) :: out_file
2169 character,
intent(in) :: pol
2170 real(real64),
optional,
intent(in) :: w0
2172 integer :: iunit, no_e, ie
2173 real(real64) :: omega, hsval, xx
2174 real(real64),
allocatable :: sp(:)
2178 if (
present(w0))
then
2180 iunit =
io_open(trim(out_file) //
"." // trim(pol), namespace, action=
'write')
2182 write(iunit,
'(a1,a20,a20)')
'#', &
2189 do while(omega <= spectrum%max_energy)
2196 omega = omega + 2 * w0
2202 safe_allocate(sp(1:no_e))
2206 call hsfunction((ie-1) * spectrum%energy_step + spectrum%min_energy, sp(ie))
2212 safe_deallocate_a(sp)
2224 character(len=*),
intent(in) :: out_file
2225 character,
intent(in) :: pol
2226 integer,
intent(in) :: no_e
2227 real(real64),
intent(in) :: sp(:)
2229 integer :: iunit, ie
2234 if (trim(out_file) /=
'-')
then
2235 iunit =
io_open(trim(out_file) //
"." // trim(pol), namespace, action=
'write')
2238 write(iunit,
'(a1,a20,a20)') &
2256 subroutine spectrum_mult_info(namespace, iunit, nspin, kick, time_steps, dt, file_units, lmax)
2258 integer,
intent(in) :: iunit
2259 integer,
intent(out) :: nspin
2261 integer,
intent(out) :: time_steps
2262 real(real64),
intent(out) :: dt
2264 integer,
optional,
intent(out) :: lmax
2267 character(len=100) :: line
2277 if (
present(lmax))
then
2286 ii = index(line,
'eV')
2304 integer,
intent(in) :: iunit
2305 integer,
intent(out) :: time_steps
2306 real(real64),
intent(out) :: dt
2308 real(real64) :: t1, t2, dummy
2309 integer :: trash, ierr
2310 character(len=200) :: line
2312 push_sub(count_time_steps)
2319 read(iunit,
'(a)', iostat = ierr) line
2320 if (ierr == iostat_end)
exit
2322 message(1) =
"Could not read multipoles time-step data."
2325 if (len_trim(line) == 0 .or. line(1:1) ==
"#") cycle
2326 read(line, *, iostat = ierr) trash, dummy
2328 message(1) =
"Could not parse multipoles time-step line:"
2329 write(
message(2),
'(a)') trim(line)
2332 time_steps = time_steps + 1
2333 if (time_steps == 1) t1 = dummy
2334 if (time_steps == 2) t2 = dummy
2337 time_steps = time_steps - 1
2339 if (time_steps < 3)
then
2344 pop_sub(count_time_steps)
2352 integer,
intent(in) :: iunit
2353 integer,
intent(out) :: nspin
2354 type(
kick_t),
intent(out) :: kick
2355 integer,
intent(out) :: energy_steps
2356 real(real64),
intent(out) :: dw
2358 real(real64) :: dummy, e1, e2
2371 read(iunit, *,
end=100) dummy
2372 energy_steps = energy_steps + 1
2373 if (energy_steps == 1) e1 = dummy
2374 if (energy_steps == 2) e2 = dummy
2379 if (energy_steps < 3)
then
2380 message(1) =
"Empty multipole file?"
2390 type(namespace_t),
intent(in) :: namespace
2391 character(len=*),
intent(in) :: fname
2392 integer,
intent(out) :: iunit, time_steps
2393 real(real64),
intent(out) :: dt
2396 real(real64) :: t1, t2, dummy
2397 character(len=256) :: filename
2402 filename = trim(
'td.general/')//trim(fname)
2403 iunit = io_open(filename, namespace, action=
'read', status=
'old', die=.false.)
2405 if (iunit == -1)
then
2406 filename = trim(
'./')//trim(fname)
2407 iunit = io_open(filename, namespace, action=
'read', status=
'old')
2412 call io_skip_header(iunit)
2417 read(iunit, *,
end=100) trash, dummy
2418 time_steps = time_steps + 1
2419 if (time_steps == 1) t1 = dummy
2420 if (time_steps == 2) t2 = dummy
2423 dt = units_to_atomic(units_out%time, t2 - t1)
2424 time_steps = time_steps - 1
2426 if (time_steps < 3)
then
2427 message(1) =
"Empty file?"
2428 call messages_fatal(1, namespace=namespace)
2439 integer,
intent(in) :: time_steps
2440 real(real64),
intent(in) :: dt
2441 integer,
intent(out) :: istart, iend, ntiter
2443 real(real64) :: ts, te, dummy
2448 te = time_steps * dt
2450 if (spectrum%start_time < ts) spectrum%start_time = ts
2451 if (spectrum%start_time > te) spectrum%start_time = te
2452 if (spectrum%end_time > te .or. spectrum%end_time <= m_zero) spectrum%end_time = te
2453 if (spectrum%end_time < ts) spectrum%end_time = ts
2455 if (spectrum%end_time < spectrum%start_time)
then
2456 dummy = spectrum%end_time
2457 spectrum%end_time = spectrum%start_time
2458 spectrum%start_time = dummy
2460 istart = nint(spectrum%start_time / dt)
2461 iend = nint(spectrum%end_time / dt)
2462 ntiter = iend - istart + 1
2466 .and. is_close(spectrum%damp_factor, -m_one))
then
2467 select case (spectrum%damp)
2469 spectrum%damp_factor = -
log(0.0001_real64)/(spectrum%end_time-spectrum%start_time)
2471 spectrum%damp_factor =
sqrt(-
log(0.0001_real64)/(spectrum%end_time-spectrum%start_time)**2)
2481 subroutine spectrum_signal_damp(damp_type, damp_factor, time_start, time_end, t0, time_step, time_function)
2482 integer,
intent(in) :: damp_type
2483 real(real64),
intent(in) :: damp_factor
2484 integer,
intent(in) :: time_start
2485 integer,
intent(in) :: time_end
2486 real(real64),
intent(in) :: t0
2487 real(real64),
intent(in) :: time_step
2488 type(batch_t),
intent(inout) :: time_function
2490 integer :: itime, ii
2491 real(real64) :: time
2492 real(real64),
allocatable :: weight(:)
2494 push_sub(signal_damp)
2496 assert(time_function%status() == batch_not_packed)
2498 safe_allocate(weight(time_start:time_end))
2500 do itime = time_start, time_end
2501 time = time_step*(itime-1)
2504 select case (damp_type)
2506 weight(itime) = m_one
2509 weight(itime) = m_one
2511 weight(itime) =
exp(-(time - t0)*damp_factor)
2515 weight(itime) = m_one
2517 weight(itime) = m_one - m_three*((time - t0) / (time_step * (time_end - 1) - t0))**2 + &
2518 m_two * ((time - t0) / (time_step * (time_end - 1) - t0))**3
2522 weight(itime) = m_one
2524 weight(itime) =
exp(-(time - t0)**2*damp_factor**2)
2528 weight(itime) = m_one
2530 weight(itime) =
sin(-(time - t0)*m_pi/(time_end+t0))
2535 if (time_function%type() == type_cmplx)
then
2536 do ii = 1, time_function%nst_linear
2537 do itime = time_start, time_end
2538 time_function%zff_linear(itime, ii) = weight(itime)*time_function%zff_linear(itime, ii)
2542 do ii = 1, time_function%nst_linear
2543 do itime = time_start, time_end
2544 time_function%dff_linear(itime, ii) = weight(itime)*time_function%dff_linear(itime, ii)
2549 safe_deallocate_a(weight)
2551 pop_sub(signal_damp)
2567 energy_start, energy_end, energy_step, energy_function)
2568 integer,
intent(in) :: method
2569 integer,
intent(in) :: transform
2570 real(real64),
intent(in) :: noise
2571 integer,
intent(in) :: time_start
2572 integer,
intent(in) :: time_end
2573 real(real64),
intent(in) :: t0
2574 real(real64),
intent(in) :: time_step
2575 type(batch_t),
intent(in) :: time_function
2576 real(real64),
intent(in) :: energy_start
2577 real(real64),
intent(in) :: energy_end
2578 real(real64),
intent(in) :: energy_step
2579 type(batch_t),
intent(inout) :: energy_function
2581 integer :: itime, ienergy, ii, energy_steps
2582 real(real64) :: energy, sinz, cosz
2583 complex(real64) :: ez, eidt
2584 type(compressed_sensing_t) :: cs
2586 push_sub(fourier_transform)
2588 assert(time_function%nst_linear == energy_function%nst_linear)
2589 assert(time_function%status() == energy_function%status())
2590 assert(time_function%status() == batch_not_packed)
2591 assert(time_function%type() == type_float)
2592 assert(energy_function%type() == type_float)
2594 energy_steps = nint((energy_end-energy_start) / energy_step) + 1
2596 select case (method)
2600 do ienergy = 1, energy_steps
2602 energy = energy_step*(ienergy - 1) + energy_start
2604 do ii = 1, energy_function%nst_linear
2605 energy_function%dff_linear(ienergy, ii) = m_zero
2608 select case (transform)
2615 eidt =
exp(m_zi * energy * time_step)
2616 ez =
exp(m_zi * energy * ((time_start-1)*time_step - t0))
2618 do itime = time_start, time_end
2619 do ii = 1, time_function%nst_linear
2620 energy_function%dff_linear(ienergy, ii) = &
2621 energy_function%dff_linear(ienergy, ii) + &
2622 time_function%dff_linear(itime, ii) * sinz
2630 eidt =
exp(m_zi * energy * time_step)
2631 ez =
exp(m_zi * energy * ( (time_start-1)*time_step - t0))
2632 cosz = real(ez, real64)
2633 do itime = time_start, time_end
2634 do ii = 1, time_function%nst_linear
2635 energy_function%dff_linear(ienergy, ii) = &
2636 energy_function%dff_linear(ienergy, ii) + &
2637 time_function%dff_linear(itime, ii) * cosz
2640 cosz = real(ez, real64)
2645 eidt =
exp(-energy * time_step)
2646 ez =
exp(-energy * ((time_start - 1) * time_step - t0))
2647 do itime = time_start, time_end
2648 do ii = 1, time_function%nst_linear
2649 energy_function%dff_linear(ienergy, ii) = &
2650 energy_function%dff_linear(ienergy, ii) + &
2651 real( time_function%dff_linear(itime, ii) * ez, real64)
2658 do ii = 1, time_function%nst_linear
2659 energy_function%dff_linear(ienergy, ii) = &
2660 energy_function%dff_linear(ienergy, ii) * time_step
2668 call compressed_sensing_init(cs, transform, &
2669 time_end - time_start + 1, time_step, time_step*(time_start - 1) - t0, &
2670 energy_steps, energy_step, energy_start, noise)
2672 do ii = 1, time_function%nst_linear
2673 call compressed_sensing_spectral_analysis(cs, time_function%dff_linear(:, ii), &
2674 energy_function%dff_linear(:, ii))
2677 call compressed_sensing_end(cs)
2681 pop_sub(fourier_transform)
2687 type(namespace_t),
intent(in) :: namespace
2688 real(real64),
intent(in) :: sigma(:, :, :, :)
2689 integer,
intent(in) :: nspin
2690 real(real64),
intent(in) :: energy_step, min_energy
2691 integer,
intent(in) :: energy_steps
2692 type(kick_t),
optional,
intent(in) :: kick
2694 integer :: is, idir, jdir, ie,
info, out_file, out_file_t
2695 real(real64),
allocatable :: work(:,:)
2696 complex(real64),
allocatable :: w(:)
2697 character(len=20) :: header_string
2698 logical :: spins_singlet, spins_triplet, symmetrize
2699 real(real64),
allocatable :: pp(:,:), pp2(:,:)
2715 call parse_variable(namespace,
'PropagationSpectrumSymmetrizeSigma', .false., symmetrize)
2716 call messages_print_var_value(
'PropagationSpectrumSymmetrizeSigma', symmetrize, namespace=namespace)
2718 spins_singlet = .
true.
2719 spins_triplet = .false.
2720 if (
present(kick))
then
2721 select case (kick_get_type(kick))
2722 case (kick_spin_mode)
2723 spins_triplet = .
true.
2724 spins_singlet = .false.
2725 case (kick_spin_density_mode)
2726 spins_triplet = .
true.
2730 if (spins_singlet .and. spins_triplet)
then
2731 out_file = io_open(
'cross_section_diagonal-sigma_s', namespace, action=
'write')
2732 out_file_t = io_open(
'cross_section_diagonal-sigma_t', namespace, action=
'write')
2734 out_file = io_open(
'cross_section_diagonal-sigma', namespace, action=
'write')
2738 write(out_file,
'(a1, a20)', advance =
'no')
'#', str_center(
"Energy", 20)
2740 write(out_file,
'(a20)', advance =
'no') str_center(
"Real part", 20)
2741 if (.not. symmetrize)
write(out_file,
'(a20)', advance =
'no') str_center(
"Imaginary part", 20)
2743 write(header_string,
'(a7,i1,a1,i1,a1,i1,a1)')
'vector(', idir,
',', jdir,
',', is,
')'
2744 write(out_file,
'(a20)', advance =
'no') str_center(trim(header_string), 20)
2747 write(out_file,
'(1x)')
2748 write(out_file,
'(a1,a20)', advance =
'no')
'#', str_center(
'[' // trim(units_abbrev(units_out%energy)) //
']', 20)
2751 write(out_file,
'(a20)', advance =
'no') str_center(
'[' // trim(units_abbrev(units_out%length**2)) //
']', 20)
2752 if (.not. symmetrize)
then
2753 write(out_file,
'(a20)', advance =
'no') str_center(
'[' // trim(units_abbrev(units_out%length**2)) //
']', 20)
2756 write(out_file,
'(a20)', advance =
'no') str_center(
'[ - ]', 20)
2759 write(out_file,
'(1x)')
2761 if (spins_singlet .and. spins_triplet)
then
2763 write(out_file_t,
'(a1, a20)', advance =
'no')
'#', str_center(
"Energy", 20)
2765 write(out_file_t,
'(a20)', advance =
'no') str_center(
"Real part", 20)
2766 if (.not. symmetrize)
write(out_file_t,
'(a20)', advance =
'no') str_center(
"Imaginary part", 20)
2768 write(header_string,
'(a7,i1,a1,i1,a1,i1,a1)')
'vector(', idir,
',', jdir,
',', is,
')'
2769 write(out_file_t,
'(a20)', advance =
'no') str_center(trim(header_string), 20)
2772 write(out_file_t,
'(1x)')
2773 write(out_file_t,
'(a1,a20)', advance =
'no')
'#', str_center(
'[' // trim(units_abbrev(units_out%energy)) //
']', 20)
2776 write(out_file_t,
'(a20)', advance =
'no') str_center(
'[' // trim(units_abbrev(units_out%length**2)) //
']', 20)
2777 if (.not. symmetrize)
then
2778 write(out_file_t,
'(a20)', advance =
'no') str_center(
'[' // trim(units_abbrev(units_out%length**2)) //
']', 20)
2781 write(out_file_t,
'(a20)', advance =
'no') str_center(
'[ - ]', 20)
2784 write(out_file_t,
'(1x)')
2787 safe_allocate(pp(1:3, 1:3))
2788 if (spins_triplet .and. spins_singlet)
then
2789 safe_allocate(pp2(1:3, 1:3))
2791 safe_allocate(w(1:3))
2792 safe_allocate(work(1:3, 1:3))
2793 do ie = 1, energy_steps
2795 pp(:, :) = sigma(:, :, ie, 1)
2796 if (nspin >= 2)
then
2797 if (spins_singlet .and. spins_triplet)
then
2798 pp2(:, :) = pp(:, :) - sigma(:, :, ie, 2)
2799 pp(:, :) = pp(:, :) + sigma(:, :, ie, 2)
2800 elseif (spins_triplet .and. .not. spins_singlet)
then
2801 pp(:, :) = pp(:, :) - sigma(:, :, ie, 2)
2802 elseif (spins_singlet .and. .not. spins_triplet)
then
2803 pp(:, :) = pp(:, :) + sigma(:, :, ie, 2)
2807 if (symmetrize)
then
2809 do jdir = idir + 1, 3
2810 pp(idir, jdir) = (pp(idir, jdir) + pp(jdir, idir)) / m_two
2811 pp(jdir, idir) = pp(idir, jdir)
2816 work(1:3, 1:3) = pp(1:3, 1:3)
2817 call lalg_eigensolve_nonh(3, work, w, err_code =
info, sort_eigenvectors = .
true.)
2821 write(out_file,
'(e20.8)', advance =
'no') units_from_atomic(units_out%energy, ((ie-1) * energy_step + min_energy))
2823 if (symmetrize)
then
2824 write(out_file,
'(2e20.8)', advance =
'no') real(w(idir), real64)
2826 write(out_file,
'(2e20.8)', advance =
'no') w(idir)
2830 write(out_file,
'(e20.8)', advance =
'no') work(jdir, idir)
2833 write(out_file,
'(1x)')
2835 if (spins_singlet .and. spins_triplet)
then
2836 if (symmetrize)
then
2838 do jdir = idir + 1, 3
2839 pp2(idir, jdir) = (pp2(idir, jdir) + pp2(jdir, idir)) / m_two
2840 pp2(jdir, idir) = pp2(idir, jdir)
2844 work(1:3, 1:3) = -pp2(1:3, 1:3)
2845 call lalg_eigensolve_nonh(3, work, w, err_code =
info, sort_eigenvectors = .
true.)
2849 write(out_file_t,
'(e20.8)', advance =
'no') units_from_atomic(units_out%energy, (ie * energy_step + min_energy))
2851 if (symmetrize)
then
2852 write(out_file_t,
'(2e20.8)', advance =
'no') real(w(idir), real64)
2854 write(out_file_t,
'(2e20.8)', advance =
'no') w(idir)
2858 write(out_file_t,
'(e20.8)', advance =
'no') work(jdir, idir)
2861 write(out_file_t,
'(1x)')
2865 call io_close(out_file)
2867 safe_deallocate_a(pp)
2868 if (spins_triplet .and. spins_singlet)
then
2869 safe_deallocate_a(pp2)
2870 call io_close(out_file_t)
2872 safe_deallocate_a(w)
2873 safe_deallocate_a(work)
2881 no_e = nint((spectrum%max_energy-spectrum%min_energy) / spectrum%energy_step) + 1
2886 integer,
intent(in) :: out_file
2890 write(out_file,
'(a,i4)')
'# PropagationSpectrumDampMode = ', spectrum%damp
2891 write(out_file,
'(a,f10.4)')
'# PropagationSpectrumDampFactor = ', units_from_atomic(units_out%time**(-1), &
2892 spectrum%damp_factor)
2893 write(out_file,
'(a,f10.4)')
'# PropagationSpectrumStartTime = ', units_from_atomic(units_out%time, spectrum%start_time)
2894 write(out_file,
'(a,f10.4)')
'# PropagationSpectrumEndTime = ', units_from_atomic(units_out%time, spectrum%end_time)
2895 write(out_file,
'(a,f10.4)')
'# PropagationSpectrumMinEnergy = ', units_from_atomic(units_out%energy, spectrum%min_energy)
2896 write(out_file,
'(a,f10.4)')
'# PropagationSpectrumMaxEnergy = ', units_from_atomic(units_out%energy, spectrum%max_energy)
2897 write(out_file,
'(a,f10.4)')
'# PropagationSpectrumEnergyStep = ', units_from_atomic(units_out%energy, spectrum%energy_step)
2905 type(namespace_t),
intent(in) :: namespace
2906 integer,
intent(in) :: iunit
2907 character(len=*),
intent(out) :: line
2908 character(len=*),
intent(in) :: context
2914 read(iunit,
'(a)', iostat = ierr) line
2916 write(message(1),
'(3a)')
"Could not read ", trim(context),
" from multipoles header."
2917 call messages_fatal(1, namespace=namespace)
2927 type(namespace_t),
intent(in) :: namespace
2928 integer,
intent(in) :: iunit
2929 integer,
intent(out) :: value
2930 character(len=*),
intent(in) :: context
2933 character(len=200) :: line
2939 if (len_trim(line) < 16)
then
2942 read(line(16:), *, iostat = ierr)
value
2945 write(message(1),
'(3a)')
"Could not read ", trim(context),
" from multipoles header line:"
2946 write(message(2),
'(a)') trim(line)
2947 call messages_fatal(2, namespace=namespace)
2957 type(namespace_t),
intent(in) :: namespace
2958 integer,
intent(in) :: iunit
2961 character(len=200) :: line
2967 read(iunit,
'(a)', iostat = ierr) line
2968 if (ierr == iostat_end)
then
2969 message(1) =
"Could not find cross-section header in spectrum file."
2970 call messages_fatal(1, namespace=namespace)
2973 message(1) =
"Could not read spectrum file while looking for cross-section header."
2974 call messages_fatal(1, namespace=namespace)
2976 if (index(adjustl(line),
"# nspin") == 1)
then
initialize a batch with existing memory
This is the common interface to a simple-minded polynomical interpolation procedure (simple use of th...
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
double log(double __x) __attribute__((__nothrow__
double exp(double __x) __attribute__((__nothrow__
double sin(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
This module implements batches of mesh functions.
integer, parameter spectrum_transform_cos
integer, parameter spectrum_transform_sin
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
subroutine, public fft_init(this, nn, dim, type, library, optimize, optimize_parity, comm, mpi_grp, use_aligned, howmany)
subroutine, public fft_end(this)
integer, parameter, public fft_complex
integer, parameter, public fftlib_fftw
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
real(real64), parameter, public p_ry
real(real64), parameter, public m_third
real(real64), parameter, public m_pi
some mathematical constants
character(len= *), parameter, public pcm_dir
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
real(real64), parameter, public p_c
Electron gyromagnetic ratio, see Phys. Rev. Lett. 130, 071801 (2023)
real(real64), parameter, public m_one
real(real64), parameter, public m_three
subroutine, public io_close(iunit, grp)
subroutine, public io_skip_header(iunit)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public kick_read(kick, iunit, namespace)
integer, parameter, public kick_spin_mode
pure integer function, public kick_get_type(kick)
subroutine, public kick_write(kick, iunit, out)
integer, parameter, public kick_density_mode
integer, parameter, public kick_function_dipole
integer, parameter, public kick_spin_density_mode
This module is intended to contain "only mathematical" functions and procedures.
pure complex(real64) function, dimension(1:3), public zcross_product(a, b)
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
character(len=512), private msg
subroutine, public messages_warning(no_lines, all_nodes, namespace)
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_experimental(name, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
real(real64), dimension(:,:), allocatable sigma
S_E matrix.
subroutine, public pcm_dipole(mu_pcm, q_pcm, tess, n_tess)
Computes the dipole moment mu_pcm due to a distribution of charges q_pcm.
subroutine, public pcm_eps(pcm, eps, omega)
subroutine, public pcm_min_input_parsing_for_spectrum(pcm, namespace)
subroutine, public spectrum_hsfunction_min(namespace, aa, bb, omega_min, func_min)
subroutine spectrum_tdfile_info(namespace, fname, iunit, time_steps, dt)
subroutine spectrum_hsfunction_ar_end
subroutine spectrum_hsfunction_ar_init(dt, is, ie, niter, acc, pos, tret)
subroutine spectrum_read_header_line(namespace, iunit, line, context)
Read a required multipoles or spectrum header line.
subroutine, public spectrum_cross_section(spectrum, namespace, in_file, out_file, ref_file)
subroutine spectrum_times_pcm_epsilon(spectrum, pcm, dipole, sigma, nspin, istart, iend, kick_time, dt, no_e)
subroutine, public spectrum_hs_ar_from_acc(spectrum, namespace, out_file, vec, w0)
integer, parameter, public spectrum_damp_lorentzian
subroutine, public spectrum_fix_time_limits(spectrum, time_steps, dt, istart, iend, ntiter)
subroutine, public spectrum_fourier_transform(method, transform, noise, time_start, time_end, t0, time_step, time_function, energy_start, energy_end, energy_step, energy_function)
Computes the sine, cosine, (or "exponential") Fourier transform of the real function given in the tim...
integer, parameter, public spectrum_transform_laplace
subroutine spectrum_find_cross_section_header(namespace, iunit)
Position a spectrum file at the cross-section metadata header.
subroutine, public spectrum_cross_section_tensor(spectrum, namespace, out_file, in_file)
subroutine, public spectrum_hsfunction_init(dt, is, ie, niter, acc)
subroutine, public spectrum_hsfunction_end
subroutine spectrum_read_dipole(namespace, in_file, dipole)
integer, parameter, public spectrum_damp_sin
subroutine spectrum_sigma_diagonalize(namespace, sigma, nspin, energy_step, min_energy, energy_steps, kick)
subroutine spectrum_cross_section_info(namespace, iunit, nspin, kick, energy_steps, dw)
subroutine, public spectrum_dyn_structure_factor(spectrum, namespace, in_file_sin, in_file_cos, out_file)
integer, parameter, public spectrum_damp_gaussian
subroutine, public spectrum_init(spectrum, namespace, default_energy_step, default_max_energy)
subroutine, public spectrum_mult_info(namespace, iunit, nspin, kick, time_steps, dt, file_units, lmax)
integer, parameter, public spectrum_fourier
subroutine, public spectrum_dipole_power(spectrum, namespace, in_file, out_file)
subroutine spectrum_add_pcm_dipole(namespace, dipole, time_steps, nspin)
subroutine, public spectrum_signal_damp(damp_type, damp_factor, time_start, time_end, t0, time_step, time_function)
subroutine, public spectrum_hs_from_acc(spectrum, namespace, out_file, pol, vec, w0)
integer, parameter, public spectrum_energyloss
subroutine spectrum_over_pcm_refraction_index(spectrum, pcm, sigma, nspin, no_e)
subroutine, public spectrum_hs_from_current(spectrum, namespace, out_file, pol, vec, w0)
subroutine spectrum_cross_section_tensor_write(out_file, sigma, nspin, energy_step, min_energy, energy_steps, kick)
subroutine spectrum_read_header_integer(namespace, iunit, value, context)
Read a required integer value from a fixed-label header line.
subroutine spectrum_write_info(spectrum, out_file)
subroutine spectrum_hs_output(spectrum, namespace, out_file, pol, no_e, sp)
integer, parameter, public spectrum_damp_polynomial
subroutine hsfunction(omega, power)
integer, parameter, public spectrum_rotatory
subroutine spectrum_hs(spectrum, namespace, out_file, pol, w0)
integer, parameter, public spectrum_damp_none
integer, parameter, public spectrum_transform_cos
integer, parameter, public spectrum_transform_sin
subroutine, public spectrum_count_time_steps(namespace, iunit, time_steps, dt)
subroutine, public spectrum_rotatory_strength(spectrum, namespace, in_file, out_file)
pure integer function, public spectrum_nenergy_steps(spectrum)
subroutine, public spectrum_hs_from_mult(spectrum, namespace, out_file, pol, vec, w0)
integer, parameter, public spectrum_compressed_sensing
subroutine, public spectrum_hs_ar_from_mult(spectrum, namespace, out_file, vec, w0)
integer, parameter, public spectrum_p_power
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.
integer, parameter, public units_atomic
type(unit_system_t), public units_out
subroutine, public unit_system_get(uu, cc)
integer, parameter, public units_eva
type(unit_system_t), public units_inp
the units systems for reading and writing
type(unit_t), public unit_one
some special units required for particular quantities
Class defining batches of mesh functions.