39 use,
intrinsic :: iso_fortran_env
93 integer,
public,
parameter :: &
94 oct_tg_groundstate = 1, &
108 integer,
public,
parameter :: &
109 oct_targetmode_static = 0, &
112 integer,
public,
parameter :: &
121 type(states_elec_t) :: st
122 type(excited_states_t) :: est
123 real(real64),
allocatable :: rho(:)
124 real(real64),
allocatable :: td_fitness(:)
125 character(len=200) :: td_local_target
126 character(len=80) :: excluded_states_list
127 character(len=4096) :: vel_input_string
128 character(len=4096) :: classical_input_string
129 character(len=1024),
allocatable :: vel_der_array(:,:)
130 character(len=1024),
allocatable :: mom_der_array(:,:)
131 character(len=1024),
allocatable :: pos_der_array(:,:)
132 real(real64),
allocatable :: grad_local_pot(:,:,:)
135 integer,
allocatable :: hhg_k(:)
136 real(real64),
allocatable :: hhg_alpha(:)
137 real(real64),
allocatable :: hhg_a(:)
138 real(real64) :: hhg_w0
140 integer :: curr_functional
141 real(real64) :: density_weight
142 real(real64) :: curr_weight
143 integer :: strt_iter_curr_tg
144 real(real64),
allocatable :: spatial_curr_wgt(:)
145 character(len=1000) :: plateau_string
146 complex(real64),
allocatable :: acc(:, :)
147 complex(real64),
allocatable :: vel(:, :)
148 complex(real64),
allocatable :: gvec(:, :)
149 real(real64),
allocatable :: alpha(:)
150 complex(real64) :: spin_matrix(2, 2)
151 type(fft_t) :: fft_handler
162 type(target_t),
intent(inout) :: tg
165 select case (tg%type)
179 type(target_t),
intent(in) :: tg
180 type(states_elec_t),
intent(inout) :: st
192 subroutine target_init(gr, kpoints, namespace, space, ions, qcs, td, w0, tg, oct, ep, mc)
193 type(
grid_t),
intent(in) :: gr
196 class(
space_t),
intent(in) :: space
197 type(
ions_t),
intent(in) :: ions
199 type(
td_t),
intent(in) :: td
200 real(real64),
intent(in) :: w0
202 type(
oct_t),
intent(in) :: oct
203 type(
epot_t),
intent(inout) :: ep
287 message(1) =
"Could not read gs for OCTTargetOperator."
291 tg%curr_functional = oct_no_curr
293 select case (tg%type)
294 case (oct_tg_groundstate)
325 write(
message(1),
'(a)')
"Target Operator not properly defined."
340 type(
oct_t),
intent(in) :: oct
346 select case (tg%type)
347 case (oct_tg_groundstate)
379 subroutine target_output(tg, namespace, space, gr, dir, ions, hm, outp)
382 class(
space_t),
intent(in) :: space
383 type(
grid_t),
intent(in) :: gr
384 character(len=*),
intent(in) :: dir
385 type(
ions_t),
intent(in) :: ions
391 select case (tg%type)
392 case (oct_tg_groundstate)
427 subroutine target_tdcalc(tg, namespace, space, hm, gr, ions, ext_partners, psi, time, max_time)
430 class(
space_t),
intent(in) :: space
432 type(
grid_t),
intent(in) :: gr
433 type(
ions_t),
intent(inout) :: ions
436 integer,
intent(in) :: time
437 integer,
intent(in) :: max_time
443 tg%td_fitness(time) =
m_zero
445 select case (tg%type)
453 call target_tdcalc_hhg(tg, namespace, space, hm, gr, ions, ext_partners, psi, time)
457 message(1) =
'Error in target.target_tdcalc: default.'
470 subroutine target_inh(psi, gr, kpoints, tg, time, inh, iter)
475 real(real64),
intent(in) :: time
477 integer,
intent(in) :: iter
479 integer :: ik, ist, ip, idim, ib
480 complex(real64),
allocatable :: zpsi(:)
481 complex(real64) :: gvec(gr%box%dim)
485 safe_allocate(zpsi(1:gr%np))
487 select case (tg%type)
492 do ik = inh%d%kpt%start, inh%d%kpt%end
493 do ist = inh%st_start, inh%st_end
494 do idim = 1, inh%d%dim
496 zpsi(1:gr%np) = -psi%occ(ist, ik)*tg%rho(1:gr%np)*zpsi(1:gr%np)
503 gvec(:) = real(tg%gvec(iter + 1, :), real64)
505 do ik = inh%d%kpt%start, inh%d%kpt%end
506 do ist = inh%st_start, inh%st_end
507 do idim = 1, inh%d%dim
510 zpsi(ip) = -psi%occ(ist, ik)*
m_two*sum(tg%grad_local_pot(1, ip, 1:gr%box%dim)*gvec(:))*zpsi(ip)
519 do ik = inh%d%kpt%start, inh%d%kpt%end
520 do ist = inh%st_start, inh%st_end
521 do idim = 1, inh%d%dim
524 zpsi(ip) = -psi%occ(ist, ik)*tg%rho(ip)*zpsi(ip)
533 do ik = inh%d%kpt%start, inh%d%kpt%end
534 do ib = inh%group%block_start, inh%group%block_end
539 if (abs(nint(time/tg%dt)) >= tg%strt_iter_curr_tg)
then
540 call chi_current(tg, gr, kpoints, -1.0_real64, psi, inh)
544 write(
message(1),
'(a)')
'Internal error in target_inh'
549 safe_deallocate_a(zpsi)
561 real(real64) function
target_j1(tg, namespace, gr, kpoints, qcpsi, ions) result(j1)
564 type(
grid_t),
intent(in) :: gr
567 type(
ions_t),
optional,
intent(in) :: ions
576 select case (tg%type)
577 case (oct_tg_groundstate)
613 subroutine target_chi(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
615 type(namespace_t),
intent(in) :: namespace
616 type(grid_t),
intent(in) :: gr
617 type(kpoints_t),
intent(in) :: kpoints
618 type(opt_control_state_t),
target,
intent(inout) :: qcpsi_in
619 type(opt_control_state_t),
target,
intent(inout) :: qcchi_out
620 type(ions_t),
intent(in) :: ions
622 real(real64),
pointer :: q(:, :), p(:, :)
623 type(states_elec_t),
pointer :: psi_in, chi_out
626 psi_in => opt_control_point_qs(qcpsi_in)
627 chi_out => opt_control_point_qs(qcchi_out)
629 select case (tg%type)
661 q => opt_control_point_q(qcchi_out)
662 p => opt_control_point_p(qcchi_out)
679 select case (tg%type)
689 select case (tg%curr_functional)
729#include "target_density_inc.F90"
730#include "target_velocity_inc.F90"
731#include "target_hhg_inc.F90"
732#include "target_groundstate_inc.F90"
733#include "target_excited_inc.F90"
734#include "target_gstransformation_inc.F90"
735#include "target_exclude_inc.F90"
736#include "target_userdefined_inc.F90"
737#include "target_local_inc.F90"
738#include "target_tdlocal_inc.F90"
739#include "target_classical_inc.F90"
740#include "target_spin_inc.F90"
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
subroutine, public batch_set_zero(this, np, async)
fill all mesh functions of the batch with zero
This module implements a calculator for the density and defines related functions.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
This module implements the underlying real-space grid.
This module defines classes and functions for interaction partners.
This module is intended to contain "only mathematical" functions and procedures.
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
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_input_error(namespace, var, details, row, column)
subroutine, public messages_experimental(name, namespace)
This module handles the communicators for the various parallelization strategies.
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 output system
this module contains the output system
integer, parameter, public restart_gs
subroutine, public restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
Initializes a restart object.
integer, parameter, public restart_type_load
subroutine, public restart_end(restart)
subroutine, public states_elec_end(st)
finalize the states_elec_t object
subroutine, public states_elec_deallocate_wfns(st)
Deallocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_allocate_wfns(st, mesh, wfs_type, skip, packed)
Allocates the KS wavefunctions defined within a states_elec_t structure.
subroutine, public states_elec_copy(stout, stin, exclude_wfns, exclude_eigenval, special)
make a (selective) copy of a states_elec_t object
This module handles reading and writing restart information for the states_elec_t.
subroutine target_end_groundstate()
subroutine target_end_gstransformation()
real(real64) function target_j1_groundstate(tg, gr, psi)
subroutine target_chi_excited(tg, namespace, gr, psi_in, chi_out)
logical pure function is_spatial_curr_wgt(tg)
subroutine target_build_tdlocal(tg, gr, time)
integer, parameter, public oct_tg_jdensity
subroutine target_output_exclude(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine target_end_velocity(tg, oct)
subroutine target_tdcalc_tdlocal(tg, gr, psi, time)
subroutine target_init_hhgnew(gr, namespace, tg, td, ions, ep)
subroutine target_end_hhg(tg)
subroutine target_chi_hhg(chi_out)
subroutine target_chi_classical(tg, qcpsi, qcchi, ions)
integer, parameter, public oct_targetmode_static
real(real64) function target_j1_classical(tg, qcpsi)
logical pure function, public target_move_ions(tg)
subroutine target_output_gstransformation(tg, namespace, space, gr, dir, ions, hm, outp)
integer, parameter, public oct_tg_userdefined
subroutine target_init_velocity(gr, namespace, ions, tg, oct, td, ep)
subroutine target_chi_tdlocal(chi_out)
subroutine target_init_hhg(tg, namespace, td, w0)
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,...
subroutine target_tdcalc_hhgnew(tg, gr, psi, time, max_time)
subroutine target_init_classical(ions, namespace, tg, td, oct)
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_chi_velocity(gr, tg, chi_out, ions)
subroutine target_chi_userdefined(tg, gr, psi_in, chi_out)
subroutine target_end_excited()
subroutine target_end_density(tg)
real(real64) function target_j1_spin(tg, gr, psi)
subroutine target_output_velocity(tg, namespace, space, gr, dir, ions, hm, outp)
real(real64) function target_j1_velocity(tg, ions)
subroutine target_init_density(gr, kpoints, namespace, space, tg, stin, td, restart)
real(real64) function target_j1_exclude(gr, tg, psi)
subroutine target_end_local(tg)
subroutine target_init_exclude(mesh, namespace, space, tg, td, restart, kpoints)
subroutine, public target_init(gr, kpoints, namespace, space, ions, qcs, td, w0, tg, oct, ep, mc)
The target is initialized, mainly by reading from the inp file.
integer, parameter, public oct_curr_square_td
subroutine target_init_excited(mesh, namespace, space, tg, td, restart, kpoints)
subroutine target_chi_density(tg, gr, kpoints, psi_in, chi_out)
real(real64) function target_j1_excited(tg, namespace, gr, psi)
subroutine target_output_classical
integer, parameter, public oct_curr_square
real(real64) function target_j1_density(gr, kpoints, tg, psi)
integer, parameter, public oct_tg_velocity
subroutine target_output_density(tg, namespace, space, mesh, dir, ions, outp)
subroutine target_end_userdefined()
real(real64) function target_j1_userdefined(tg, gr, psi)
subroutine target_output_tdlocal(tg, namespace, space, gr, dir, ions, outp)
integer, parameter, public oct_tg_excited
integer, parameter, public oct_tg_gstransformation
subroutine target_chi_spin(tg, gr, psi_in, chi_out)
real(real64) function target_j1_hhgnew(gr, tg)
real(real64) function target_j1_local(mesh, tg, psi)
subroutine target_init_groundstate(mesh, namespace, space, tg, td, restart, kpoints)
integer, parameter, public oct_tg_groundstate
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.
subroutine target_end_tdlocal(tg)
integer, parameter, public oct_tg_local
real(real64) function target_j1_gstransformation(tg, gr, psi)
subroutine target_tdcalc_density(tg, gr, kpoints, psi, time)
integer pure function, public target_type(tg)
real(real64) function target_j1_tdlocal(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 target_init_local(gr, namespace, tg, td)
subroutine, public target_output(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine target_end_classical(tg)
real(real64) function target_j1_hhg(tg, namespace)
subroutine target_chi_gstransformation(tg, gr, psi_in, chi_out)
subroutine target_chi_local(tg, mesh, psi_in, chi_out)
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...
subroutine target_output_groundstate(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine target_init_userdefined(gr, namespace, tg, td)
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)
subroutine target_tdcalc_hhg(tg, namespace, space, hm, gr, ions, ext_partners, psi, time)
subroutine target_output_userdefined(tg, namespace, space, gr, dir, ions, hm, outp)
integer pure function, public target_mode(tg)
subroutine target_chi_exclude(tg, gr, psi_in, chi_out)
integer pure function, public target_curr_functional(tg)
subroutine target_end_hhgnew(tg, oct)
subroutine target_chi_groundstate(tg, gr, psi_in, chi_out)
subroutine target_init_tdlocal(gr, namespace, tg, td)
integer, parameter, public oct_tg_classical
subroutine target_end_exclude()
subroutine target_output_excited(tg, namespace, space, gr, dir, ions, hm, outp)
integer, parameter, public oct_tg_exclude_state
subroutine target_output_hhg(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine chi_current(tg, gr, kpoints, factor, psi_in, chi)
subroutine target_init_spin(tg, namespace)
subroutine target_tdcalc_velocity(tg, hm, gr, ions, psi, time, max_time)
subroutine target_init_gstransformation(gr, namespace, space, tg, td, restart, kpoints)
subroutine target_output_local(tg, namespace, space, mesh, dir, ions, outp)
type(type_t), public type_cmplx
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.
Description of the grid, containing information on derivatives, stencil, and symmetries.
Stores all communicators and groups.
!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...
The states_elec_t class contains all electronic wave functions.