27 use,
intrinsic :: iso_fortran_env
70 logical,
private :: is_allocated, is_allocated_rho
73 real(real64),
allocatable :: ddl_rho(:,:)
74 real(real64),
allocatable :: ddl_psi(:,:,:,:)
77 complex(real64),
allocatable :: zdl_rho(:,:)
78 complex(real64),
allocatable :: zdl_psi(:,:,:,:)
81 complex(real64),
allocatable :: dl_j(:,:,:)
82 real(real64),
allocatable :: ddl_de(:,:)
83 real(real64),
allocatable :: ddl_elf(:,:)
84 complex(real64),
allocatable :: zdl_de(:,:)
85 complex(real64),
allocatable :: zdl_elf(:,:)
93 type(lr_t),
intent(out) :: lr
97 lr%is_allocated = .false.
98 lr%is_allocated_rho = .false.
108 type(lr_t),
intent(inout) :: lr
109 type(states_elec_t),
intent(in) :: st
110 class(mesh_t),
intent(in) :: mesh
111 logical,
optional,
intent(in) :: allocate_rho
116 if (
present(allocate_rho)) lr%is_allocated_rho = allocate_rho
119 safe_allocate(lr%zdl_psi(1:mesh%np_part, 1:st%d%dim, st%st_start:st%st_end, st%d%kpt%start:st%d%kpt%end))
120 if (lr%is_allocated_rho)
then
121 safe_allocate(lr%zdl_rho(1:mesh%np, 1:st%d%nspin))
124 safe_allocate(lr%ddl_psi(1:mesh%np_part, 1:st%d%dim, st%st_start:st%st_end, st%d%kpt%start:st%d%kpt%end))
125 if (lr%is_allocated_rho)
then
126 safe_allocate(lr%ddl_rho(1:mesh%np, 1:st%d%nspin))
130 lr%is_allocated = .
true.
142 type(lr_t),
intent(inout) :: lr
143 type(states_elec_t),
intent(in) :: st
147 assert(lr%is_allocated)
151 if (lr%is_allocated_rho) lr%zdl_rho =
m_zero
154 if (lr%is_allocated_rho) lr%ddl_rho =
m_zero
164 type(
lr_t),
intent(inout) :: lr
168 safe_deallocate_a(lr%ddl_psi)
169 safe_deallocate_a(lr%zdl_psi)
171 safe_deallocate_a(lr%ddl_rho)
172 safe_deallocate_a(lr%zdl_rho)
174 safe_deallocate_a(lr%dl_j)
175 safe_deallocate_a(lr%ddl_de)
176 safe_deallocate_a(lr%ddl_elf)
177 safe_deallocate_a(lr%zdl_de)
178 safe_deallocate_a(lr%zdl_elf)
180 lr%is_allocated = .false.
181 lr%is_allocated_rho = .false.
188 subroutine lr_copy(st, mesh, src, dest)
190 class(
mesh_t),
intent(in) :: mesh
191 type(
lr_t),
intent(in) :: src
192 type(
lr_t),
intent(inout) :: dest
198 if (src%is_allocated_rho .and. dest%is_allocated_rho)
then
200 call lalg_copy(mesh%np, st%d%nspin, src%zdl_rho, dest%zdl_rho)
202 call lalg_copy(mesh%np, st%d%nspin, src%ddl_rho, dest%ddl_rho)
205 if (dest%is_allocated_rho)
then
207 dest%zdl_rho(:, :) =
m_zero
209 dest%ddl_rho(:, :) =
m_zero
214 do ik = st%d%kpt%start, st%d%kpt%end
215 do ist = st%st_start, st%st_end
217 call lalg_copy(mesh%np_part, st%d%dim, src%zdl_psi(:, :, ist, ik), dest%zdl_psi(:, :, ist, ik))
219 call lalg_copy(mesh%np_part, st%d%dim, src%ddl_psi(:, :, ist, ik), dest%ddl_psi(:, :, ist, ik))
232 type(
lr_t),
intent(in) :: this
245 integer,
intent(in) :: jst
246 integer,
intent(in) :: ik
248 real(real64) :: dsmear
253 lr_alpha_j = st%occ(jst, ik) / st%smear%el_per_state
255 dsmear = max(1e-14_real64, st%smear%dsmear)
264#include "linear_response_inc.F90"
267#include "complex.F90"
268#include "linear_response_inc.F90"
Copies a vector x, to a vector y.
real(real64), parameter, public m_zero
real(real64), parameter, public m_three
subroutine, public zlr_orth_response(mesh, st, lr, omega)
subroutine, public dlr_swap_sigma(st, mesh, plus, minus)
subroutine, public dlr_orth_vector(mesh, st, vec, ist, ik, omega, min_proj)
Orthogonalizes vec against all the occupied states. For details on the metallic part,...
subroutine, public lr_copy(st, mesh, src, dest)
subroutine, public lr_zero(lr, st)
subroutine, public zlr_dump_rho(lr, space, mesh, nspin, restart, rho_tag, ierr)
real(real64) function, public lr_alpha_j(st, jst, ik)
subroutine, public dlr_load_rho(dl_rho, space, mesh, nspin, restart, rho_tag, ierr)
subroutine, public dlr_dump_rho(lr, space, mesh, nspin, restart, rho_tag, ierr)
subroutine, public lr_allocate(lr, st, mesh, allocate_rho)
subroutine, public lr_init(lr)
subroutine, public lr_dealloc(lr)
subroutine, public zlr_orth_vector(mesh, st, vec, ist, ik, omega, min_proj)
Orthogonalizes vec against all the occupied states. For details on the metallic part,...
subroutine, public zlr_build_dl_rho(mesh, st, lr, nsigma)
subroutine, public zlr_load_rho(dl_rho, space, mesh, nspin, restart, rho_tag, ierr)
subroutine, public dlr_orth_response(mesh, st, lr, omega)
subroutine, public zlr_swap_sigma(st, mesh, plus, minus)
subroutine, public dlr_build_dl_rho(mesh, st, lr, nsigma)
logical function, public lr_is_allocated(this)
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
integer, parameter, public smear_fixed_occ
pure logical function, public states_are_complex(st)
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.