Octopus
controlfunction_oct_m Module Reference

This module contains the definition of the data type that holds a "control function" used for OCT runs. More...

Detailed Description

This module contains the definition of the data type that holds a "control function" used for OCT runs.

In addition, the module also contains the necessary procedures to manipulate these objects.

Data Types

type  controlfunction_common_t
 This data type contains information that is filled when the module is initialized ("controlfunction_mod_init"), and stored while the module is in use (until "controlfunction_mod_close" is called). It is information more or less common to all control functions. More...
 
type  controlfunction_t
 This is the data type used to hold a control function. More...
 

Functions/Subroutines

subroutine, public controlfunction_mod_init (ext_partners, namespace, dt, max_iter, mode_fixed_fluence)
 Initializes the module, should be the first subroutine to be called (the last one should be controlfunction_mod_close, when the module is no longer to be used). More...
 
subroutine, public controlfunction_init (cp, dt, ntiter)
 Before using an controlfunction_t variable, it needs to be initialized, either by calling controlfunction_init, or by copying another initialized variable through controlfunction_copy. More...
 
subroutine, public controlfunction_set (cp, ext_partners)
 The external fields defined in epot_t "ep" are transferred to the control functions described in "cp". This should have been initialized previously. More...
 
integer pure function, public controlfunction_representation ()
 Returns the representation type for the control functions used in the OCT run. More...
 
integer pure function, public controlfunction_mode ()
 Returns the "mode" of the control function, i.e. if it is the full pulse, the envelope, or the phase. More...
 
subroutine, public controlfunction_prepare_initial (par)
 "Prepares" the initial guess control field: maybe it has to be normalized to a certain fluence, maybe it should be randomized, etc. More...
 
subroutine, public controlfunction_set_rep (par)
 Transforms the control function to frequency space, if this is the space in which the functions are defined (and it is necessary to perform the transformation). And, transforms the control function to real-time space, if this is the space in which the functions are defined (and it is necessary to perform the transformation). More...
 
subroutine, public controlfunction_to_basis (par)
 
subroutine, public controlfunction_to_realtime (par)
 
real(real64) function, public controlfunction_diff (pp, qq)
 
subroutine, public controlfunction_apply_envelope (cp)
 
subroutine, public controlfunction_to_h (cp, ext_partners)
 
subroutine, public controlfunction_to_h_val (cp, ext_partners, val)
 
subroutine, public controlfunction_end (cp)
 
subroutine, public controlfunction_write (filename, cp, namespace)
 
real(real64) function, public controlfunction_fluence (par)
 
real(real64) function, public controlfunction_j2 (par)
 
subroutine, public controlfunction_set_fluence (par)
 
subroutine, public controlfunction_set_alpha (par, alpha)
 
subroutine, public controlfunction_copy (cp_out, cp_in)
 
subroutine, public controlfunction_randomize (par)
 
subroutine, public controlfunction_update (cp, cpp, dir, iter, mu, dd, dq)
 Update the control function(s) given in "cp", according to the formula cp = (1 - mu) * cpp + mu * dd / (td_penalty - 2 * dq) More...
 
real(real64) pure function, public controlfunction_alpha (par, ipar)
 
real(real64) pure function, public controlfunction_targetfluence ()
 
integer pure function, public controlfunction_number (par)
 
subroutine, public controlfunction_bounds (par, lower_bounds, upper_bounds)
 
integer pure function, public controlfunction_dof (par)
 
real(real64) pure function, public controlfunction_w0 (par)
 
subroutine, public controlfunction_filter (par, filter)
 
subroutine, public controlfunction_mod_close ()
 
subroutine controlfunction_deltaedeltau (par, dedu)
 
subroutine controlfunction_der (par, depsilon, i)
 controlfunction_der computes the derivative of a controlfunction with respect to one of its degrees of freedom. More...
 
subroutine, public controlfunction_gradient (par, par_output, grad)
 controlfunction_gradient computes the (minus the) gradient of the J functional with respect to the parameters. More...
 
subroutine controlfunction_basis_to_theta (par)
 
subroutine controlfunction_theta_to_basis (par)
 
subroutine, public controlfunction_get_theta (par, theta)
 
subroutine, public controlfunction_set_theta (par, theta)
 
subroutine controlfunction_trans_matrix (par)
 

Variables

integer, parameter, public ctr_internal = 1
 
integer, parameter, public ctr_fourier_series_h = 3
 
