32 use,
intrinsic :: iso_fortran_env
61 real(real64),
allocatable :: rho(:)
76 subroutine target_init_local(tg, gr, kpoints, namespace, space, ions, qcs, td, w0, oct, ep, restart)
77 class(target_local_t),
intent(inout) :: tg
78 type(grid_t),
intent(in) :: gr
79 type(kpoints_t),
intent(in) :: kpoints
80 type(namespace_t),
intent(in) :: namespace
81 class(space_t),
intent(in) :: space
82 type(ions_t),
intent(in) :: ions
83 type(opt_control_state_t),
intent(inout) :: qcs
84 type(td_t),
intent(in) :: td
85 real(real64),
intent(in) :: w0
86 type(oct_t),
intent(in) :: oct
87 type(epot_t),
intent(inout) :: ep
88 type(restart_t),
intent(inout) :: restart
91 real(real64) :: xx(1:gr%box%dim), rr, psi_re, psi_im
92 character(len=1024) :: expression
95 tg%move_ions = td%ions_dyn%ions_move()
107 safe_allocate(tg%rho(1:gr%np))
112 call mesh_r(gr, ip, rr, coords = xx)
118 message(1) =
'If OCTTargetOperator = oct_tg_local, then you must give the shape'
119 message(2) =
'of this target in variable "OCTLocalTarget".'
130 class(target_local_t),
intent(inout) :: tg
131 type(oct_t),
intent(in) :: oct
135 safe_deallocate_a(tg%rho)
143 class(target_local_t),
intent(inout) :: tg
144 type(namespace_t),
intent(in) :: namespace
145 class(space_t),
intent(in) :: space
146 type(grid_t),
intent(in) :: gr
147 character(len=*),
intent(in) :: dir
148 type(ions_t),
intent(in) :: ions
149 type(hamiltonian_elec_t),
intent(in) :: hm
150 type(output_t),
intent(in) :: outp
157 tg%rho,
units_out%length**(-space%dim), ierr, pos=ions%pos, atoms=ions%atom)
167 real(real64) function
target_j1_local(tg, namespace, gr, kpoints, qcpsi, ions) result(j1)
170 type(
grid_t),
intent(in) :: gr
173 type(
ions_t),
optional,
intent(in) :: ions
182 do is = 1, psi%d%spin_channels
183 j1 = j1 +
dmf_dotp(gr, tg%rho, psi%rho(:, is))
193 subroutine target_chi_local(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
195 type(namespace_t),
intent(in) :: namespace
196 type(grid_t),
intent(in) :: gr
197 type(kpoints_t),
intent(in) :: kpoints
198 type(opt_control_state_t),
target,
intent(inout) :: qcpsi_in
199 type(opt_control_state_t),
target,
intent(inout) :: qcchi_out
200 type(ions_t),
intent(in) :: ions
202 integer :: ik, idim, ist, ip
203 complex(real64),
allocatable :: zpsi(:, :)
204 type(states_elec_t),
pointer :: psi_in, chi_out
208 psi_in => opt_control_point_qs(qcpsi_in)
209 chi_out => opt_control_point_qs(qcchi_out)
211 safe_allocate(zpsi(1:gr%np, 1:psi_in%d%dim))
213 do ik = 1, psi_in%nik
214 do idim = 1, psi_in%d%dim
215 do ist = psi_in%st_start, psi_in%st_end
216 call states_elec_get_state(psi_in, gr, ist, ik, zpsi)
218 zpsi(ip, idim) = psi_in%occ(ist, ik)*tg%rho(ip)*zpsi(ip, idim)
220 call states_elec_set_state(chi_out, gr, ist, ik, zpsi)
225 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 definition of the oct_t data type, which contains some of the basic informat...
This module holds the "opt_control_state_t" datatype, which contains a quantum-classical state.
type(states_elec_t) function, pointer, public opt_control_point_qs(ocs)
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
subroutine target_init_local(tg, gr, kpoints, namespace, space, ions, qcs, td, w0, oct, ep, restart)
subroutine target_output_local(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine target_end_local(tg, oct)
subroutine target_chi_local(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
real(real64) function target_j1_local(tg, namespace, gr, kpoints, qcpsi, ions)
Optimal-control targets: abstract base class and public interface.
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
Description of the grid, containing information on derivatives, stencil, and symmetries.
This is the datatype that contains the objects that are propagated: in principle this could be both t...
The states_elec_t class contains all electronic wave functions.
Target that is a local (static) operator.
Abstract optimal-control target.