30 use,
intrinsic :: iso_fortran_env
64 class(mesh_t),
intent(in) :: mesh
65 type(namespace_t),
intent(in) :: namespace
66 class(space_t),
intent(in) :: space
67 type(target_t),
intent(inout) :: tg
68 type(td_t),
intent(in) :: td
69 type(restart_t),
intent(inout) :: restart
70 type(kpoints_t),
intent(in) :: kpoints
74 tg%move_ions = td%ions_dyn%ions_move()
77 message(1) =
'Info: The target functional is the exclusion of a number of states defined by'
78 message(2) =
' "OCTExcludedStates".'
90 call parse_variable(namespace,
'OCTExcludedStates',
'1', tg%excluded_states_list)
110 type(target_t),
intent(in) :: tg
111 type(namespace_t),
intent(in) :: namespace
112 class(space_t),
intent(in) :: space
113 type(grid_t),
intent(in) :: gr
114 character(len=*),
intent(in) :: dir
115 type(ions_t),
intent(in) :: ions
116 type(hamiltonian_elec_t),
intent(in) :: hm
117 type(output_t),
intent(in) :: outp
122 call output_states(outp, namespace, space, trim(dir), tg%st, gr, ions, hm, -1)
131 real(real64) function target_j1_exclude(gr, tg, psi) result(j1)
132 type(grid_t),
intent(in) :: gr
133 type(target_t),
intent(in) :: tg
134 type(states_elec_t),
intent(in) :: psi
137 complex(real64),
allocatable :: zpsi1(:, :), zpsi(:, :)
139 push_sub(target_j1_exclude)
141 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
142 safe_allocate(zpsi1(1:gr%np, 1:tg%st%d%dim))
147 do ist = 1, tg%st%nst
150 j1 = j1 - abs(
zmf_dotp(gr, psi%d%dim, zpsi, zpsi1))**2
154 safe_deallocate_a(zpsi)
155 safe_deallocate_a(zpsi1)
157 pop_sub(target_j1_exclude)
164 type(target_t),
intent(in) :: tg
165 type(grid_t),
intent(in) :: gr
166 type(states_elec_t),
intent(in) :: psi_in
167 type(states_elec_t),
intent(inout) :: chi_out
170 complex(real64) :: olap
171 complex(real64),
allocatable :: zpsi(:, :), zst(:, :), zchi(:, :)
174 do ib = chi_out%group%block_start, chi_out%group%block_end
175 call psi_in%group%psib(ib, 1)%copy_data_to(gr%np, chi_out%group%psib(ib, 1))
178 safe_allocate(zpsi(1:gr%np, 1:tg%st%d%dim))
179 safe_allocate(zst(1:gr%np, 1:tg%st%d%dim))
180 safe_allocate(zchi(1:gr%np, 1:tg%st%d%dim))
182 call states_elec_get_state(chi_out, gr, 1, 1, zchi)
184 do ist = 1, tg%st%nst
185 if (loct_isinstringlist(ist, tg%excluded_states_list))
then
186 call states_elec_get_state(psi_in, gr, ist, 1, zpsi)
187 call states_elec_get_state(tg%st, gr, ist, 1, zst)
188 olap = zmf_dotp(gr, psi_in%d%dim, zst, zpsi)
189 zchi(1:gr%np, 1:tg%st%d%dim) = zchi(1:gr%np, 1:tg%st%d%dim) - olap*zst(1:gr%np, 1:tg%st%d%dim)
193 call states_elec_set_state(chi_out, gr, 1, 1, zchi)
195 safe_deallocate_a(zpsi)
196 safe_deallocate_a(zst)
197 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)
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 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, is_complex, packed)
subroutine, public target_init_exclude(mesh, namespace, space, tg, td, restart, kpoints)
subroutine, public target_end_exclude()
real(real64) function, public target_j1_exclude(gr, tg, psi)
subroutine, public target_chi_exclude(tg, gr, psi_in, chi_out)
subroutine, public target_output_exclude(tg, namespace, space, gr, dir, ions, hm, outp)