Octopus
target_oct_m Module Reference

Optimal-control targets: abstract base class and public interface. More...

Detailed Description

Optimal-control targets: abstract base class and public interface.

target_t is the abstract base class for all optimal-control targets. Each concrete target (ground state, density, HHG, ...) lives in its own module as a type extending target_t and implementing the deferred bindings below; instances are created through target_factory_oct_m. The shared components (st, dt, move_ions, curr_functional, type) are common to every target; everything specific to one kind belongs in the corresponding derived type.

Historically the dispatch went through a large select case (tgtype) block that forced this module to use every concrete target module. The behaviour now lives in the derived classes and the public routines below are thin wrappers that dispatch dynamically, so this module no longer depends on the individual target_* implementation modules and they can compile independently.

Data Types

interface  target_chi_i
 Apply the target operator to build the chi boundary condition. More...
 
interface  target_init_i
 Read the target definition from the input file. More...
 
interface  target_j1_i
 Evaluate the target functional J1. More...
 
interface  target_output_i
 Write target-specific output. More...
 
type  target_t
 Abstract optimal-control target. More...
 

Functions/Subroutines

subroutine, public target_init_propagation (tg)
 This routine performs all the things that must be initialized prior to a forward evolution, regarding the target. More...
 
subroutine, public target_get_state (tg, st)
 This just copies the states_elec_t variable present in target, into st. More...
 
subroutine, public target_end (tg, oct)
 
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 functional: \( <Psi(t)|\hat{O}(t)|Psi(t)> \). More...
 
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. More...
 
real(real64) function, public target_j1 (tg, namespace, gr, kpoints, qcpsi, ions)
 Calculates the J1 functional, i.e.: \( <Psi(T)|\hat{O}|Psi(T)> \) in the time-independent case, or else \( \int_0^T dt <Psi(t)|\hat{O}(t)|Psi(t)> \) in the time-dependent case. More...
 
