35 use,
intrinsic :: iso_fortran_env
71 subroutine td_calc_tacc(namespace, space, gr, ions, ext_partners, st, hm, acc, time)
72 type(namespace_t),
intent(in) :: namespace
73 class(space_t),
intent(in) :: space
74 type(grid_t),
intent(in) :: gr
75 type(ions_t),
intent(in) :: ions
76 type(partner_list_t),
intent(in) :: ext_partners
77 type(states_elec_t),
intent(in) :: st
78 type(hamiltonian_elec_t),
intent(in) :: hm
79 real(real64),
intent(in) :: time
80 real(real64),
intent(out) :: acc(:)
82 real(real64) :: field(space%dim), x(space%dim)
83 complex(real64),
allocatable :: zpsi(:, :), hzpsi(:,:), hhzpsi(:,:), xzpsi(:,:,:), vnl_xzpsi(:,:)
84 integer :: j, k, ik, ist, idim
85 type(lasers_t),
pointer :: lasers
90 if (family_is_mgga(hm%xc%family) .or. family_is_hybrid(hm%xc))
then
99 if (st%symmetrize_density)
then
112 if(
associated(lasers))
then
113 do j = 1, lasers%no_lasers
115 acc(1:space%dim) = acc(1:space%dim) - st%qtot*field(1:space%dim)
119 if (.not. hm%ep%non_local)
then
126 safe_allocate(zpsi(1:gr%np_part, 1:st%d%dim))
127 safe_allocate(hzpsi(1:gr%np_part, 1:st%d%dim))
128 safe_allocate(hhzpsi(1:3, 1:gr%np_part))
130 do ik = st%d%kpt%start, st%d%kpt%end
131 do ist = st%st_start, st%st_end
137 safe_allocate(xzpsi(1:gr%np_part, 1:st%d%dim, 1:3))
138 safe_allocate(vnl_xzpsi(1:gr%np_part, 1:st%d%dim))
142 xzpsi(k, 1:st%d%dim, j) = gr%x(k, j)*zpsi(k, 1:st%d%dim)
150 do idim = 1, st%d%dim
151 x(j) = x(j) - 2*st%occ(ist, ik)*real(
zmf_dotp(gr, hzpsi(1:gr%np, idim), vnl_xzpsi(:, idim)), real64)
158 xzpsi(k, 1:st%d%dim, j) = gr%x(k, j)*hzpsi(k, 1:st%d%dim)
166 do idim = 1, st%d%dim
167 x(j) = x(j) + 2*st%occ(ist, ik)*real(
zmf_dotp(gr, zpsi(:, idim), vnl_xzpsi(:, idim)), real64)
170 safe_deallocate_a(xzpsi)
171 safe_deallocate_a(vnl_xzpsi)
175 safe_deallocate_a(hzpsi)
176 safe_deallocate_a(hhzpsi)
178 if (st%parallel_in_states)
then
194 type(
grid_t),
intent(in) :: gr
196 type(
space_t),
intent(in) :: space
198 real(real64),
intent(out) :: vel(:)
200 real(real64),
allocatable :: momentum(:,:,:)
201 integer :: st_start, st_end
205 st_start = st%st_start
208 safe_allocate(momentum(1:space%dim, st_start:st_end, st%d%kpt%start:st%d%kpt%end))
211 momentum(1:space%dim, st_start:st_end, 1) = &
212 sum(momentum(1:space%dim, st_start:st_end, st%d%kpt%start:st%d%kpt%end), 3)
213 momentum(1:space%dim, 1, 1) = sum(momentum(1:space%dim, st_start:st_end, 1), 2)
214 vel = momentum(:, 1, 1)
216 safe_deallocate_a(momentum)
226 type(
mesh_t),
intent(in) :: mesh
228 integer,
intent(in) :: nch
229 real(real64),
intent(out) :: ch(0:nch)
231 integer :: ik, ist, ii, jj, idim, nid
232 real(real64) :: prod, prod0
233 real(real64),
allocatable :: n(:), nnot(:)
234 complex(real64),
allocatable :: zpsi(:)
238 integer,
allocatable :: idx0(:), idx(:), idxref(:)
242 safe_allocate( n(1: nch))
243 safe_allocate(nnot(1: nch))
244 safe_allocate(zpsi(1:mesh%np))
253 do idim = 1, st%d%dim
255 if (st%st_start <= ist .and. ist <= st%st_end .and. &
256 st%d%kpt%start <= ik .and. ik <= st%d%kpt%end)
then
259 nnot(ii) =
m_one - n(ii)**2
268 if (st%parallel_in_states)
then
279 safe_allocate(idx(0:nid))
280 safe_allocate(idxref(0:nid))
281 idxref = (/ (ii, ii = 0, nid) /)
286 safe_allocate(idx0(0:0))
288 safe_allocate(idx0(0:ii-1))
315 prod0 = prod0 * nnot(idx0(jj)+1)
319 if (idx(jj) >= 0)
then
325 prod = prod * n(idx(jj)+1)
331 ch(ii) = ch(ii) + prod*prod0
336 safe_deallocate_a(idx0)
342 safe_deallocate_a(idx)
343 safe_deallocate_a(idxref)
347 safe_deallocate_a(nnot)
348 safe_deallocate_a(zpsi)
Functions to generate combinations.
type(debug_t), save, public debug
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public elec_momentum_me(gr, st, space, kpoints, momentum)
type(lasers_t) function, pointer, public list_get_lasers(partners)
subroutine, public total_force_calculate(space, gr, ions, ep, st, phase, x, lda_u)
This computes the total forces on the ions created by the electrons (it excludes the force due to pos...
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
integer, parameter, public term_non_local_potential
subroutine, public zhamiltonian_elec_apply_single(hm, namespace, mesh, psi, hpsi, ist, ik, terms, set_bc, set_phase)
This module defines classes and functions for interaction partners.
subroutine, public laser_electric_field(laser, field, time, dt)
Returns a vector with the electric field, no matter whether the laser is described directly as an ele...
integer, parameter, public dft_u_none
subroutine, public loct_get_combination(c, comb)
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public messages_new_line()
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
This module handles spin dimensions of the states and the k-point distribution.
subroutine, public td_calc_tacc(namespace, space, gr, ions, ext_partners, st, hm, acc, time)
Electronic acceleration (to calculate harmonic spectrum...) It is calculated as:
subroutine, public td_calc_ionch(mesh, st, ch, Nch)
Multiple ionization probabilities calculated form the KS orbital densities C. Ullrich,...
subroutine, public td_calc_tvel(gr, st, space, kpoints, vel)
Electronic velocity (to calculate harmonic spectrum...) It is calculated as:
Description of the grid, containing information on derivatives, stencil, and symmetries.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.