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
103 if(
associated(lasers))
then
104 do j = 1, lasers%no_lasers
106 acc(1:space%dim) = acc(1:space%dim) - st%qtot*field(1:space%dim)
110 if (.not. hm%ep%non_local)
then
117 safe_allocate(zpsi(1:gr%np_part, 1:st%d%dim))
118 safe_allocate(hzpsi(1:gr%np_part, 1:st%d%dim))
119 safe_allocate(hhzpsi(1:3, 1:gr%np_part))
121 do ik = st%d%kpt%start, st%d%kpt%end
122 do ist = st%st_start, st%st_end
128 safe_allocate(xzpsi(1:gr%np_part, 1:st%d%dim, 1:3))
129 safe_allocate(vnl_xzpsi(1:gr%np_part, 1:st%d%dim))
133 xzpsi(k, 1:st%d%dim, j) = gr%x(k, j)*zpsi(k, 1:st%d%dim)
141 do idim = 1, st%d%dim
142 x(j) = x(j) - 2*st%occ(ist, ik)*real(
zmf_dotp(gr, hzpsi(1:gr%np, idim), vnl_xzpsi(:, idim)), real64)
149 xzpsi(k, 1:st%d%dim, j) = gr%x(k, j)*hzpsi(k, 1:st%d%dim)
157 do idim = 1, st%d%dim
158 x(j) = x(j) + 2*st%occ(ist, ik)*real(
zmf_dotp(gr, zpsi(:, idim), vnl_xzpsi(:, idim)), real64)
161 safe_deallocate_a(xzpsi)
162 safe_deallocate_a(vnl_xzpsi)
166 safe_deallocate_a(hzpsi)
167 safe_deallocate_a(hhzpsi)
169 if (st%parallel_in_states)
then
187 real(real64),
intent(out) :: vel(:)
189 real(real64),
allocatable :: momentum(:,:,:)
190 integer :: st_start, st_end
194 st_start = elec_me%states%st_start
195 st_end = elec_me%states%st_end
197 safe_allocate(momentum(1:elec_me%space%dim, st_start:st_end, elec_me%states%d%kpt%start:elec_me%states%d%kpt%end))
198 call elec_me%momentum_me(kpoints, momentum)
200 momentum(1:elec_me%space%dim, st_start:st_end, 1) = &
201 sum(momentum(1:elec_me%space%dim, st_start:st_end, elec_me%states%d%kpt%start:elec_me%states%d%kpt%end), 3)
202 momentum(1:elec_me%space%dim, 1, 1) = sum(momentum(1:elec_me%space%dim, st_start:st_end, 1), 2)
203 vel = momentum(:, 1, 1)
205 safe_deallocate_a(momentum)
215 type(
mesh_t),
intent(in) :: mesh
217 integer,
intent(in) :: nch
218 real(real64),
intent(out) :: ch(0:nch)
220 integer :: ik, ist, ii, jj, idim, nid
221 real(real64) :: prod, prod0
222 real(real64),
allocatable :: n(:), nnot(:)
223 complex(real64),
allocatable :: zpsi(:)
227 integer,
allocatable :: idx0(:), idx(:), idxref(:)
231 safe_allocate( n(1: nch))
232 safe_allocate(nnot(1: nch))
233 safe_allocate(zpsi(1:mesh%np))
242 do idim = 1, st%d%dim
244 if (st%st_start <= ist .and. ist <= st%st_end .and. &
245 st%d%kpt%start <= ik .and. ik <= st%d%kpt%end)
then
248 nnot(ii) =
m_one - n(ii)**2
257 if (st%parallel_in_states)
then
268 safe_allocate(idx(0:nid))
269 safe_allocate(idxref(0:nid))
270 idxref = (/ (ii, ii = 0, nid) /)
275 safe_allocate(idx0(0:0))
277 safe_allocate(idx0(0:ii-1))
304 prod0 = prod0 * nnot(idx0(jj)+1)
308 if (idx(jj) >= 0)
then
314 prod = prod * n(idx(jj)+1)
320 ch(ii) = ch(ii) + prod*prod0
325 safe_deallocate_a(idx0)
331 safe_deallocate_a(idx)
332 safe_deallocate_a(idxref)
336 safe_deallocate_a(nnot)
337 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.
type(lasers_t) function, pointer, public list_get_lasers(partners)
subroutine, public total_force_calculate(space, gr, ions, ep, st, kpoints, 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...
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(elec_me, kpoints, vel)
Electronic velocity (to calculate harmonic spectrum...) It is calculated as:
pure logical function, public family_is_mgga(family, only_collinear)
Is the xc function part of the mGGA family.
logical pure function, public family_is_hybrid(xcs)
Returns true if the functional is an hybrid functional.
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.