72 type(submesh_t) :: sphere
73 complex(real64),
allocatable :: phase(:,:)
76 real(real64) :: Ubar, Jbar
80 real(real64),
allocatable :: V_ij(:,:)
81 real(real64),
allocatable :: coulomb_IIJJ(:,:,:,:,:)
82 complex(real64),
allocatable :: zcoulomb_IIJJ(:,:,:,:,:,:,:)
83 integer,
allocatable:: map_os(:)
84 complex(real64),
allocatable :: phase_shift(:,:)
86 real(real64) :: radius
87 class(species_t),
pointer :: spec => null()
90 real(real64),
allocatable :: dorb(:,:,:)
91 complex(real64),
allocatable :: zorb(:,:,:)
92 complex(real64),
allocatable :: eorb_submesh(:,:,:,:)
93 complex(real64),
allocatable :: eorb_mesh(:,:,:,:)
95 type(accel_mem_t) :: dbuff_orb, zbuff_orb
96 type(accel_mem_t),
allocatable :: buff_eorb (:)
98 logical :: use_submesh
100 type(poisson_t) :: poisson
108 type(orbitalset_t),
intent(inout) :: this
134 type(orbitalset_t),
intent(inout) :: this
140 safe_deallocate_a(this%phase)
141 safe_deallocate_a(this%dorb)
142 safe_deallocate_a(this%zorb)
143 safe_deallocate_a(this%eorb_submesh)
144 safe_deallocate_a(this%eorb_mesh)
148 safe_deallocate_a(this%V_ij)
149 safe_deallocate_a(this%coulomb_IIJJ)
150 safe_deallocate_a(this%map_os)
151 safe_deallocate_a(this%phase_shift)
156 if(
allocated(this%buff_eorb))
then
157 do ik = lbound(this%buff_eorb, dim=1), ubound(this%buff_eorb, dim=1)
160 safe_deallocate_a(this%buff_eorb)
169 real(real64),
intent(in) :: jj
170 integer,
intent(in) :: ll, nn
185 integer,
intent(in) :: dim
188 logical,
intent(in) :: spin_polarized
189 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
190 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
191 integer,
optional,
intent(in) :: kpt_max
193 integer :: ns, iq, is, ikpoint, im, idim, kpt_end
194 real(real64) :: kr, kpoint(1:dim), dx(1:dim)
202 if (
present(kpt_max)) kpt_end = min(kpt_max, kpt_end)
204 do iq = kpt%start, kpt_end
206 if (spin_polarized)
then
207 ikpoint = 1 + (iq - 1)/2
215 kpoint(1:dim) = kpoints%get_point(ikpoint)
221 dx = os%sphere%rel_x(1:dim, is) - os%sphere%mesh%x(os%sphere%map(is), 1:dim) + os%sphere%center(1:dim)
222 kr = dot_product(kpoint, dx)
223 if (
present(vec_pot))
then
224 if (
allocated(vec_pot)) kr = kr + dot_product(vec_pot, dx)
227 if (
present(vec_pot_var))
then
228 if (
allocated(vec_pot_var)) kr = kr + sum(vec_pot_var(1:dim, os%sphere%map(is)) &
229 *(os%sphere%rel_x(1:dim, is)+os%sphere%center))
232 os%phase(is, iq) =
exp(
m_zi*kr)
235 if (.not. os%use_submesh)
then
239 os%eorb_mesh(:, im, idim, iq) =
m_z0
241 os%eorb_mesh(os%sphere%map(is),im,idim,iq) = os%eorb_mesh(os%sphere%map(is),im,idim,iq) &
242 + os%zorb(is, idim, im) * os%phase(is, iq)
252 os%eorb_submesh(is,idim,im,iq) = os%zorb(is,idim,im)*os%phase(is, iq)
261 if(os%use_submesh)
then
262 do iorb = 1, os%norbs
263 call accel_write_buffer(os%buff_eorb(iq), ns, os%eorb_submesh(:, 1, iorb, iq), offset = (iorb - 1)*os%ldorbs)
266 do iorb = 1, os%norbs
268 os%eorb_mesh(:, iorb, 1, iq), offset = (iorb - 1)*os%ldorbs)
281 integer,
intent(in) :: dim
284 logical,
intent(in) :: spin_polarized
285 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
286 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
287 integer,
optional,
intent(in) :: kpt_max
289 integer :: iq, ikpoint
290 real(real64) :: kr, kpoint(dim), dx(dim)
291 integer :: inn, kpt_end
296 if(
present(kpt_max)) kpt_end = min(kpt_max, kpt_end)
298 do iq = kpt%start, kpt_end
300 if(spin_polarized)
then
301 ikpoint = 1 + (iq - 1)/2
309 kpoint(1:dim) = kpoints%get_point(ikpoint)
311 if (os%nneighbors > 0)
then
312 do inn = 1, os%nneighbors
313 dx(1:dim) = os%V_ij(inn,1:dim)
314 kr = sum(kpoint(1:dim)*dx(1:dim))
315 if (
present(vec_pot))
then
316 if (
allocated(vec_pot)) kr = kr + sum(vec_pot(1:dim)*dx(1:dim))
320 if (
present(vec_pot_var))
then
321 if (
allocated(vec_pot_var)) kr = kr + sum(vec_pot_var(1:dim, 1)*dx(1:dim))
325 os%phase_shift(inn, iq) =
exp(-
m_zi*kr)
342 type(
ions_t),
intent(in) :: ions
348 os%spec_index = os%spec%get_index()
349 do ja = 1, ions%natoms
350 if(ions%atom(ja)%species == os%spec)
then
351 os%spec_index = min(os%spec_index, ions%atom(ja)%species%get_index())
360#include "orbitalset_inc.F90"
363#include "complex.F90"
364#include "orbitalset_inc.F90"
double exp(double __x) __attribute__((__nothrow__
subroutine, public accel_release_buffer(this)
pure logical function, public accel_is_enabled()
This module implements batches of mesh functions.
This module implements common operations on batches of mesh functions.
This module contains interfaces for BLAS routines You should not use these routines directly....
real(real64), parameter, public m_zero
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
real(real64), parameter, public m_one
integer pure function, public kpoints_number(this)
This module is intended to contain "only mathematical" functions and procedures.
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
subroutine, public zorbitalset_get_position_matrix_elem(os, ndim, psib, idir, dot)
subroutine, public orbitalset_update_phase_shift(os, dim, kpt, kpoints, spin_polarized, vec_pot, vec_pot_var, kpt_max)
Build the phase shift for the intersite interaction.
subroutine orbitalset_set_species_index(os, ions)
Set the species index for a given orbital set.
subroutine, public orbitalset_init(this)
subroutine, public orbitalset_end(this)
subroutine, public dorbitalset_add_to_batch(os, ndim, psib, weight)
subroutine, public dorbitalset_get_position_matrix_elem(os, ndim, psib, idir, dot)
subroutine, public zorbitalset_add_to_batch(os, ndim, psib, weight)
subroutine, public orbitalset_update_phase(os, dim, kpt, kpoints, spin_polarized, vec_pot, vec_pot_var, kpt_max)
Build the phase correction to the global phase in case the orbital crosses the border of the simulato...
subroutine, public dorbitalset_get_coefficients(os, ndim, psi, ik, has_phase, dot, reduce)
subroutine, public dorbitalset_get_coeff_batch(os, ndim, psib, dot, reduce)
subroutine, public orbitalset_set_jln(this, jj, ll, nn)
subroutine, public zorbitalset_get_coeff_batch(os, ndim, psib, dot, reduce)
subroutine, public zorbitalset_get_coefficients(os, ndim, psi, ik, has_phase, dot, reduce)
subroutine, public submesh_end(this)
Distribution of N instances over mpi_grpsize processes, for the local rank mpi_grprank....