28 use,
intrinsic :: iso_fortran_env
42 real(real64) :: br, energy_step, min_energy, max_energy
43 type(space_t) :: space
47 integer :: ierr, idir, jdir, iatom
48 type(space_t) :: space
49 type(casida_spectrum_t) :: cs
50 real(real64),
allocatable :: rotation(:,:), rot2(:,:), identity(:,:), coord(:)
52 type(ions_t),
pointer :: ions
68 allocate(rotation(space%dim, space%dim))
69 allocate(rot2(space%dim, space%dim))
70 allocate(identity(space%dim, space%dim))
71 allocate(coord(space%dim))
76 cs%ispin = min(2, cs%ispin)
123 do idir = 1, space%dim
124 identity(idir, idir) =
m_one
137 do idir = 1, space%dim
138 do jdir = 1, space%dim
144 message(1) =
"Info: Applying rotation matrix"
149 rot2(:,:) = abs(matmul(transpose(rotation), rotation))
150 if (any(abs(rot2(:,:) - identity(:,:)) > 1e-6_real64))
then
151 write(
message(1),
'(a,es13.6)')
"Rotation matrix is not orthogonal. max discrepancy in product = ", &
152 maxval(abs(rot2(:,:) - identity(:,:)))
158 do iatom = 1, ions%natoms
159 coord = ions%pos(:, iatom)
160 ions%pos(:, iatom) = matmul(rotation, coord)
162 call ions%write_xyz(trim(
casida_dir)//
'rotated')
163 safe_deallocate_p(ions)
165 rotation(:,:) = identity(:,:)
189 subroutine calc_broad(cs, dir, fname, extracols)
191 character(len=*),
intent(in) :: dir
192 character(len=*),
intent(in) :: fname
193 logical,
intent(in) :: extracols
195 real(real64),
allocatable :: spectrum(:,:)
196 real(real64) :: omega, energy, re_tm(space%dim), im_tm(space%dim), ff(space%dim+1), tm_sq(space%dim)
197 integer :: istep, nsteps, iunit, trash(3), idir, ncols, ios
198 character(len=256) :: string
199 logical :: is_complex
203 nsteps = int((cs%max_energy - cs%min_energy) / cs%energy_step)
204 safe_allocate(spectrum(1:space%dim+1, 1:nsteps))
210 message(1) =
'Cannot open file "'//trim(dir)//trim(fname)//
'".'
211 message(2) =
'The '//trim(fname)//
' spectrum was not generated.'
220 ncols = ncols + cs%ispin
225 read(iunit,
'(a)') string
227 read(string, *, iostat = ios) trash(1:ncols), energy, (re_tm(idir), im_tm(idir), idir = 1, space%dim), ff(space%dim+1)
228 is_complex = (ios == 0)
234 read(iunit, *, iostat = ios) trash(1:ncols), energy, (re_tm(idir), im_tm(idir), idir = 1, space%dim), ff(space%dim+1)
237 read(iunit, *, iostat = ios) trash(1:ncols), energy, (re_tm(idir), idir = 1, space%dim), ff(space%dim+1)
244 else if (ios > 0)
then
245 message(1) =
"Error parsing file " // trim(fname)
252 tm_sq = (matmul(rotation, re_tm))**2
254 tm_sq = tm_sq + (matmul(rotation, im_tm))**2
256 ff(1:space%dim) =
m_two * energy * tm_sq
259 omega = cs%min_energy + real(istep-1, real64) *cs%energy_step
260 spectrum(:, istep) = spectrum(:, istep) + ff*cs%br/((omega-energy)**2 + cs%br**2)/
m_pi
269 do idir = 1, space%dim
272 write(iunit,
'(a14)')
'<f>'
281 safe_deallocate_a(spectrum)
subroutine calc_broad(cs, dir, fname, extracols)
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
real(real64), parameter, public m_two
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
real(real64), parameter, public m_zero
character(len= *), parameter, public casida_dir
real(real64), parameter, public m_pi
some mathematical constants
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_one
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_end()
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_warning(no_lines, all_nodes, namespace)
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)
subroutine, public messages_input_error(namespace, var, details, row, column)
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 profiling_end(namespace)
subroutine, public profiling_init(namespace)
Create profiling subdirectory.
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)
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
This module is intended to contain simple general-purpose utility functions and procedures.
subroutine, public output_tensor(tensor, ndim, unit, write_average, iunit, namespace)
character pure function, public index2axis(idir)