70 integer,
parameter :: MAX_NPROJECTIONS = 4
71 integer,
parameter :: MAX_L = 5
87 integer :: nprojections
88 integer,
public :: lmax
89 integer,
public :: lloc
93 type(submesh_t),
public :: sphere
98 type(hgh_projector_t),
allocatable,
public :: hgh_p(:, :)
99 type(kb_projector_t),
allocatable,
public :: kb_p(:, :)
100 type(rkb_projector_t),
allocatable,
public :: rkb_p(:, :)
101 complex(real64),
allocatable,
public :: phase(:, :, :)
107 logical elemental function projector_is_null(p)
108 type(projector_t),
intent(in) :: p
110 projector_is_null = (p%type ==
proj_none)
114 logical elemental function projector_is(p, type)
115 type(projector_t),
intent(in) :: p
116 integer,
intent(in) :: type
122 type(projector_t),
intent(inout) :: p
123 type(pseudopotential_t),
target,
intent(in) :: pseudo
124 type(namespace_t),
intent(in) :: namespace
125 integer,
intent(in) :: dim
126 integer,
intent(in) :: reltype
128 type(ps_t),
pointer :: ps
145 p%type = ps%projector_type
147 if (p%type == proj_kb .and. reltype == 1)
then
148 if (ps%relativistic_treatment == proj_j_dependent)
then
151 call messages_write(
"Spin-orbit coupling for species '"//trim(pseudo%get_label())//
" is not available.")
152 call messages_warning(namespace=namespace)
157 case (proj_kb, proj_rkb)
158 p%nprojections = ps%kbc
170 integer,
intent(in) :: dim
171 type(states_elec_dim_t),
intent(in) :: std
172 type(boundaries_t),
intent(in) :: bnd
173 type(kpoints_t),
intent(in) :: kpoints
174 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
175 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
177 integer :: ns, iq, is, ikpoint
178 real(real64) :: kr, kpoint(dim)
179 integer :: nphase, iphase
180 real(real64),
allocatable :: diff(:,:)
186 if (bnd%spiralBC) nphase = 3
188 if (.not.
allocated(this%phase) .and. ns > 0)
then
189 safe_allocate(this%phase(1:ns, 1:nphase, std%kpt%start:std%kpt%end))
196 safe_allocate(diff(1:dim, 1:ns))
200 diff(:, is) = this%sphere%rel_x(:,is) + this%sphere%center - this%sphere%mesh%x(this%sphere%map(is), :)
203 do iq = std%kpt%start, std%kpt%end
204 ikpoint = std%get_kpoint_index(iq)
207 assert(ikpoint <= kpoints_number(kpoints))
210 kpoint(1:dim) = kpoints%get_point(ikpoint)
212 do iphase = 1, nphase
218 kr = sum(kpoint(1:dim)*diff(1:dim, is))
220 if (
present(vec_pot))
then
221 if (
allocated(vec_pot)) kr = kr + sum(vec_pot(1:dim)*diff(1:dim, is))
224 if (
present(vec_pot_var))
then
225 if (
allocated(vec_pot_var)) kr = kr + sum(vec_pot_var(1:dim, this%sphere%map(is)) &
226 *(this%sphere%rel_x(:, is)+this%sphere%center))
229 if (bnd%spiralBC .and. iphase > 1)
then
230 kr = kr + (2*(iphase-1)-3)*sum(bnd%spiral_q(1:dim)*diff(1:dim, is))
233 this%phase(is, iphase, iq) =
exp(-m_zi*kr)
240 safe_deallocate_a(diff)
249 class(pseudopotential_t),
intent(in) :: ps
250 real(real64),
intent(in) :: so_strength
259 safe_allocate(p%hgh_p(0:p%lmax, -p%lmax:p%lmax))
261 if (ll == p%lloc) cycle
263 call hgh_projector_init(p%hgh_p(ll, mm), p%sphere, p%reltype, ps, ll, mm, so_strength)
268 safe_allocate(p%kb_p(0:p%lmax, -p%lmax:p%lmax))
270 if (ll == p%lloc) cycle
272 call kb_projector_init(p%kb_p(ll, mm), p%sphere, ps, ll, mm)
277 safe_allocate(p%rkb_p(1:p%lmax, -p%lmax:p%lmax))
279 if (ll == p%lloc) cycle
281 call rkb_projector_init(p%rkb_p(ll, mm), p%sphere, ps, ll, mm, so_strength)
285 if (p%lloc /= 0)
then
286 safe_allocate(p%kb_p(1, 1))
287 call kb_projector_init(p%kb_p(1, 1), p%sphere, ps, 0, 0)
303 call submesh_end(p%sphere)
308 if (ll == p%lloc) cycle
310 call hgh_projector_end(p%hgh_p(ll, mm))
313 safe_deallocate_a(p%hgh_p)
317 if (ll == p%lloc) cycle
319 call kb_projector_end(p%kb_p(ll, mm))
322 safe_deallocate_a(p%kb_p)
326 if (ll == p%lloc) cycle
328 call rkb_projector_end(p%rkb_p(ll, mm))
331 safe_deallocate_a(p%rkb_p)
332 if (p%lloc /= 0)
then
333 call kb_projector_end(p%kb_p(1, 1))
334 safe_deallocate_a(p%kb_p)
341 safe_deallocate_a(p%phase)
348#include "projector_inc.F90"
351#include "complex.F90"
352#include "projector_inc.F90"
double exp(double __x) __attribute__((__nothrow__
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
Module implementing boundary conditions in Octopus.
This module implements the underlying real-space grid.
This module defines the meshes, which are used in Octopus.
real(real64) function, public dprojector_matrix_element(pj, bnd, dim, ik, psia, psib)
dprojector_matrix_element calculates <psia|projector|psib>
subroutine, public projector_build(p, ps, so_strength)
subroutine, public dprojector_commute_r(pj, mesh, bnd, dim, idir, ik, psi, cpsi)
This function calculates |cpsi> += [x, V_nl] |psi>
logical elemental function, public projector_is(p, type)
subroutine, public dproject_psi(mesh, bnd, pj, npj, dim, psi, ppsi, ik)
dproject_psi calculates the action of a projector on the psi wavefunction. The result is summed up to...
subroutine, public projector_init(p, pseudo, namespace, dim, reltype)
subroutine, public projector_init_phases(this, dim, std, bnd, kpoints, vec_pot, vec_pot_var)
subroutine, public dproject_psi_batch(mesh, bnd, pj, npj, dim, psib, ppsib)
To optimize the application of the non-local operator in parallel, the projectors are applied in step...
complex(real64) function, public zprojector_matrix_element(pj, bnd, dim, ik, psia, psib)
zprojector_matrix_element calculates <psia|projector|psib>
subroutine, public zprojector_commute_r_allatoms_alldir(pj, ions, mesh, dim, bnd, ik, psi, cpsi)
This function calculates |cpsi> += [x, V_nl] |psi>
subroutine, public projector_end(p)
subroutine, public zproject_psi(mesh, bnd, pj, npj, dim, psi, ppsi, ik)
zproject_psi calculates the action of a projector on the psi wavefunction. The result is summed up to...
subroutine, public zproject_psi_batch(mesh, bnd, pj, npj, dim, psib, ppsib)
To optimize the application of the non-local operator in parallel, the projectors are applied in step...
subroutine, public dprojector_commute_r_allatoms_alldir(pj, ions, mesh, dim, bnd, ik, psi, cpsi)
This function calculates |cpsi> += [x, V_nl] |psi>
subroutine, public zprojector_commute_r(pj, mesh, bnd, dim, idir, ik, psi, cpsi)
This function calculates |cpsi> += [x, V_nl] |psi>
logical elemental function, public projector_is_null(p)
integer, parameter, public proj_none
This module handles spin dimensions of the states and the k-point distribution.
The projector data type is intended to hold the local and non-local parts of the pseudopotentials....