45 use,
intrinsic :: iso_fortran_env
80 type(states_elec_t) :: st
83 integer :: curr_functional
85 procedure(target_init_i),
deferred :: init
86 procedure(target_j1_i),
deferred :: j1
87 procedure(target_chi_i),
deferred :: apply_chi
88 procedure(target_output_i),
deferred :: output
97 subroutine target_init_i(tg, gr, kpoints, namespace, space, ions, qcs, td, w0, oct, ep, restart)
100 class(target_t),
intent(inout) :: tg
101 type(grid_t),
intent(in) :: gr
102 type(kpoints_t),
intent(in) :: kpoints
103 type(namespace_t),
intent(in) :: namespace
104 class(space_t),
intent(in) :: space
105 type(ions_t),
intent(in) :: ions
106 type(opt_control_state_t),
intent(inout) :: qcs
107 type(td_t),
intent(in) :: td
108 real(real64),
intent(in) :: w0
109 type(oct_t),
intent(in) :: oct
110 type(epot_t),
intent(inout) :: ep
111 type(restart_t),
intent(inout) :: restart
115 real(real64) function target_j1_i(tg, namespace, gr, kpoints, qcpsi, ions) result(j1)
117 class(target_t),
intent(inout) :: tg
118 type(namespace_t),
intent(in) :: namespace
119 type(grid_t),
intent(in) :: gr
120 type(kpoints_t),
intent(in) :: kpoints
121 type(opt_control_state_t),
intent(inout) :: qcpsi
122 type(ions_t),
optional,
intent(in) :: ions
126 subroutine target_chi_i(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
128 class(target_t),
intent(inout) :: tg
129 type(namespace_t),
intent(in) :: namespace
130 type(grid_t),
intent(in) :: gr
131 type(kpoints_t),
intent(in) :: kpoints
132 type(opt_control_state_t),
target,
intent(inout) :: qcpsi_in
133 type(opt_control_state_t),
target,
intent(inout) :: qcchi_out
134 type(ions_t),
intent(in) :: ions
138 subroutine target_output_i(tg, namespace, space, gr, dir, ions, hm, outp)
140 class(target_t),
intent(inout) :: tg
141 type(namespace_t),
intent(in) :: namespace
142 class(space_t),
intent(in) :: space
143 type(grid_t),
intent(in) :: gr
144 character(len=*),
intent(in) :: dir
145 type(ions_t),
intent(in) :: ions
146 type(hamiltonian_elec_t),
intent(in) :: hm
147 type(output_t),
intent(in) :: outp
151 integer,
public,
parameter :: &
152 oct_tg_groundstate = 1, &
166 integer,
public,
parameter :: &
167 oct_targetmode_static = 0, &
170 integer,
public,
parameter :: &
185 call tg%init_propagation()
195 type(states_elec_t),
intent(inout) :: st
198 call states_elec_copy(st, tg%st)
207 class(
target_t),
intent(inout) :: tg
208 type(oct_t),
intent(in) :: oct
212 call states_elec_end(tg%st)
222 class(
target_t),
intent(inout) :: tg
223 type(namespace_t),
intent(in) :: namespace
224 class(space_t),
intent(in) :: space
225 type(grid_t),
intent(in) :: gr
226 character(len=*),
intent(in) :: dir
227 type(ions_t),
intent(in) :: ions
228 type(hamiltonian_elec_t),
intent(in) :: hm
229 type(output_t),
intent(in) :: outp
233 call tg%output(namespace, space, gr, dir, ions, hm, outp)
244 subroutine target_tdcalc(tg, namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
245 class(
target_t),
intent(inout) :: tg
246 type(namespace_t),
intent(in) :: namespace
247 class(space_t),
intent(in) :: space
248 type(hamiltonian_elec_t),
intent(inout) :: hm
249 type(grid_t),
intent(in) :: gr
250 type(ions_t),
intent(inout) :: ions
251 type(partner_list_t),
intent(in) :: ext_partners
252 type(states_elec_t),
intent(inout) :: psi
253 integer,
intent(in) :: time
254 integer,
intent(in) :: max_time
260 call tg%tdcalc(namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
270 subroutine target_inh(psi, gr, kpoints, tg, time, inh, iter)
271 type(states_elec_t),
intent(inout) :: psi
272 type(grid_t),
intent(in) :: gr
273 type(kpoints_t),
intent(in) :: kpoints
274 class(
target_t),
intent(inout) :: tg
275 real(real64),
intent(in) :: time
276 type(states_elec_t),
intent(inout) :: inh
277 integer,
intent(in) :: iter
281 call tg%inh(psi, gr, kpoints, time, inh, iter)
293 real(real64) function
target_j1(tg, namespace, gr, kpoints, qcpsi, ions) result(j1)
294 class(
target_t),
intent(inout) :: tg
295 type(namespace_t),
intent(in) :: namespace
296 type(grid_t),
intent(in) :: gr
297 type(kpoints_t),
intent(in) :: kpoints
298 type(opt_control_state_t),
intent(inout) :: qcpsi
299 type(ions_t),
optional,
intent(in) :: ions
303 j1 = tg%j1(namespace, gr, kpoints, qcpsi, ions)
312 subroutine target_chi(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
313 class(
target_t),
intent(inout) :: tg
314 type(namespace_t),
intent(in) :: namespace
315 type(grid_t),
intent(in) :: gr
316 type(kpoints_t),
intent(in) :: kpoints
317 type(opt_control_state_t),
target,
intent(inout) :: qcpsi_in
318 type(opt_control_state_t),
target,
intent(inout) :: qcchi_out
319 type(ions_t),
intent(in) :: ions
321 real(real64),
pointer :: q(:, :), p(:, :)
324 call tg%apply_chi(namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
328 q => opt_control_point_q(qcchi_out)
329 p => opt_control_point_p(qcchi_out)
343 class(
target_t),
intent(inout) :: tg
344 type(oct_t),
intent(in) :: oct
354 subroutine target_tdcalc_default(tg, namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
355 class(
target_t),
intent(inout) :: tg
356 type(namespace_t),
intent(in) :: namespace
357 class(space_t),
intent(in) :: space
358 type(hamiltonian_elec_t),
intent(inout) :: hm
359 type(grid_t),
intent(in) :: gr
360 type(ions_t),
intent(inout) :: ions
361 type(partner_list_t),
intent(in) :: ext_partners
362 type(states_elec_t),
intent(inout) :: psi
363 integer,
intent(in) :: time
364 integer,
intent(in) :: max_time
375 class(
target_t),
intent(inout) :: tg
376 type(states_elec_t),
intent(inout) :: psi
377 type(grid_t),
intent(in) :: gr
378 type(kpoints_t),
intent(in) :: kpoints
379 real(real64),
intent(in) :: time
380 type(states_elec_t),
intent(inout) :: inh
381 integer,
intent(in) :: iter
383 write(message(1),
'(a)')
'Internal error in target_inh'
384 call messages_fatal(1)
392 class(
target_t),
intent(inout) :: tg
404 select case (tg%type)
414 select case (tg%curr_functional)
439 logical pure function target_move_ions(tg)
Apply the target operator to build the chi boundary condition.
Read the target definition from the input file.
Evaluate the target functional J1.
Write target-specific output.
This module implements the underlying real-space grid.
This module defines classes and functions for interaction partners.
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.
this module contains the low-level part of the output system
Optimal-control targets: abstract base class and public interface.
integer, parameter, public oct_tg_jdensity
subroutine target_init_propagation_default(tg)
Default init_propagation: nothing to reset.
integer, parameter, public oct_targetmode_static
logical pure function, public target_move_ions(tg)
integer, parameter, public oct_tg_userdefined
integer, parameter, public oct_tg_hhgnew
integer, parameter, public oct_tg_spin
integer, parameter, public oct_targetmode_td
subroutine, public target_init_propagation(tg)
This routine performs all the things that must be initialized prior to a forward evolution,...
integer, parameter, public oct_max_curr_ring
real(real64) function, public target_j1(tg, namespace, gr, kpoints, qcpsi, ions)
Calculates the J1 functional, i.e.: in the time-independent case, or else in the time-dependent cas...
subroutine target_tdcalc_default(tg, namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
Default tdcalc: static targets accumulate nothing in time.
integer, parameter, public oct_curr_square_td
integer, parameter, public oct_curr_square
integer, parameter, public oct_tg_velocity
subroutine target_inh_default(tg, psi, gr, kpoints, time, inh, iter)
Default inh: only time-dependent targets define an inhomogeneous term, so reaching here is an interna...
integer, parameter, public oct_tg_excited
integer, parameter, public oct_tg_gstransformation
integer, parameter, public oct_tg_td_local
subroutine, public target_get_state(tg, st)
This just copies the states_elec_t variable present in target, into st.
integer, parameter, public oct_tg_local
integer pure function, public target_type(tg)
subroutine, public target_inh(psi, gr, kpoints, tg, time, inh, iter)
Calculates the inhomogeneous term that appears in the equation for chi, and places it into inh.
subroutine, public target_output(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine, public target_tdcalc(tg, namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
Calculates, at a given point in time marked by the integer index, the integrand of the target functio...
integer, parameter, public oct_tg_hhg
subroutine, public target_chi(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
Calculate .
subroutine, public target_end(tg, oct)
integer pure function, public target_mode(tg)
integer pure function, public target_curr_functional(tg)
integer, parameter, public oct_tg_classical
integer, parameter, public oct_tg_exclude_state
subroutine target_cleanup_default(tg, oct)
Default cleanup: nothing to release.
Description of the grid, containing information on derivatives, stencil, and symmetries.
!brief The oct_t datatype stores the basic information about how the OCT run is done.
This is the datatype that contains the objects that are propagated: in principle this could be both t...
Abstract optimal-control target.