31 use,
intrinsic :: iso_fortran_env
68 subroutine target_init_gstransformation(tg, gr, kpoints, namespace, space, ions, qcs, td, w0, oct, ep, restart)
69 class(target_gstransformation_t),
intent(inout) :: tg
70 type(grid_t),
intent(in) :: gr
71 type(kpoints_t),
intent(in) :: kpoints
72 type(namespace_t),
intent(in) :: namespace
73 class(space_t),
intent(in) :: space
74 type(ions_t),
intent(in) :: ions
75 type(opt_control_state_t),
intent(inout) :: qcs
76 type(td_t),
intent(in) :: td
77 real(real64),
intent(in) :: w0
78 type(oct_t),
intent(in) :: oct
79 type(epot_t),
intent(inout) :: ep
80 type(restart_t),
intent(inout) :: restart
84 message(1) =
'Info: Using Superposition of States for TargetOperator'
87 tg%move_ions = td%ions_dyn%ions_move()
105 message(1) =
'If "OCTTargetOperator = oct_tg_superposition", then you must'
106 message(2) =
'supply an "OCTTargetTransformStates" block to create the superposition.'
117 class(target_gstransformation_t),
intent(inout) :: tg
118 type(namespace_t),
intent(in) :: namespace
119 class(space_t),
intent(in) :: space
120 type(grid_t),
intent(in) :: gr
121 character(len=*),
intent(in) :: dir
122 type(ions_t),
intent(in) :: ions
123 type(hamiltonian_elec_t),
intent(in) :: hm
124 type(output_t),
intent(in) :: outp
128 call output_states(outp, namespace, space, trim(dir), tg%st, gr, ions, hm, -1)
138 real(real64) function target_j1_gstransformation(tg, namespace, gr, kpoints, qcpsi, ions) result(j1)
139 class(target_gstransformation_t),
intent(inout) :: tg
140 type(namespace_t),
intent(in) :: namespace
141 type(grid_t),
intent(in) :: gr
142 type(kpoints_t),
intent(in) :: kpoints
143 type(opt_control_state_t),
intent(inout) :: qcpsi
144 type(ions_t),
optional,
intent(in) :: ions
148 complex(real64),
allocatable :: zpsi(:, :), zst(:, :)
149 type(states_elec_t),
pointer :: psi
151 push_sub(target_j1_gstransformation)
155 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
156 safe_allocate(zst(1:gr%np, 1:tg%st%d%dim))
160 do ist = psi%st_start, psi%st_end
165 j1 = j1 + abs(
zmf_dotp(gr, psi%d%dim, zpsi, zst))**2
170 safe_deallocate_a(zpsi)
171 safe_deallocate_a(zst)
174 pop_sub(target_j1_gstransformation)
182 type(namespace_t),
intent(in) :: namespace
183 type(grid_t),
intent(in) :: gr
184 type(kpoints_t),
intent(in) :: kpoints
185 type(opt_control_state_t),
target,
intent(inout) :: qcpsi_in
186 type(opt_control_state_t),
target,
intent(inout) :: qcchi_out
187 type(ions_t),
intent(in) :: ions
190 complex(real64) :: olap
191 complex(real64),
allocatable :: zpsi(:, :), zst(:, :), zchi(:, :)
192 type(states_elec_t),
pointer :: psi_in, chi_out
196 psi_in => opt_control_point_qs(qcpsi_in)
197 chi_out => opt_control_point_qs(qcchi_out)
199 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
200 safe_allocate(zst(1:gr%np, 1:tg%st%d%dim))
201 safe_allocate(zchi(1:gr%np, 1:tg%st%d%dim))
203 do ik = 1, psi_in%nik
204 do ist = psi_in%st_start, psi_in%st_end
206 call states_elec_get_state(psi_in, gr, ist, ik, zpsi)
207 call states_elec_get_state(tg%st, gr, ist, ik, zst)
209 olap = zmf_dotp(gr, zst(:, 1), zpsi(:, 1))
210 zchi(1:gr%np, 1:tg%st%d%dim) = olap*zst(1:gr%np, 1:tg%st%d%dim)
212 call states_elec_set_state(chi_out, gr, ist, ik, zchi)
217 safe_deallocate_a(zpsi)
218 safe_deallocate_a(zst)
219 safe_deallocate_a(zchi)
This module implements a calculator for the density and defines related functions.
subroutine, public density_calc(st, gr, density, istin)
Computes the density from the orbitals in st.
real(real64), parameter, public m_zero
This module implements the underlying real-space grid.
subroutine, public io_mkdir(fname, namespace, parents)
This module defines various routines, operating on mesh functions.
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_info(no_lines, iunit, debug_only, stress, all_nodes, 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
this module contains the output system
subroutine, public output_states(outp, namespace, space, dir, st, gr, ions, hm, iter)
logical function, public parse_is_defined(namespace, name)
This module handles reading and writing restart information for the states_elec_t.
subroutine, public states_elec_transform(st, namespace, space, restart, mesh, kpoints, prefix)
Optimal-control targets: abstract base class and public interface.
Abstract optimal-control target.