30 use,
intrinsic :: iso_fortran_env
64 type(grid_t),
intent(in) :: gr
65 type(namespace_t),
intent(in) :: namespace
66 type(target_t),
intent(inout) :: tg
67 type(td_t),
intent(in) :: td
70 real(real64) :: xx(1:gr%box%dim), rr, psi_re, psi_im
71 character(len=1024) :: expression
74 tg%move_ions = td%ions_dyn%ions_move()
86 safe_allocate(tg%rho(1:gr%np))
91 call mesh_r(gr, ip, rr, coords = xx)
97 message(1) =
'If OCTTargetOperator = oct_tg_local, then you must give the shape'
98 message(2) =
'of this target in variable "OCTLocalTarget".'
109 type(target_t),
intent(inout) :: tg
113 safe_deallocate_a(tg%rho)
121 type(target_t),
intent(in) :: tg
122 type(namespace_t),
intent(in) :: namespace
123 class(space_t),
intent(in) :: space
124 class(mesh_t),
intent(in) :: mesh
125 character(len=*),
intent(in) :: dir
126 type(ions_t),
intent(in) :: ions
127 type(output_t),
intent(in) :: outp
134 tg%rho,
units_out%length**(-space%dim), ierr, pos=ions%pos, atoms=ions%atom)
144 real(real64) function target_j1_local(mesh, tg, psi) result(j1)
145 class(mesh_t),
intent(in) :: mesh
146 type(target_t),
intent(in) :: tg
147 type(states_elec_t),
intent(in) :: psi
150 push_sub(target_j1_local)
153 do is = 1, psi%d%spin_channels
154 j1 = j1 +
dmf_dotp(mesh, tg%rho, psi%rho(:, is))
157 pop_sub(target_j1_local)
164 type(target_t),
intent(in) :: tg
165 class(mesh_t),
intent(in) :: mesh
166 type(states_elec_t),
intent(in) :: psi_in
167 type(states_elec_t),
intent(inout) :: chi_out
169 integer :: ik, idim, ist, ip
170 complex(real64),
allocatable :: zpsi(:, :)
174 safe_allocate(zpsi(1:mesh%np, 1:psi_in%d%dim))
176 do ik = 1, psi_in%nik
177 do idim = 1, psi_in%d%dim
178 do ist = psi_in%st_start, psi_in%st_end
179 call states_elec_get_state(psi_in, mesh, ist, ik, zpsi)
181 zpsi(ip, idim) = psi_in%occ(ist, ik)*tg%rho(ip)*zpsi(ip, idim)
183 call states_elec_set_state(chi_out, mesh, ist, ik, zpsi)
188 safe_deallocate_a(zpsi)
real(real64), parameter, public m_zero
This module implements the underlying real-space grid.
subroutine, public dio_function_output(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
Top-level IO routine for functions defined on the mesh.
subroutine, public io_mkdir(fname, namespace, parents)
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
pure subroutine, public mesh_r(mesh, ip, rr, origin, coords)
return the distance to the origin for a given grid point
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
this module contains the low-level part of the output system
logical function, public parse_is_defined(namespace, name)
subroutine, public conv_to_c_string(str)
converts to c string
real(real64) function, public target_j1_local(mesh, tg, psi)
subroutine, public target_init_local(gr, namespace, tg, td)
subroutine, public target_output_local(tg, namespace, space, mesh, dir, ions, outp)
subroutine, public target_chi_local(tg, mesh, psi_in, chi_out)
subroutine, public target_end_local(tg)
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_system_t), public units_out