subroutine, public target_chi (tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
 Calculate \( |chi(T)> = \hat{O}(T) |psi(T)> \). More...
 
subroutine target_cleanup_default (tg, oct)
 Default cleanup: nothing to release. More...
 
subroutine target_tdcalc_default (tg, namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
 Default tdcalc: static targets accumulate nothing in time. More...
 
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 internal error. More...
 
subroutine target_init_propagation_default (tg)
 Default init_propagation: nothing to reset. More...
 
integer pure function, public target_mode (tg)
 
integer pure function, public target_type (tg)
 
integer pure function, public target_curr_functional (tg)
 
logical pure function, public target_move_ions (tg)
 

Variables

integer, parameter, public oct_tg_groundstate = 1
 
integer, parameter, public oct_tg_excited = 2
 
integer, parameter, public oct_tg_gstransformation = 3
 
integer, parameter, public oct_tg_userdefined = 4
 
integer, parameter, public oct_tg_jdensity = 5
 
integer, parameter, public oct_tg_local = 6
 
integer, parameter, public oct_tg_td_local = 7
 
integer, parameter, public oct_tg_exclude_state = 8
 
integer, parameter, public oct_tg_hhg = 9
 
integer, parameter, public oct_tg_velocity = 10
 
integer, parameter, public oct_tg_hhgnew = 12
 
integer, parameter, public oct_tg_classical = 13
 
integer, parameter, public oct_tg_spin = 14
 
integer, parameter, public oct_targetmode_static = 0
 
integer, parameter, public oct_targetmode_td = 1
 
integer, parameter, public oct_no_curr = 0
 
integer, parameter, public oct_curr_square = 1
 
integer, parameter, public oct_max_curr_ring = 2
 
integer, parameter, public oct_curr_square_td = 3
 

Function/Subroutine Documentation

◆ target_init_propagation()

subroutine, public target_oct_m::target_init_propagation ( class(target_t), intent(inout)  tg)

This routine performs all the things that must be initialized prior to a forward evolution, regarding the target.

Definition at line 276 of file target.F90.

◆ target_get_state()

subroutine, public target_oct_m::target_get_state ( class(target_t), intent(in)  tg,
type(states_elec_t), intent(inout)  st 
)

This just copies the states_elec_t variable present in target, into st.

Definition at line 288 of file target.F90.

◆ target_end()

subroutine, public target_oct_m::target_end ( class(target_t), intent(inout)  tg,
type(oct_t), intent(in)  oct 
)

Definition at line 301 of file target.F90.

◆ target_output()

subroutine, public target_oct_m::target_output ( class(target_t), intent(inout)  tg,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(grid_t), intent(in)  gr,
character(len=*), intent(in)  dir,
type(ions_t), intent(in)  ions,
type(hamiltonian_elec_t), intent(in)  hm,
type(output_t), intent(in)  outp 
)

Definition at line 316 of file target.F90.

◆ target_tdcalc()

subroutine, public target_oct_m::target_tdcalc ( class(target_t), intent(inout)  tg,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(hamiltonian_elec_t), intent(inout)  hm,
type(grid_t), intent(in)  gr,
type(ions_t), intent(inout)  ions,
type(partner_list_t), intent(in)  ext_partners,
type(states_elec_t), intent(inout)  psi,
integer, intent(in)  time,
integer, intent(in)  max_time 
)

Calculates, at a given point in time marked by the integer index, the integrand of the target functional: \( <Psi(t)|\hat{O}(t)|Psi(t)> \).

Definition at line 339 of file target.F90.

◆ target_inh()

subroutine, public target_oct_m::target_inh ( type(states_elec_t), intent(inout)  psi,
type(grid_t), intent(in)  gr,
type(kpoints_t), intent(in)  kpoints,
class(target_t), intent(inout)  tg,
real(real64), intent(in)  time,
type(states_elec_t), intent(inout)  inh,
integer, intent(in)  iter 
)

Calculates the inhomogeneous term that appears in the equation for chi, and places it into inh.

Definition at line 365 of file target.F90.

◆ target_j1()

real(real64) function, public target_oct_m::target_j1 ( class(target_t), intent(inout)  tg,
type(namespace_t), intent(in)  namespace,
type(grid_t), intent(in)  gr,
type(kpoints_t), intent(in)  kpoints,
type(opt_control_state_t), intent(inout)  qcpsi,
type(ions_t), intent(in), optional  ions 
)

Calculates the J1 functional, i.e.: \( <Psi(T)|\hat{O}|Psi(T)> \) in the time-independent case, or else \( \int_0^T dt <Psi(t)|\hat{O}(t)|Psi(t)> \) in the time-dependent case.

Definition at line 388 of file target.F90.

◆ target_chi()

subroutine, public target_oct_m::target_chi ( class(target_t), intent(inout)  tg,
type(namespace_t), intent(in)  namespace,
type(grid_t), intent(in)  gr,
type(kpoints_t), intent(in)  kpoints,
type(opt_control_state_t), intent(inout), target  qcpsi_in,
type(opt_control_state_t), intent(inout), target  qcchi_out,
type(ions_t), intent(in)  ions 
)

Calculate \( |chi(T)> = \hat{O}(T) |psi(T)> \).

Definition at line 407 of file target.F90.

◆ target_cleanup_default()

subroutine target_oct_m::target_cleanup_default ( class(target_t), intent(inout)  tg,
type(oct_t), intent(in)  oct 
)
private

Default cleanup: nothing to release.

Definition at line 437 of file target.F90.

◆ target_tdcalc_default()

subroutine target_oct_m::target_tdcalc_default ( class(target_t), intent(inout)  tg,
type(namespace_t), intent(in)  namespace,
class(space_t), intent(in)  space,
type(hamiltonian_elec_t), intent(inout)  hm,
type(grid_t), intent(in)  gr,
type(ions_t), intent(inout)  ions,
type(partner_list_t), intent(in)  ext_partners,
type(states_elec_t), intent(inout)  psi,
integer, intent(in)  time,
integer, intent(in)  max_time 
)
private

Default tdcalc: static targets accumulate nothing in time.

Definition at line 449 of file target.F90.

◆ target_inh_default()

subroutine target_oct_m::target_inh_default ( class(target_t), intent(inout)  tg,
type(states_elec_t), intent(inout)  psi,
type(grid_t), intent(in)  gr,
type(kpoints_t), intent(in)  kpoints,
real(real64), intent(in)  time,
type(states_elec_t), intent(inout)  inh,
integer, intent(in)  iter 
)
private

Default inh: only time-dependent targets define an inhomogeneous term, so reaching here is an internal error.

Definition at line 469 of file target.F90.

◆ target_init_propagation_default()

subroutine target_oct_m::target_init_propagation_default ( class(target_t), intent(inout)  tg)
private

Default init_propagation: nothing to reset.

Definition at line 486 of file target.F90.

◆ target_mode()

integer pure function, public target_oct_m::target_mode ( class(target_t), intent(in)  tg)

Definition at line 496 of file target.F90.

◆ target_type()

integer pure function, public target_oct_m::target_type ( class(target_t), intent(in)  tg)

Definition at line 518 of file target.F90.

◆ target_curr_functional()

integer pure function, public target_oct_m::target_curr_functional ( class(target_t), intent(in)  tg)

Definition at line 526 of file target.F90.

◆ target_move_ions()

logical pure function, public target_oct_m::target_move_ions ( class(target_t), intent(in)  tg)

Definition at line 534 of file target.F90.

Variable Documentation

◆ oct_tg_groundstate

integer, parameter, public target_oct_m::oct_tg_groundstate = 1

Definition at line 246 of file target.F90.

◆ oct_tg_excited

integer, parameter, public target_oct_m::oct_tg_excited = 2

Definition at line 246 of file target.F90.

◆ oct_tg_gstransformation

integer, parameter, public target_oct_m::oct_tg_gstransformation = 3

Definition at line 246 of file target.F90.

◆ oct_tg_userdefined

integer, parameter, public target_oct_m::oct_tg_userdefined = 4

Definition at line 246 of file target.F90.

◆ oct_tg_jdensity

integer, parameter, public target_oct_m::oct_tg_jdensity = 5

Definition at line 246 of file target.F90.

◆ oct_tg_local

integer, parameter, public target_oct_m::oct_tg_local = 6

Definition at line 246 of file target.F90.

◆ oct_tg_td_local

integer, parameter, public target_oct_m::oct_tg_td_local = 7

Definition at line 246 of file target.F90.

◆ oct_tg_exclude_state

integer, parameter, public target_oct_m::oct_tg_exclude_state = 8

Definition at line 246 of file target.F90.

◆ oct_tg_hhg

integer, parameter, public target_oct_m::oct_tg_hhg = 9

Definition at line 246 of file target.F90.

◆ oct_tg_velocity

integer, parameter, public target_oct_m::oct_tg_velocity = 10

Definition at line 246 of file target.F90.

◆ oct_tg_hhgnew

integer, parameter, public target_oct_m::oct_tg_hhgnew = 12

Definition at line 246 of file target.F90.

◆ oct_tg_classical

integer, parameter, public target_oct_m::oct_tg_classical = 13

Definition at line 246 of file target.F90.

◆ oct_tg_spin

integer, parameter, public target_oct_m::oct_tg_spin = 14

Definition at line 246 of file target.F90.

◆ oct_targetmode_static

integer, parameter, public target_oct_m::oct_targetmode_static = 0

Definition at line 261 of file target.F90.

◆ oct_targetmode_td

integer, parameter, public target_oct_m::oct_targetmode_td = 1

Definition at line 261 of file target.F90.

◆ oct_no_curr

integer, parameter, public target_oct_m::oct_no_curr = 0

Definition at line 265 of file target.F90.

◆ oct_curr_square

integer, parameter, public target_oct_m::oct_curr_square = 1

Definition at line 265 of file target.F90.

◆ oct_max_curr_ring

integer, parameter, public target_oct_m::oct_max_curr_ring = 2

Definition at line 265 of file target.F90.

◆ oct_curr_square_td

integer, parameter, public target_oct_m::oct_curr_square_td = 3

Definition at line 265 of file target.F90.