73 type(submesh_t) :: sphere
74 complex(real64),
allocatable :: phase(:,:)
77 real(real64) :: Ubar, Jbar
81 real(real64),
allocatable :: V_ij(:,:)
82 real(real64),
allocatable :: coulomb_IIJJ(:,:,:,:,:)
83 complex(real64),
allocatable :: zcoulomb_IIJJ(:,:,:,:,:,:,:)
84 integer,
allocatable:: map_os(:)
85 complex(real64),
allocatable :: phase_shift(:,:)
87 real(real64) :: radius
88 class(species_t),
pointer :: spec => null()
91 real(real64),
allocatable :: dorb(:,:,:)
92 complex(real64),
allocatable :: zorb(:,:,:)
93 complex(real64),
allocatable :: eorb_submesh(:,:,:,:)
95 complex(real64),
allocatable :: eorb_mesh(:,:,:,:)
97 integer :: ldorbs, ldorbs_eorb
98 type(accel_mem_t) :: dbuff_orb, zbuff_orb
99 type(accel_mem_t),
allocatable :: buff_eorb (:)
101 logical :: use_submesh
102 logical :: allocated_on_mesh
106 type(poisson_t) :: poisson
114 type(orbitalset_t),
intent(inout) :: this
140 type(orbitalset_t),
intent(inout) :: this
146 safe_deallocate_a(this%phase)
147 safe_deallocate_a(this%dorb)
148 safe_deallocate_a(this%zorb)
149 safe_deallocate_a(this%eorb_submesh)
150 safe_deallocate_a(this%eorb_mesh)
154 safe_deallocate_a(this%V_ij)
155 safe_deallocate_a(this%coulomb_IIJJ)
156 safe_deallocate_a(this%map_os)
157 safe_deallocate_a(this%phase_shift)
162 if(
allocated(this%buff_eorb))
then
163 do ik = lbound(this%buff_eorb, dim=1), ubound(this%buff_eorb, dim=1)
166 safe_deallocate_a(this%buff_eorb)
175 real(real64),
intent(in) :: jj
176 integer,
intent(in) :: ll, nn
191 integer,
intent(in) :: dim
194 logical,
intent(in) :: spin_polarized
195 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
196 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
197 integer,
optional,
intent(in) :: kpt_max
199 integer :: ns, iq, is, ikpoint, im, idim, kpt_end
200 real(real64) :: kr, kpoint(1:dim), dx(1:dim)
208 if (
present(kpt_max)) kpt_end = min(kpt_max, kpt_end)
210 do iq = kpt%start, kpt_end
212 if (spin_polarized)
then
213 ikpoint = 1 + (iq - 1)/2
221 kpoint(1:dim) = kpoints%get_point(ikpoint)
227 dx = os%sphere%rel_x(1:dim, is) - os%sphere%mesh%x(1:dim, os%sphere%map(is)) + os%sphere%center(1:dim)
228 kr = dot_product(kpoint, dx)
229 if (
present(vec_pot))
then
230 if (
allocated(vec_pot)) kr = kr + dot_product(vec_pot, dx)
233 if (
present(vec_pot_var))
then
234 if (
allocated(vec_pot_var)) kr = kr + sum(vec_pot_var(1:dim, os%sphere%map(is)) &
235 *(os%sphere%rel_x(1:dim, is)+os%sphere%center))
238 os%phase(is, iq) =
exp(
m_zi*kr)
241 if (.not. os%use_submesh)
then
245 os%eorb_mesh(:, im, idim, iq) =
m_z0
247 os%eorb_mesh(os%sphere%map(is),im,idim,iq) = os%eorb_mesh(os%sphere%map(is),im,idim,iq) &
248 + os%zorb(is, idim, im) * os%phase(is, iq)
258 os%eorb_submesh(is,idim,im,iq) = os%zorb(is,idim,im)*os%phase(is, iq)
267 if(os%use_submesh)
then
268 do iorb = 1, os%norbs
269 call accel_write_buffer(os%buff_eorb(iq), ns, os%eorb_submesh(:, 1, iorb, iq), offset = (iorb - 1)*os%ldorbs_eorb)
272 do iorb = 1, os%norbs
274 os%eorb_mesh(:, iorb, 1, iq), offset = (iorb - 1)*os%ldorbs_eorb)
287 integer,
intent(in) :: dim
290 logical,
intent(in) :: spin_polarized
291 real(real64),
optional,
allocatable,
intent(in) :: vec_pot(:)
292 real(real64),
optional,
allocatable,
intent(in) :: vec_pot_var(:, :)
293 integer,
optional,
intent(in) :: kpt_max
295 integer :: iq, ikpoint
296 real(real64) :: kr, kpoint(dim), dx(dim)
297 integer :: inn, kpt_end
302 if(
present(kpt_max)) kpt_end = min(kpt_max, kpt_end)
304 do iq = kpt%start, kpt_end
306 if(spin_polarized)
then
307 ikpoint = 1 + (iq - 1)/2
315 kpoint(1:dim) = kpoints%get_point(ikpoint)
317 if (os%nneighbors > 0)
then
318 do inn = 1, os%nneighbors
319 dx(1:dim) = os%V_ij(inn,1:dim)
320 kr = sum(kpoint(1:dim)*dx(1:dim))
321 if (
present(vec_pot))
then
322 if (
allocated(vec_pot)) kr = kr + sum(vec_pot(1:dim)*dx(1:dim))
326 if (
present(vec_pot_var))
then
327 if (
allocated(vec_pot_var)) kr = kr + sum(vec_pot_var(1:dim, 1)*dx(1:dim))
331 os%phase_shift(inn, iq) =
exp(-
m_zi*kr)
348 type(
ions_t),
intent(in) :: ions
354 os%spec_index = os%spec%get_index()
355 do ja = 1, ions%natoms
356 if(ions%atom(ja)%species == os%spec)
then
357 os%spec_index = min(os%spec_index, ions%atom(ja)%species%get_index())
366#include "orbitalset_inc.F90"
369#include "complex.F90"
370#include "orbitalset_inc.F90"
double exp(double __x) __attribute__((__nothrow__
subroutine, public accel_free_buffer(this, async)
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_transfer_to_device(os, kpt, use_mesh)
Allocate and transfer the orbitals to the device.
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_transfer_to_device(os, kpt, use_mesh)
Allocate and transfer the orbitals to the device.
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....