27 use,
intrinsic :: iso_fortran_env
39 integer :: iunit, ierr, ii, jj, iter, read_iter
40 real(real64),
allocatable :: dipole(:,:)
41 complex(real64),
allocatable :: ftdipole(:,:)
42 type(space_t) :: space
43 real(real64) :: ww, irtotal, dt
44 integer :: ifreq, idir, istart, iend, time_steps, energy_steps, ntiter
45 integer,
parameter :: max_freq = 10000
46 type(spectrum_t) :: spectrum
71 safe_allocate(ftdipole(1:energy_steps, 1:space%dim))
79 write(unit = iunit, iostat = ierr, fmt = 100)
80 write(unit = iunit, iostat = ierr, fmt =
'(8a)')
'# HEADER'
81 write(unit = iunit, iostat = ierr, fmt =
'(a25,a1,a1,a10)') &
83 write(unit = iunit, iostat = ierr, fmt =
'(a1)')
'#'
84 write(unit = iunit, iostat = ierr, fmt =
'(a19,41x,a17)')
'# Energy ',
'absorption'
85 write(unit = iunit, iostat = ierr, fmt =
'(a15,13x,a5,15x,a7,13x,a7,13x,a7)') &
86 '# [1/cm]',
'total',
'FT(<x>)',
'FT(<y>)',
'FT(<z>)'
87 write(unit = iunit, iostat = ierr, fmt = 0100)
89 do ifreq = 1, energy_steps
90 ww = (ifreq-1)*spectrum%energy_step + spectrum%min_energy
91 irtotal = norm2(abs(ftdipole(ifreq, 1:3)))
92 write(unit = iunit, iostat = ierr, fmt =
'(5e20.10)') &
98 safe_deallocate_a(dipole)
99 safe_deallocate_a(ftdipole)
111 real(real64),
allocatable,
intent(inout) :: dipole(:, :)
112 character(len=100) :: ioerrmsg
113 real(real64) :: charge, time
125 time_steps = time_steps + 1
129 istart = max(1, istart)
132 safe_allocate(dipole(1:time_steps, 1:space%dim))
136 do iter = 1, time_steps
137 read(unit = iunit, iostat = ierr, iomsg=ioerrmsg, fmt = *) read_iter, time, &
138 charge, (dipole(iter, idir), idir=1, space%dim)
151 write (
message(1),
'(a)')
"Read dipole moment from '"// &
168 real(real64),
contiguous,
intent(inout) :: fi(:,:)
169 complex(real64),
intent(out) :: ftfi(:,:)
173 type(
batch_t) :: dipoleb, ftrealb, ftimagb
174 real(real64),
allocatable :: ftreal(:,:), ftimag(:,:)
184 do idir = 1, space%dim
185 av = sum(fi(istart:iend, idir)) / (iend - istart + 1)
188 fi(jj, idir) = fi(jj, idir) - av
192 write (
message(1),
'(a)')
"Taking the Fourier transform."
195 safe_allocate(ftreal(1:energy_steps, 1:space%dim))
196 safe_allocate(ftimag(1:energy_steps, 1:space%dim))
197 call batch_init(ftrealb, 1, 1, space%dim, ftreal)
198 call batch_init(ftimagb, 1, 1, space%dim, ftimag)
202 istart, iend, spectrum%start_time, dt, dipoleb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, ftrealb)
205 istart, iend, spectrum%start_time, dt, dipoleb, spectrum%min_energy, spectrum%max_energy, spectrum%energy_step, ftimagb)
207 do idir = 1, space%dim
209 do ifreq = 1, energy_steps
210 ftfi(ifreq, idir) = cmplx(ftreal(ifreq, idir), ftimag(ifreq, idir), real64)
217 safe_deallocate_a(ftreal)
218 safe_deallocate_a(ftimag)
220 write (
message(1),
'(a)')
"Done."
subroutine read_dipole(dipole)
subroutine fourier(fi, ftfi)
initialize a batch with existing memory
This module implements batches of mesh functions.
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
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...
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_close(iunit, grp)
subroutine, public io_skip_header(iunit)
subroutine, public io_end()
character(len=max_path_len) function, public io_workpath(path, namespace)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
subroutine, public messages_end()
subroutine, public messages_init(output_dir)
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, 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)
type(namespace_t), public global_namespace
subroutine, public parser_init()
Initialise the Octopus parser.
subroutine, public parser_end()
End the Octopus parser.
subroutine, public profiling_end(namespace)
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
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_damp_sin
subroutine, public spectrum_init(spectrum, namespace, default_energy_step, default_max_energy)
integer, parameter, public spectrum_fourier
subroutine, public spectrum_signal_damp(damp_type, damp_factor, time_start, time_end, t0, time_step, time_function)
integer, parameter, public spectrum_transform_cos
integer, parameter, public spectrum_transform_sin
subroutine, public spectrum_count_time_steps(namespace, iunit, time_steps, dt)
pure integer function, public spectrum_nenergy_steps(spectrum)
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
This module defines the unit system, used for input and output.
type(unit_t), public unit_invcm
For vibrational frequencies.
type(unit_system_t), public units_out
subroutine, public unit_system_init(namespace)
Class defining batches of mesh functions.