integer, parameter, public ctr_zero_fourier_series_h = 4
 
integer, parameter, public ctr_fourier_series = 5
 
integer, parameter, public ctr_zero_fourier_series = 6
 
integer, parameter, public ctr_rt = 7
 
integer, parameter, public controlfunction_mode_none = 0
 
integer, parameter, public controlfunction_mode_epsilon = 1
 
integer, parameter, public controlfunction_mode_f = 2
 
logical cf_common_initialized = .false.
 
type(controlfunction_common_tcf_common
 

Function/Subroutine Documentation

◆ controlfunction_mod_init()

subroutine, public controlfunction_oct_m::controlfunction_mod_init ( type(partner_list_t), intent(in)  ext_partners,
type(namespace_t), intent(in)  namespace,
real(real64), intent(in)  dt,
integer, intent(in)  max_iter,
logical, intent(out)  mode_fixed_fluence 
)

Initializes the module, should be the first subroutine to be called (the last one should be controlfunction_mod_close, when the module is no longer to be used).

It fills the module variable "cf_common", whose type is controlfunction_common_t, with information obtained from the inp file.

Output argument "mode_fixed_fluence" is also given a value, depending on whether the user requires a fixed-fluence run (.true.) or not (.false.).

Definition at line 266 of file controlfunction.F90.

◆ controlfunction_init()

subroutine, public controlfunction_oct_m::controlfunction_init ( type(controlfunction_t), intent(inout)  cp,
real(real64), intent(in)  dt,
integer, intent(in)  ntiter 
)

Before using an controlfunction_t variable, it needs to be initialized, either by calling controlfunction_init, or by copying another initialized variable through controlfunction_copy.

Definition at line 610 of file controlfunction.F90.

◆ controlfunction_set()

subroutine, public controlfunction_oct_m::controlfunction_set ( type(controlfunction_t), intent(inout)  cp,
type(partner_list_t), intent(in)  ext_partners 
)

The external fields defined in epot_t "ep" are transferred to the control functions described in "cp". This should have been initialized previously.

Definition at line 712 of file controlfunction.F90.

◆ controlfunction_representation()

integer pure function, public controlfunction_oct_m::controlfunction_representation

Returns the representation type for the control functions used in the OCT run.

Definition at line 738 of file controlfunction.F90.

◆ controlfunction_mode()

integer pure function, public controlfunction_oct_m::controlfunction_mode

Returns the "mode" of the control function, i.e. if it is the full pulse, the envelope, or the phase.

Definition at line 746 of file controlfunction.F90.

◆ controlfunction_prepare_initial()

subroutine, public controlfunction_oct_m::controlfunction_prepare_initial ( type(controlfunction_t), intent(inout)  par)

"Prepares" the initial guess control field: maybe it has to be normalized to a certain fluence, maybe it should be randomized, etc.

Definition at line 754 of file controlfunction.F90.

◆ controlfunction_set_rep()

subroutine, public controlfunction_oct_m::controlfunction_set_rep ( type(controlfunction_t), intent(inout)  par)

Transforms the control function to frequency space, if this is the space in which the functions are defined (and it is necessary to perform the transformation). And, transforms the control function to real-time space, if this is the space in which the functions are defined (and it is necessary to perform the transformation).

Definition at line 789 of file controlfunction.F90.

◆ controlfunction_to_basis()

subroutine, public controlfunction_oct_m::controlfunction_to_basis ( type(controlfunction_t), intent(inout)  par)

Definition at line 808 of file controlfunction.F90.

◆ controlfunction_to_realtime()

subroutine, public controlfunction_oct_m::controlfunction_to_realtime ( type(controlfunction_t), intent(inout)  par)

Definition at line 853 of file controlfunction.F90.

◆ controlfunction_diff()

real(real64) function, public controlfunction_oct_m::controlfunction_diff ( type(controlfunction_t), intent(in)  pp,
type(controlfunction_t), intent(in)  qq 
)

Definition at line 895 of file controlfunction.F90.

◆ controlfunction_apply_envelope()

subroutine, public controlfunction_oct_m::controlfunction_apply_envelope ( type(controlfunction_t), intent(inout)  cp)

Definition at line 915 of file controlfunction.F90.

◆ controlfunction_to_h()

subroutine, public controlfunction_oct_m::controlfunction_to_h ( type(controlfunction_t), intent(in)  cp,
type(partner_list_t), intent(in)  ext_partners 
)

Definition at line 938 of file controlfunction.F90.

◆ controlfunction_to_h_val()

subroutine, public controlfunction_oct_m::controlfunction_to_h_val ( type(controlfunction_t), intent(in)  cp,
type(partner_list_t), intent(in)  ext_partners,
integer, intent(in)  val 
)

Definition at line 969 of file controlfunction.F90.

◆ controlfunction_end()

subroutine, public controlfunction_oct_m::controlfunction_end ( type(controlfunction_t), intent(inout)  cp)

Definition at line 992 of file controlfunction.F90.

◆ controlfunction_write()

subroutine, public controlfunction_oct_m::controlfunction_write ( character(len=*), intent(in)  filename,
type(controlfunction_t), intent(in)  cp,
type(namespace_t), intent(in)  namespace 
)

Definition at line 1016 of file controlfunction.F90.

◆ controlfunction_fluence()

real(real64) function, public controlfunction_oct_m::controlfunction_fluence ( type(controlfunction_t), intent(in)  par)

Definition at line 1170 of file controlfunction.F90.

◆ controlfunction_j2()

real(real64) function, public controlfunction_oct_m::controlfunction_j2 ( type(controlfunction_t), intent(in)  par)

Definition at line 1207 of file controlfunction.F90.

◆ controlfunction_set_fluence()

subroutine, public controlfunction_oct_m::controlfunction_set_fluence ( type(controlfunction_t), intent(inout)  par)

Definition at line 1260 of file controlfunction.F90.

◆ controlfunction_set_alpha()

subroutine, public controlfunction_oct_m::controlfunction_set_alpha ( type(controlfunction_t), intent(inout)  par,
real(real64), intent(in)  alpha 
)

Definition at line 1280 of file controlfunction.F90.

◆ controlfunction_copy()

subroutine, public controlfunction_oct_m::controlfunction_copy ( type(controlfunction_t), intent(inout)  cp_out,
type(controlfunction_t), intent(in)  cp_in 
)

Definition at line 1295 of file controlfunction.F90.

◆ controlfunction_randomize()

subroutine, public controlfunction_oct_m::controlfunction_randomize ( type(controlfunction_t), intent(inout)  par)

Definition at line 1330 of file controlfunction.F90.

◆ controlfunction_update()

subroutine, public controlfunction_oct_m::controlfunction_update ( type(controlfunction_t), intent(inout)  cp,
type(controlfunction_t), intent(in)  cpp,
character(len=1), intent(in)  dir,
integer, intent(in)  iter,
real(real64), intent(in)  mu,
real(real64), dimension(:), intent(in)  dd,
complex(real64), dimension(:), intent(in)  dq 
)

Update the control function(s) given in "cp", according to the formula cp = (1 - mu) * cpp + mu * dd / (td_penalty - 2 * dq)

Definition at line 1354 of file controlfunction.F90.

◆ controlfunction_alpha()

real(real64) pure function, public controlfunction_oct_m::controlfunction_alpha ( type(controlfunction_t), intent(in)  par,
integer, intent(in)  ipar 
)

Definition at line 1394 of file controlfunction.F90.

◆ controlfunction_targetfluence()

real(real64) pure function, public controlfunction_oct_m::controlfunction_targetfluence

Definition at line 1403 of file controlfunction.F90.

◆ controlfunction_number()

integer pure function, public controlfunction_oct_m::controlfunction_number ( type(controlfunction_t), intent(in)  par)

Definition at line 1410 of file controlfunction.F90.

◆ controlfunction_bounds()

subroutine, public controlfunction_oct_m::controlfunction_bounds ( type(controlfunction_t), intent(in)  par,
real(real64), dimension(:), intent(out)  lower_bounds,
real(real64), dimension(:), intent(out)  upper_bounds 
)

Definition at line 1418 of file controlfunction.F90.

◆ controlfunction_dof()

integer pure function, public controlfunction_oct_m::controlfunction_dof ( type(controlfunction_t), intent(in)  par)

Definition at line 1443 of file controlfunction.F90.

◆ controlfunction_w0()

real(real64) pure function, public controlfunction_oct_m::controlfunction_w0 ( type(controlfunction_t), intent(in)  par)

Definition at line 1451 of file controlfunction.F90.

◆ controlfunction_filter()

subroutine, public controlfunction_oct_m::controlfunction_filter ( type(controlfunction_t), intent(inout)  par,
type(filter_t), intent(inout)  filter 
)

Definition at line 1459 of file controlfunction.F90.

◆ controlfunction_mod_close()

subroutine, public controlfunction_oct_m::controlfunction_mod_close

Definition at line 1481 of file controlfunction.F90.

◆ controlfunction_deltaedeltau()

subroutine controlfunction_oct_m::controlfunction_deltaedeltau ( type(controlfunction_t), intent(in)  par,
real(real64), dimension(:, :), intent(inout)  dedu 
)
private
Parameters
[in,out]dedu(1:dof, 1:dim)

Definition at line 1506 of file controlfunction.F90.

◆ controlfunction_der()

subroutine controlfunction_oct_m::controlfunction_der ( type(controlfunction_t), intent(in)  par,
type(tdf_t), intent(inout)  depsilon,
integer, intent(in)  i 
)
private

controlfunction_der computes the derivative of a controlfunction with respect to one of its degrees of freedom.

Definition at line 1567 of file controlfunction.F90.

◆ controlfunction_gradient()

subroutine, public controlfunction_oct_m::controlfunction_gradient ( type(controlfunction_t), intent(in)  par,
type(controlfunction_t), intent(in)  par_output,
real(real64), dimension(:), intent(inout)  grad 
)

controlfunction_gradient computes the (minus the) gradient of the J functional with respect to the parameters.

Definition at line 1589 of file controlfunction.F90.

◆ controlfunction_basis_to_theta()

subroutine controlfunction_oct_m::controlfunction_basis_to_theta ( type(controlfunction_t), intent(inout)  par)
private

Definition at line 1648 of file controlfunction.F90.

◆ controlfunction_theta_to_basis()

subroutine controlfunction_oct_m::controlfunction_theta_to_basis ( type(controlfunction_t), intent(inout)  par)
private

Definition at line 1735 of file controlfunction.F90.

◆ controlfunction_get_theta()

subroutine, public controlfunction_oct_m::controlfunction_get_theta ( type(controlfunction_t), intent(in)  par,
real(real64), dimension(:), intent(inout)  theta 
)

Definition at line 1824 of file controlfunction.F90.

◆ controlfunction_set_theta()

subroutine, public controlfunction_oct_m::controlfunction_set_theta ( type(controlfunction_t), intent(inout)  par,
real(real64), dimension(:), intent(in)  theta 
)

Definition at line 1837 of file controlfunction.F90.

◆ controlfunction_trans_matrix()

subroutine controlfunction_oct_m::controlfunction_trans_matrix ( type(controlfunction_t), intent(inout)  par)
private

Definition at line 1850 of file controlfunction.F90.

Variable Documentation

◆ ctr_internal

integer, parameter, public controlfunction_oct_m::ctr_internal = 1

Definition at line 180 of file controlfunction.F90.

◆ ctr_fourier_series_h

integer, parameter, public controlfunction_oct_m::ctr_fourier_series_h = 3

Definition at line 180 of file controlfunction.F90.

◆ ctr_zero_fourier_series_h

integer, parameter, public controlfunction_oct_m::ctr_zero_fourier_series_h = 4

Definition at line 180 of file controlfunction.F90.

◆ ctr_fourier_series

integer, parameter, public controlfunction_oct_m::ctr_fourier_series = 5

Definition at line 180 of file controlfunction.F90.

◆ ctr_zero_fourier_series

integer, parameter, public controlfunction_oct_m::ctr_zero_fourier_series = 6

Definition at line 180 of file controlfunction.F90.

◆ ctr_rt

integer, parameter, public controlfunction_oct_m::ctr_rt = 7

Definition at line 180 of file controlfunction.F90.

◆ controlfunction_mode_none

integer, parameter, public controlfunction_oct_m::controlfunction_mode_none = 0

Definition at line 190 of file controlfunction.F90.

◆ controlfunction_mode_epsilon

integer, parameter, public controlfunction_oct_m::controlfunction_mode_epsilon = 1

Definition at line 190 of file controlfunction.F90.

◆ controlfunction_mode_f

integer, parameter, public controlfunction_oct_m::controlfunction_mode_f = 2

Definition at line 190 of file controlfunction.F90.

◆ cf_common_initialized

logical controlfunction_oct_m::cf_common_initialized = .false.
private

Definition at line 253 of file controlfunction.F90.

◆ cf_common

type(controlfunction_common_t) controlfunction_oct_m::cf_common
private

Definition at line 254 of file controlfunction.F90.