32 use,
intrinsic :: iso_fortran_env
60 character(len=80) :: excluded_states_list
73 subroutine target_init_exclude(tg, gr, kpoints, namespace, space, ions, qcs, td, w0, oct, ep, restart)
74 class(target_exclude_t),
intent(inout) :: tg
75 type(grid_t),
intent(in) :: gr
76 type(kpoints_t),
intent(in) :: kpoints
77 type(namespace_t),
intent(in) :: namespace
78 class(space_t),
intent(in) :: space
79 type(ions_t),
intent(in) :: ions
80 type(opt_control_state_t),
intent(inout) :: qcs
81 type(td_t),
intent(in) :: td
82 real(real64),
intent(in) :: w0
83 type(oct_t),
intent(in) :: oct
84 type(epot_t),
intent(inout) :: ep
85 type(restart_t),
intent(inout) :: restart
89 tg%move_ions = td%ions_dyn%ions_move()
92 message(1) =
'Info: The target functional is the exclusion of a number of states defined by'
93 message(2) =
' "OCTExcludedStates".'
105 call parse_variable(namespace,
'OCTExcludedStates',
'1', tg%excluded_states_list)
116 class(target_exclude_t),
intent(inout) :: tg
117 type(namespace_t),
intent(in) :: namespace
118 class(space_t),
intent(in) :: space
119 type(grid_t),
intent(in) :: gr
120 character(len=*),
intent(in) :: dir
121 type(ions_t),
intent(in) :: ions
122 type(hamiltonian_elec_t),
intent(in) :: hm
123 type(output_t),
intent(in) :: outp
128 call output_states(outp, namespace, space, trim(dir), tg%st, gr, ions, hm, -1)
137 real(real64) function target_j1_exclude(tg, namespace, gr, kpoints, qcpsi, ions) result(j1)
138 class(target_exclude_t),
intent(inout) :: tg
139 type(namespace_t),
intent(in) :: namespace
140 type(grid_t),
intent(in) :: gr
141 type(kpoints_t),
intent(in) :: kpoints
142 type(opt_control_state_t),
intent(inout) :: qcpsi
143 type(ions_t),
optional,
intent(in) :: ions
146 complex(real64),
allocatable :: zpsi1(:, :), zpsi(:, :)
147 type(states_elec_t),
pointer :: psi
149 push_sub(target_j1_exclude)
153 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
154 safe_allocate(zpsi1(1:gr%np, 1:tg%st%d%dim))
159 do ist = 1, tg%st%nst
162 j1 = j1 - abs(
zmf_dotp(gr, psi%d%dim, zpsi, zpsi1))**2
166 safe_deallocate_a(zpsi)
167 safe_deallocate_a(zpsi1)
170 pop_sub(target_j1_exclude)
178 type(namespace_t),
intent(in) :: namespace
179 type(grid_t),
intent(in) :: gr
180 type(kpoints_t),
intent(in) :: kpoints
181 type(opt_control_state_t),
target,
intent(inout) :: qcpsi_in
182 type(opt_control_state_t),
target,
intent(inout) :: qcchi_out
183 type(ions_t),
intent(in) :: ions
186 complex(real64) :: olap
187 complex(real64),
allocatable :: zpsi(:, :), zst(:, :), zchi(:, :)
188 type(states_elec_t),
pointer :: psi_in, chi_out
191 psi_in => opt_control_point_qs(qcpsi_in)
192 chi_out => opt_control_point_qs(qcchi_out)
194 do ib = chi_out%group%block_start, chi_out%group%block_end
195 call psi_in%group%psib(ib, 1)%copy_data_to(gr%np, chi_out%group%psib(ib, 1))
198 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
199 safe_allocate(zst(1:gr%np, 1:tg%st%d%dim))
200 safe_allocate(zchi(1:gr%np, 1:tg%st%d%dim))
202 call states_elec_get_state(chi_out, gr, 1, 1, zchi)
204 do ist = 1, tg%st%nst
205 if (loct_isinstringlist(ist, tg%excluded_states_list))
then
206 call states_elec_get_state(psi_in, gr, ist, 1, zpsi)
207 call states_elec_get_state(tg%st, gr, ist, 1, zst)
208 olap = zmf_dotp(gr, psi_in%d%dim, zst, zpsi)
209 call lalg_axpy(gr%np, tg%st%d%dim, -olap, zst, zchi)
213 call states_elec_set_state(chi_out, gr, 1, 1, zchi)
215 safe_deallocate_a(zpsi)
216 safe_deallocate_a(zst)
217 safe_deallocate_a(zchi)
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
subroutine, public io_mkdir(fname, namespace, parents)
System information (time, memory, sysname)
logical function, public loct_isinstringlist(a, s)
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_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)
subroutine, public states_elec_deallocate_wfns(st)
Deallocates the KS wavefunctions defined within a states_elec_t structure.
This module handles reading and writing restart information for the states_elec_t.
subroutine, public states_elec_look_and_load(restart, namespace, space, st, mesh, kpoints, fixed_occ, is_complex, packed)
real(real64) function target_j1_exclude(tg, namespace, gr, kpoints, qcpsi, ions)
subroutine target_init_exclude(tg, gr, kpoints, namespace, space, ions, qcs, td, w0, oct, ep, restart)
subroutine target_output_exclude(tg, namespace, space, gr, dir, ions, hm, outp)
subroutine target_chi_exclude(tg, namespace, gr, kpoints, qcpsi_in, qcchi_out, ions)
Optimal-control targets: abstract base class and public interface.
Target projecting onto the complement of a set of states.
Abstract optimal-control target.