41 use,
intrinsic :: iso_fortran_env
92 integer :: nkpnts_start, nkpnts_end
94 integer :: nk_start, nk_end
97 integer :: nstepsthetak, nstepsphik
98 real(real64) :: thetak_rng(1:2)
99 real(real64) :: phik_rng(1:2)
100 integer :: nstepsomegak
101 integer :: nstepsomegak_start, nstepsomegak_end
102 real(real64) :: ktransf(1:3,1:3)
104 real(real64),
allocatable :: klinear(:,:)
109 real(real64),
allocatable :: kcoords_cub(:,:,:)
110 real(real64),
allocatable :: kcoords_sph(:,:,:)
114 integer,
public :: surf_shape
116 integer :: nsrfcpnts_start, nsrfcpnts_end
117 real(real64),
allocatable :: srfcnrml(:,:)
118 real(real64),
allocatable :: rcoords(:,:)
119 integer,
allocatable :: srfcpnt(:)
120 integer,
allocatable :: rankmin(:)
122 complex(real64),
allocatable :: ylm_r(:,:,:)
123 complex(real64),
allocatable :: ylm_k(:,:,:)
124 real(real64),
allocatable :: j_l(:,:)
125 real(real64) :: radius
126 integer,
allocatable :: face_idx_range(:,:)
130 complex(real64),
allocatable :: bvk_phase(:,:)
131 complex(real64),
allocatable :: expkr(:,:,:,:)
132 complex(real64),
allocatable :: expkr_perp(:,:)
134 real(real64),
allocatable :: LLr(:,:)
135 integer,
allocatable :: NN(:,:)
136 integer,
allocatable :: Lkpuvz_inv(:,:,:)
146 complex(real64),
allocatable :: wf(:,:,:,:,:)
147 complex(real64),
allocatable :: gwf(:,:,:,:,:,:)
148 real(real64),
allocatable :: veca(:,:)
149 complex(real64),
allocatable :: conjgphase_prev(:,:)
150 complex(real64),
allocatable :: spctramp_cub(:,:,:,:)
151 complex(real64),
allocatable :: spctramp_sph(:,:,:,:,:)
153 integer,
public :: ll(3)
156 type(mesh_interpolation_t) :: interp
158 logical :: parallel_in_momentum
159 logical :: arpes_grid
160 logical :: surf_interp
161 logical :: use_symmetry
162 logical :: runtime_output
163 logical :: anisotrpy_correction
165 integer :: par_strategy
170 type(accel_mem_t) :: pt_buff
171 type(accel_mem_t) :: interp_buff
172 type(accel_mem_t) :: spacing_buff
173 type(accel_mem_t) :: coords_buff
174 type(accel_mem_t) :: ylm_r_buff
175 type(accel_mem_t) :: ylm_k_buff
176 type(accel_mem_t) :: j_l_buff
177 type(accel_mem_t) :: weights_x_buff
178 type(accel_mem_t) :: srfcnrml_buff
182 integer,
parameter :: &
187 integer,
parameter :: &
196 subroutine pes_flux_init(this, namespace, space, mesh, st, ext_partners, kpoints, abb, save_iter, max_iter)
200 type(
mesh_t),
intent(in) :: mesh
205 integer,
intent(in) :: save_iter
206 integer,
intent(in) :: max_iter
209 real(real64) :: border(space%dim)
210 real(real64) :: offset(space%dim)
211 integer :: stst, stend, kptst, kptend, sdim, mdim, pdim
216 integer :: nstepsphir, nstepsthetar
218 integer :: default_shape
219 real(real64) :: fc_ptdens
221 integer :: par_strategy
222 logical :: use_symmetry
230 kptst = st%d%kpt%start
231 kptend = st%d%kpt%end
234 pdim = space%periodic_dim
236 this%surf_interp = .false.
240 if(
associated(lasers))
then
241 do il = 1, lasers%no_lasers
243 message(1) =
't-surff only works in velocity gauge.'
249 message(1) =
'Info: Calculating PES using t-surff technique.'
274 if (space%is_periodic())
then
276 else if (mdim <= 2)
then
277 default_shape = pes_cubic
279 select type (box => mesh%box)
281 default_shape = pes_cubic
285 call parse_variable(namespace,
'PES_Flux_Shape', default_shape, this%surf_shape)
290 message(1) =
'Spherical grid works only in 3d.'
303 if (this%surf_shape == pes_cubic)
then
304 call parse_variable(namespace,
'PES_Flux_AnisotropyCorrection', .false., this%anisotrpy_correction)
307 this%anisotrpy_correction = .false.
322 if (
parse_block(namespace,
'PES_Flux_Offset', blk) == 0)
then
344 if (this%surf_shape == pes_cubic .or. this%surf_shape ==
pes_plane)
then
364 if (
parse_block(namespace,
'PES_Flux_Lsize', blk) == 0)
then
369 border(1:mdim) = int(border(1:mdim) / mesh%spacing(1:mdim)) * mesh%spacing(1:mdim)
373 border(mdim) = mesh%box%bounding_box_l(mdim) *
m_half
374 if (space%is_periodic())
then
376 border(1:pdim)= mesh%box%bounding_box_l(1:pdim) *
m_two
377 call parse_variable(namespace,
'PES_Flux_Lsize', border(mdim), border(mdim))
379 border(mdim) =
floor(border(mdim) / mesh%spacing(mdim)) * mesh%spacing(mdim)
381 call parse_variable(namespace,
'PES_Flux_Lsize', border(mdim), border(mdim))
382 border(1:mdim - 1) = border(mdim)
383 border(1:mdim) =
floor(border(1:mdim) / mesh%spacing(1:mdim)) * mesh%spacing(1:mdim)
386 select type (box => mesh%box)
390 border(1:mdim) = box%half_length(1:mdim) *
m_half
392 call messages_write(
'PES_Flux_Lsize not specified. No default values available for this box shape.')
394 call messages_write(
'Specify the location of the parallelepiped with block PES_Flux_Lsize.')
397 call messages_write(
'PES_Flux_Lsize not specified. Using default values.')
411 this%surf_interp = .
true.
418 this%surf_interp = .
true.
431 select type (box => mesh%box)
433 this%radius = box%radius
435 this%radius = minval(box%half_length(1:mdim))
437 message(1) =
'PES_Flux_Radius not specified. No default values available for this box shape.'
438 message(2) =
'Specify the radius of the sphere with variable PES_Flux_Radius.'
441 message(1) =
'PES_Flux_Radius not specified. Using default values.'
453 call parse_variable(namespace,
'PES_Flux_StepsThetaR', 2 * this%lmax + 1, nstepsthetar)
464 call parse_variable(namespace,
'PES_Flux_StepsPhiR', 2 * this%lmax + 1, nstepsphir)
476 if (this%surf_shape == pes_cubic .or. this%surf_shape ==
pes_plane)
then
511 this%par_strategy = option__pes_flux_parallelization__pf_none
512 if (mesh%parallel_in_domains)
then
515 this%par_strategy = option__pes_flux_parallelization__pf_time &
516 + option__pes_flux_parallelization__pf_surface
518 this%par_strategy = option__pes_flux_parallelization__pf_surface
519 if (space%dim == 1) this%par_strategy = option__pes_flux_parallelization__pf_time
521 par_strategy = this%par_strategy
522 call parse_variable(namespace,
'PES_Flux_Parallelization', par_strategy, this%par_strategy)
530 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0 .and. &
531 bitand(this%par_strategy, option__pes_flux_parallelization__pf_momentum) /= 0)
then
532 call messages_input_error(namespace,
'PES_Flux_Parallelization',
"Cannot combine pf_surface and pf_momentum")
535 write(
message(1),
'(a)')
'Input: [PES_Flux_Parallelization = '
536 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_none) /= 0)
then
539 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_time) /= 0)
then
542 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_momentum) /= 0)
then
545 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0)
then
555 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0)
then
557 call pes_flux_distribute(1, this%nsrfcpnts, this%nsrfcpnts_start, this%nsrfcpnts_end, mesh%mpi_grp%comm)
570 this%nsrfcpnts_start = 1
571 this%nsrfcpnts_end = this%nsrfcpnts
598 use_symmetry = .false.
599 if ((this%surf_shape == pes_cubic .or. this%surf_shape ==
pes_plane) &
602 call parse_variable(namespace,
'PES_Flux_UseSymmetries', use_symmetry, this%use_symmetry)
609 safe_allocate(this%ylm_r(this%nsrfcpnts_start:this%nsrfcpnts_end, 0:this%lmax, -this%lmax:this%lmax))
612 if (this%nsrfcpnts_start > 0)
then
615 do isp = this%nsrfcpnts_start, this%nsrfcpnts_end
616 call ylmr_cmplx(this%rcoords(1:3, isp), ll, mm, this%ylm_r(isp, ll, mm))
617 this%ylm_r(isp, ll, mm) = conjg(this%ylm_r(isp, ll, mm))
625 (2*this%lmax+1)*(this%lmax+1)*this%nsrfcpnts)
626 call accel_write_buffer(this%ylm_r_buff, this%nsrfcpnts_end-this%nsrfcpnts_start+1, this%lmax+1, &
627 2*this%lmax+1, this%ylm_r(this%nsrfcpnts_start:this%nsrfcpnts_end, 0:this%lmax, -this%lmax:this%lmax))
644 call parse_variable(namespace,
'PES_Flux_RuntimeOutput', .false., this%runtime_output)
652 this%max_iter = max_iter
653 this%save_iter = save_iter
657 if (mesh%parallel_in_domains .and.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_time) /= 0)
then
658 this%tdsteps = mesh%mpi_grp%size
665 safe_allocate(this%wf(0:this%nsrfcpnts, stst:stend, 1:sdim, kptst:kptend, 1:this%tdsteps))
668 safe_allocate(this%gwf(0:this%nsrfcpnts, stst:stend, 1:sdim, kptst:kptend, 1:this%tdsteps, 1:mdim))
671 safe_allocate(this%veca(1:mdim, 1:this%tdsteps))
675 safe_allocate(this%spctramp_sph(1:this%nstepsomegak, stst:stend, 1:sdim, kptst:kptend, 1:this%nk))
676 this%spctramp_sph =
m_z0
678 safe_allocate(this%conjgphase_prev(1:this%nstepsomegak, 1:this%nk))
681 safe_allocate(this%spctramp_cub(stst:stend, 1:sdim, kptst:kptend, 1:this%nkpnts))
682 this%spctramp_cub =
m_z0
684 safe_allocate(this%conjgphase_prev(1:this%nkpnts, kptst:kptend))
688 this%conjgphase_prev =
m_z1
708 safe_deallocate_a(this%kcoords_sph)
709 safe_deallocate_a(this%ylm_k)
710 safe_deallocate_a(this%j_l)
711 safe_deallocate_a(this%ylm_r)
712 safe_deallocate_a(this%conjgphase_prev)
713 safe_deallocate_a(this%spctramp_sph)
715 safe_deallocate_a(this%kcoords_cub)
716 safe_deallocate_a(this%conjgphase_prev)
717 safe_deallocate_a(this%spctramp_cub)
719 if (.not. this%surf_interp)
then
720 safe_deallocate_a(this%srfcpnt)
722 safe_deallocate_a(this%rankmin)
724 safe_deallocate_a(this%face_idx_range)
725 safe_deallocate_a(this%LLr)
726 safe_deallocate_a(this%NN)
728 safe_deallocate_a(this%expkr)
729 safe_deallocate_a(this%expkr_perp)
730 safe_deallocate_a(this%bvk_phase)
732 safe_deallocate_a(this%Lkpuvz_inv)
736 safe_deallocate_a(this%klinear)
738 safe_deallocate_a(this%srfcnrml)
739 safe_deallocate_a(this%rcoords)
741 safe_deallocate_a(this%wf)
742 safe_deallocate_a(this%gwf)
743 safe_deallocate_a(this%veca)
764 class(
space_t),
intent(in) :: space
767 type(mpi_comm),
intent(in) :: comm
768 logical,
optional,
intent(in) :: post
770 integer :: mdim, pdim
771 integer :: kptst, kptend
773 integer :: ll, mm, idim, idir, ispin, nspin
774 integer :: ikk, ith, iph, iomk,ie, ik1, ik2, ik3, kgrid_block_dim
775 real(real64) :: kmax(space%dim), kmin(space%dim), kact, thetak, phik
778 real(real64) :: emin, emax, de , kvec(1:3), xx(3)
779 integer :: nkp_out, nkmin, nkmax
782 real(real64),
allocatable :: gpoints(:,:), gpoints_reduced(:,:)
783 real(real64) :: dk(1:3), kpoint(1:3), dthetak, dphik
784 logical :: use_enegy_grid, arpes_grid
788 kptst = st%d%kpt%start
789 kptend = st%d%kpt%end
791 pdim = space%periodic_dim
813 select case (this%surf_shape)
827 call parse_variable(namespace,
'PES_Flux_Momenutum_Grid', kgrid, this%kgrid)
840 if (space%is_periodic())
then
848 if (this%surf_shape == pes_cubic)
then
849 if (space%is_periodic())
then
870 use_enegy_grid = .false.
872 if (
parse_block(namespace,
'PES_Flux_EnergyGrid', blk) == 0)
then
879 use_enegy_grid = .
true.
901 call parse_variable(namespace,
'PES_Flux_ARPES_grid', .false., this%arpes_grid)
902 if (.not. use_enegy_grid .or. this%arpes_grid)
then
913 if (
parse_block(namespace,
'PES_Flux_Kmax', blk) == 0)
then
918 kgrid_block_dim = mdim
920 message(1) =
'Wrong block format for PES_Flux_Kmax and non-cartesian grid'
937 if (
parse_block(namespace,
'PES_Flux_Kmin', blk) == 0)
then
942 kgrid_block_dim = mdim
944 message(1) =
'Wrong block format for PES_Flux_Kmin and non-cartesian grid'
960 call parse_variable(namespace,
'PES_Flux_DeltaK', 0.02_real64, this%dk)
965 do idim = 1, kgrid_block_dim
966 if (kgrid_block_dim == 1)
then
1008 this%nstepsthetak = 45
1010 if (
parse_block(namespace,
'PES_Flux_ThetaK', blk) == 0)
then
1016 if (this%thetak_rng(idim) <
m_zero .or. this%thetak_rng(idim) >
m_pi)
then
1030 call parse_variable(namespace,
'PES_Flux_StepsThetaK', 45, this%nstepsthetak)
1055 this%nstepsphik = 90
1057 if (mdim == 1) this%phik_rng(1:2) = (/
m_pi,
m_zero/)
1058 if (
parse_block(namespace,
'PES_Flux_PhiK', blk) == 0)
then
1064 if (this%phik_rng(idim) <
m_zero .or. this%phik_rng(idim) >
m_two *
m_pi)
then
1079 call parse_variable(namespace,
'PES_Flux_StepsPhiK', 90, this%nstepsphik)
1081 if (this%nstepsphik == 0) this%nstepsphik = 1
1086 if (mdim == 3) dthetak = abs(this%thetak_rng(2) - this%thetak_rng(1)) / (this%nstepsthetak)
1087 dphik = abs(this%phik_rng(2) - this%phik_rng(1)) / (this%nstepsphik)
1092 this%nstepsthetak = 0
1094 this%nstepsomegak = this%nstepsphik
1097 this%nstepsthetak = 0
1098 this%nstepsomegak = this%nstepsphik
1101 if (this%nstepsthetak <= 1)
then
1103 this%nstepsthetak = 1
1107 do ith = 0, this%nstepsthetak
1108 thetak = ith * dthetak + this%thetak_rng(1)
1109 do iph = 0, this%nstepsphik - 1
1110 phik = iph * dphik + this%phik_rng(1)
1115 this%nstepsomegak = iomk
1122 write(
message(1),
'(a)')
"Polar momentum grid:"
1125 write(
message(1),
'(a,f12.6,a,f12.6,a, i6)') &
1126 " Theta = (", this%thetak_rng(1),
",",this%thetak_rng(2), &
1127 "); n = ", this%nstepsthetak
1130 write(
message(1),
'(a,f12.6,a,f12.6,a, i6)') &
1131 " Phi = (", this%phik_rng(1),
",",this%phik_rng(2), &
1132 "); n = ", this%nstepsphik
1137 if (use_enegy_grid)
then
1138 this%nk = nint(abs(emax - emin) / de)
1140 this%nk = nint(abs(kmax(1) - kmin(1)) / this%dk)
1142 this%nkpnts = this%nstepsomegak * this%nk
1144 this%ll(1) = this%nk
1145 this%ll(2) = this%nstepsphik
1146 this%ll(3) = this%nstepsthetak
1147 this%ll(mdim+1:3) = 1
1149 safe_allocate(this%klinear(1:this%nk, 1))
1155 dk(1:mdim) =
m_one/kpoints%nik_axis(1:mdim)
1157 this%arpes_grid = .false.
1158 if (space%is_periodic())
then
1169 arpes_grid = kpoints%have_zero_weight_path()
1170 call parse_variable(namespace,
'PES_Flux_ARPES_grid', arpes_grid, this%arpes_grid)
1179 if (kpoints%have_zero_weight_path())
then
1181 if (this%arpes_grid)
then
1182 nkmax =
floor(emax / de)
1183 nkmin =
floor(emin / de)
1186 nkmax =
floor(kmax(mdim) / this%dk)
1187 nkmin =
floor(kmin(mdim) / this%dk)
1191 this%ll(mdim) = abs(nkmax - nkmin) + 1
1193 this%nk = this%ll(mdim)
1198 if (.not. this%arpes_grid)
then
1199 this%ll(1:mdim) =
floor(abs(kmax(1:mdim) - kmin(1:mdim))/this%dk) + 1
1200 this%nk = maxval(this%ll(1:mdim))
1204 nkmax =
floor(emax / de)
1205 nkmin =
floor(emin / de)
1206 this%nk = abs(nkmax - nkmin) + 1
1208 this%ll(1:pdim) =
floor(abs(kmax(1:pdim) - kmin(1:pdim))/this%dk) + 1
1209 this%ll(mdim) = this%nk
1213 safe_allocate(this%klinear(1:maxval(this%ll(1:mdim)), 1:mdim))
1219 this%nkpnts = product(this%ll(1:mdim))
1228 this%parallel_in_momentum = .false.
1231 select case (this%kgrid)
1235 if (use_enegy_grid)
then
1237 this%klinear(ie, 1) =
sqrt(
m_two * (ie * de + emin))
1241 this%klinear(ikk, 1) = ikk * this%dk + kmin(1)
1255 if ((this%nk_end - this%nk_start + 1) < this%nk) this%parallel_in_momentum = .
true.
1256 call pes_flux_distribute(1, this%nstepsomegak, this%nstepsomegak_start, this%nstepsomegak_end, comm)
1268 safe_allocate(this%j_l(this%nk_start:this%nk_end, 0:this%lmax))
1271 safe_allocate(this%kcoords_sph(1:3, this%nk_start:this%nk_end, 1:this%nstepsomegak))
1272 this%kcoords_sph =
m_zero
1274 safe_allocate(this%ylm_k(this%nstepsomegak_start:this%nstepsomegak_end, -this%lmax:this%lmax, 0:this%lmax))
1279 do ith = 0, this%nstepsthetak
1280 thetak = ith * dthetak + this%thetak_rng(1)
1281 do iph = 0, this%nstepsphik - 1
1282 phik = iph * dphik + this%phik_rng(1)
1284 if (iomk >= this%nstepsomegak_start .and. iomk <= this%nstepsomegak_end)
then
1285 xx(1) =
cos(phik) *
sin(thetak)
1286 xx(2) =
sin(phik) *
sin(thetak)
1289 do ll = 0, this%lmax
1291 call ylmr_cmplx(xx, ll, mm, this%ylm_k(iomk, mm, ll))
1295 if (this%nk_start > 0)
then
1296 this%kcoords_sph(1, this%nk_start:this%nk_end, iomk) =
cos(phik) *
sin(thetak)
1297 this%kcoords_sph(2, this%nk_start:this%nk_end, iomk) =
sin(phik) *
sin(thetak)
1298 this%kcoords_sph(3, this%nk_start:this%nk_end, iomk) =
cos(thetak)
1304 if (this%nk_start > 0)
then
1306 do ikk = this%nk_start, this%nk_end
1307 kact = this%klinear(ikk,1)
1308 do ll = 0, this%lmax
1312 this%kcoords_sph(:, ikk, :) = kact * this%kcoords_sph(:, ikk, :)
1320 this%nkpnts_start = 1
1321 this%nkpnts_end = this%nkpnts
1324 safe_allocate(this%kcoords_cub(1:mdim, this%nkpnts_start:this%nkpnts_end, 1))
1326 this%kcoords_cub =
m_zero
1331 do ikk = -this%nk, this%nk
1334 kact = sign(1,ikk) * this%klinear(abs(ikk), 1)
1335 this%kcoords_cub(1, ikp, 1) = kact
1343 do ith = 0, this%nstepsthetak
1344 if (mdim == 3) thetak = ith * dthetak + this%thetak_rng(1)
1345 do iph = 0, this%nstepsphik - 1
1347 phik = iph * dphik + this%phik_rng(1)
1348 kact = this%klinear(ikk,1)
1349 this%kcoords_cub(1, ikp,1) = kact *
cos(phik) *
sin(thetak)
1350 this%kcoords_cub(2, ikp,1) = kact *
sin(phik) *
sin(thetak)
1351 if (mdim == 3) this%kcoords_cub(3, ikp,1) = kact *
cos(thetak)
1362 this%nkpnts_start = 1
1363 this%nkpnts_end = this%nkpnts
1365 if (kpoints%have_zero_weight_path())
then
1370 safe_allocate(this%kcoords_cub(1:mdim, this%nkpnts_start:this%nkpnts_end, kptst:kptend))
1371 this%kcoords_cub =
m_zero
1380 do ikpt = (kptst-1)+ispin, kptend, nspin
1382 do ikk = nkmin, nkmax
1383 kvec(1:mdim) = - kpoints%get_point(st%d%get_kpoint_index(ikpt))
1391 safe_allocate(this%kcoords_cub(1:mdim, this%nkpnts_start:this%nkpnts_end, 1))
1393 safe_allocate(this%Lkpuvz_inv(1:this%ll(1), 1:this%ll(2), 1:this%ll(3)))
1396 do ikk = 1, this%ll(idir)
1397 this%klinear(ikk, idir) = ikk * this%dk + kmin(idir)
1402 if (.not. this%arpes_grid)
then
1409 do ik3 = 1, this%ll(3)
1410 if (mdim>2) kvec(3) = this%klinear(ik3, 3)
1411 do ik2 = 1, this%ll(2)
1412 if (mdim>1) kvec(2) = this%klinear(ik2, 2)
1413 do ik1 = 1, this%ll(1)
1415 kvec(1) = this%klinear(ik1, 1)
1416 this%kcoords_cub(1:mdim, ikp, ikpt) = kvec(1:mdim)
1417 this%Lkpuvz_inv(ik1, ik2, ik3) = ikp
1429 do ikk = nkmin, nkmax
1435 do ik1 = 1, this%ll(1)
1436 kvec(1) = this%klinear(ik1,1)
1437 kvec(1:pdim) = matmul(kpoints%latt%klattice_primitive(1:pdim, 1:pdim), kvec(1:pdim))
1443 do ik2 = 1, this%ll(2)
1444 do ik1 = 1, this%ll(1)
1445 kvec(1:2) = (/this%klinear(ik1,1), this%klinear(ik2,2)/)
1446 kvec(1:pdim) = matmul(kpoints%latt%klattice_primitive(1:pdim, 1:pdim), kvec(1:pdim))
1449 this%Lkpuvz_inv(ik1, ik2, ikk - nkmin + 1) = ikp
1502 if (this%arpes_grid)
then
1511 safe_deallocate_a(gpoints)
1512 safe_deallocate_a(gpoints_reduced)
1533 this%ktransf(:,:) =
m_zero
1535 this%ktransf(idim,idim) =
m_one
1538 if (
parse_block(namespace,
'PES_Flux_GridTransformMatrix', blk) == 0)
then
1546 write(
message(1),
'(a)')
'Momentum grid transformation matrix :'
1547 do idir = 1, space%dim
1548 write(
message(1 + idir),
'(9f12.6)') ( this%ktransf(idim, idir), idim = 1, mdim)
1557 do ith = 0, this%nstepsthetak
1558 do iph = 0, this%nstepsphik - 1
1560 do ikk = this%nk_start, this%nk_end
1561 kvec(1:mdim) = this%kcoords_sph(1:mdim, ikk, iomk)
1562 this%kcoords_sph(1:mdim, ikk, iomk) = matmul(this%ktransf(1:mdim, 1:mdim), kvec(1:mdim))
1564 if (ith == 0 .or. ith == this%nstepsthetak)
exit
1570 do ikpt = kptst, kptend + 1
1571 if (ikpt == kptend + 1)
then
1572 kpoint(1:space%dim) =
m_zero
1574 kpoint(1:space%dim) = kpoints%get_point(st%d%get_kpoint_index(ikpt))
1577 do ikp = 1, this%nkpnts
1579 kvec(1:mdim) = this%kcoords_cub(1:mdim, ikp, ikpt) - kpoint(1:mdim)
1580 this%kcoords_cub(1:mdim, ikp, ikpt) = matmul(this%ktransf(1:mdim, 1:mdim), kvec(1:mdim)) &
1602 real(real64) :: kpar(1:pdim), val
1607 if (ikk /= 0) sign= ikk / abs(ikk)
1609 kpar(1:pdim) = kvec(1:pdim)
1610 val = abs(ikk) * de *
m_two - sum(kpar(1:pdim)**2)
1612 kvec(mdim) = sign *
sqrt(val)
1615 kvec(mdim) =
sqrt(val)
1616 nkp_out = nkp_out + 1
1619 this%kcoords_cub(1:mdim, ikp, ikpt) = kvec(1:mdim)
1629 subroutine pes_flux_calc(this, space, mesh, st, der, ext_partners, kpoints, iter, dt, stopping)
1631 class(
space_t),
intent(in) :: space
1632 type(
mesh_t),
intent(in) :: mesh
1637 integer,
intent(in) :: iter
1638 real(real64),
intent(in) :: dt
1639 logical,
intent(in) :: stopping
1641 integer :: stst, stend, kptst, kptend, sdim, mdim
1642 integer :: ist, ik, isdim, imdim
1644 integer :: il, ip_local
1645 integer :: ib, minst, maxst, nst_linear, ist_linear
1646 integer :: k_offset, n_boundary_points
1647 logical :: contains_isp
1649 complex(real64),
allocatable :: interp_values(:)
1650 complex(real64),
allocatable :: interp_values_accel(:, :)
1651 complex(real64),
allocatable :: wf_tmp_accel(:, :), gwf_tmp_accel(:, :, :)
1652 complex(real64),
allocatable :: gpsi(:, :), psi(:)
1661 if (iter == 0)
return
1667 kptst = st%d%kpt%start
1668 kptend = st%d%kpt%end
1672 safe_allocate(psi(1:mesh%np_part))
1673 safe_allocate(gpsi(1:mesh%np_part, 1:mdim))
1676 safe_allocate(interp_values(1:this%nsrfcpnts))
1679 this%itstep = this%itstep + 1
1683 if(
associated(lasers))
then
1684 do il = 1, lasers%no_lasers
1685 call laser_field(lasers%lasers(il), this%veca(1:mdim, this%itstep), iter*dt)
1688 this%veca(:, this%itstep) = - this%veca(:, this%itstep)
1693 call phase%init(mesh, st%d%kpt, kpoints, st%d, space)
1695 do ik = kptst, kptend
1696 do ib = st%group%block_start, st%group%block_end
1702 call st%group%psib(ib, ik)%copy_to(psib)
1704 call phase%apply_to(mesh, mesh%np_part, conjugate=.false., psib=psib, src=st%group%psib(ib, ik), async=.
true.)
1706 k_offset = psib%ik - kptst
1707 n_boundary_points = int(mesh%np_part - mesh%np)
1708 call boundaries_set(der%boundaries, mesh, psib, phase_correction=phase%phase_corr(:, psib%ik), &
1709 buff_phase_corr=phase%buff_phase_corr, offset=k_offset*n_boundary_points, async=.
true.)
1712 psib => st%group%psib(ib, ik)
1720 nst_linear = psib%nst_linear
1722 if(this%surf_interp)
then
1724 safe_allocate(interp_values_accel(1:this%nsrfcpnts, 1:nst_linear))
1727 this%rcoords(1:mdim, 1:this%nsrfcpnts), this%coords_buff, &
1728 interp_values_accel(1:this%nsrfcpnts, 1:nst_linear), this%interp_buff, this%spacing_buff, this%pt_buff)
1730 do ist = minst, maxst
1732 ist_linear = psib%ist_idim_to_linear((/ist - minst + 1, isdim/))
1733 this%wf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep) = &
1734 st%occ(ist, ik) * interp_values_accel(1:this%nsrfcpnts, ist_linear)
1740 gpsib(imdim), this%rcoords(1:mdim, 1:this%nsrfcpnts), this%coords_buff, &
1741 interp_values_accel(1:this%nsrfcpnts, 1:nst_linear), this%interp_buff, this%spacing_buff, this%pt_buff)
1742 do ist = minst, maxst
1744 ist_linear = psib%ist_idim_to_linear((/ist - minst + 1, isdim/))
1745 this%gwf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep, imdim) = &
1746 st%occ(ist, ik) * interp_values_accel(1:this%nsrfcpnts, ist_linear)
1751 safe_deallocate_a(interp_values_accel)
1755 call profiling_in(tostring(pes_flux_calc_cubic_reduction))
1757 safe_allocate(wf_tmp_accel(1:mesh%np_part, 1:nst_linear))
1758 safe_allocate(gwf_tmp_accel(1:mdim, 1:mesh%np_part, 1:nst_linear))
1760 call accel_read_buffer(psib%ff_device, mesh%np_part, nst_linear, wf_tmp_accel(:, :))
1762 call accel_read_buffer(gpsib(imdim)%ff_device, mesh%np_part, nst_linear, gwf_tmp_accel(imdim, :, :))
1765 do ist = minst, maxst
1766 contains_isp = .
true.
1767 do isp = 1, this%nsrfcpnts
1768 if (mesh%parallel_in_domains)
then
1769 contains_isp = mesh%mpi_grp%rank == this%rankmin(isp)
1772 if (.not. contains_isp) cycle
1774 ip_local = this%srfcpnt(isp)
1776 ist_linear = psib%ist_idim_to_linear((/ist - minst + 1, isdim/))
1777 this%wf(isp, ist, isdim, ik, this%itstep) = &
1778 st%occ(ist, ik) * wf_tmp_accel(ip_local, ist_linear)
1779 this%gwf(isp, ist, isdim, ik, this%itstep, 1:mdim) = &
1780 st%occ(ist, ik) * gwf_tmp_accel(1:mdim, ip_local, ist_linear)
1784 if (mesh%parallel_in_domains)
then
1786 call mesh%allreduce(this%wf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep))
1788 call mesh%allreduce(this%gwf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep, imdim))
1794 safe_deallocate_a(wf_tmp_accel)
1795 safe_deallocate_a(gwf_tmp_accel)
1803 do ist = minst, maxst
1809 call batch_get_state(gpsib(imdim), (/ist, isdim/), mesh%np_part, gpsi(:, imdim))
1812 if (this%surf_interp)
then
1815 this%rcoords(1:mdim, 1:this%nsrfcpnts), interp_values(1:this%nsrfcpnts))
1816 this%wf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep) = st%occ(ist, ik) * interp_values(1:this%nsrfcpnts)
1819 this%rcoords(1:mdim, 1:this%nsrfcpnts), interp_values(1:this%nsrfcpnts))
1820 this%gwf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep, imdim) = &
1821 st%occ(ist, ik) * interp_values(1:this%nsrfcpnts)
1826 contains_isp = .
true.
1827 do isp = 1, this%nsrfcpnts
1828 if (mesh%parallel_in_domains)
then
1829 contains_isp = mesh%mpi_grp%rank == this%rankmin(isp)
1832 if (.not. contains_isp) cycle
1834 ip_local = this%srfcpnt(isp)
1835 this%wf(isp, ist, isdim, ik, this%itstep) = st%occ(ist, ik) * psi(ip_local)
1836 this%gwf(isp, ist, isdim, ik, this%itstep, 1:mdim) = &
1837 st%occ(ist, ik) * gpsi(ip_local, 1:mdim)
1840 if (mesh%parallel_in_domains)
then
1841 call mesh%allreduce(this%wf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep))
1843 call mesh%allreduce(this%gwf(1:this%nsrfcpnts, ist, isdim, ik, this%itstep, imdim))
1854 call gpsib(imdim)%end(copy = .false.)
1858 call psib%end(copy = .false.)
1859 safe_deallocate_p(psib)
1864 if (this%surf_interp)
then
1865 safe_deallocate_a(interp_values)
1868 safe_deallocate_a(psi)
1869 safe_deallocate_a(gpsi)
1873 if (this%itstep == this%tdsteps .or. mod(iter, this%save_iter) == 0 .or. iter == this%max_iter .or. stopping)
then
1874 if (this%surf_shape == pes_cubic .or. this%surf_shape ==
pes_plane)
then
1895 class(
space_t),
intent(in) :: space
1896 type(
mesh_t),
intent(in) :: mesh
1900 integer :: kptst, kptend, mdim
1901 integer :: ik, j1, j2, jvec(1:2)
1902 integer :: isp, ikp, ikp_start, ikp_end
1905 integer :: idir, pdim, nfaces, ifc, n_dir
1906 complex(real64) :: tmp
1907 real(real64) :: kpoint(1:3), vec(1:3), lvec(1:3)
1911 if (kpoints%have_zero_weight_path())
then
1912 kptst = st%d%kpt%start
1913 kptend = st%d%kpt%end
1920 pdim = space%periodic_dim
1922 ikp_start = this%nkpnts_start
1923 ikp_end = this%nkpnts_end
1929 this%srfcnrml(:, 1:this%nsrfcpnts) = this%srfcnrml(:, 1:this%nsrfcpnts) * mesh%coord_system%surface_element(3)
1932 if (.not. this%use_symmetry .or. kpoints%have_zero_weight_path())
then
1934 safe_allocate(this%expkr(1:this%nsrfcpnts,ikp_start:ikp_end,kptst:kptend,1))
1936 do ik = kptst, kptend
1937 do ikp = ikp_start, ikp_end
1938 do isp = 1, this%nsrfcpnts
1939 this%expkr(isp,ikp,ik,1) =
exp(-
m_zi * sum(this%rcoords(1:mdim,isp) &
1940 * this%kcoords_cub(1:mdim, ikp, ik))) &
1952 if (this%surf_shape ==
pes_plane) nfaces = 1
1955 safe_allocate(this%expkr(1:this%nsrfcpnts,maxval(this%ll(1:mdim)),kptst:kptend,1:mdim))
1956 this%expkr(:,:,:,:) =
m_z1
1958 do ik = kptst, kptend
1960 do ikp = 1, this%ll(idir)
1961 do isp = 1, this%nsrfcpnts
1962 this%expkr(isp,ikp,ik,idir) =
exp(-
m_zi * this%rcoords(idir,isp) &
1963 * this%klinear(ikp, idir)) &
1971 safe_allocate(this%expkr_perp(1:maxval(this%ll(1:mdim)), 1:nfaces))
1972 this%expkr_perp(:,:) =
m_z1
1975 if (this%face_idx_range(ifc, 1) < 0) cycle
1976 isp = this%face_idx_range(ifc, 1)
1978 if (abs(this%srfcnrml(idir, isp)) >=
m_epsilon) n_dir = idir
1981 do ikp = 1, this%ll(n_dir)
1982 this%expkr_perp(ikp, ifc) =
exp(-
m_zi * this%rcoords(n_dir,isp) &
1983 * this%klinear(ikp, n_dir)) &
1993 if (space%is_periodic())
then
1995 safe_allocate(this%bvk_phase(ikp_start:ikp_end,st%d%kpt%start:st%d%kpt%end))
1997 this%bvk_phase(:,:) =
m_z0
2000 do ik = st%d%kpt%start, st%d%kpt%end
2001 kpoint(1:mdim) = kpoints%get_point(st%d%get_kpoint_index(ik))
2002 if (kpoints%have_zero_weight_path())
then
2007 do ikp = ikp_start, ikp_end
2008 vec(1:pdim) = this%kcoords_cub(1:pdim, ikp, ik_map) + kpoint(1:pdim)
2009 do j1 = 0, kpoints%nik_axis(1) - 1
2010 do j2 = 0, kpoints%nik_axis(2) - 1
2011 jvec(1:2)=(/j1, j2/)
2012 lvec(1:pdim) = matmul(kpoints%latt%rlattice(1:pdim, 1:2), jvec(1:2))
2013 tmp = sum(lvec(1:pdim) * vec(1:pdim))
2014 this%bvk_phase(ikp, ik) = this%bvk_phase(ikp,ik) &
2022 this%bvk_phase(:,:) = this%bvk_phase(:,:) *
m_one / product(kpoints%nik_axis(1:pdim))
2044 pure function get_ikp(this, ikpu, ikpv, ikpz, n_dir)
result(ikp)
2046 integer,
intent(in) :: ikpu
2047 integer,
intent(in) :: ikpv
2048 integer,
intent(in) :: ikpz
2049 integer,
intent(in) :: n_dir
2054 ikp = this%Lkpuvz_inv(ikpz, ikpu, ikpv)
2056 ikp = this%Lkpuvz_inv(ikpu, ikpz, ikpv)
2058 ikp = this%Lkpuvz_inv(ikpu, ikpv, ikpz)
2070 type(
mesh_t),
intent(in) :: mesh
2073 integer :: mdim, nfaces, ifc, ifp_start, ifp_end
2080 if (this%surf_shape ==
pes_plane) nfaces = 1
2084 ifp_start = this%face_idx_range(ifc, 1)
2085 ifp_end = this%face_idx_range(ifc, 2)
2088 if (this%nsrfcpnts_start <= ifp_end)
then
2090 if (this%nsrfcpnts_start >= ifp_start)
then
2091 if (this%nsrfcpnts_start <= ifp_end)
then
2092 this%face_idx_range(ifc, 1) = this%nsrfcpnts_start
2094 this%face_idx_range(ifc, 1:2) = -1
2098 if (this%nsrfcpnts_end <= ifp_end)
then
2099 if (this%nsrfcpnts_end >= ifp_start)
then
2100 this%face_idx_range(ifc, 2) = this%nsrfcpnts_end
2102 this%face_idx_range(ifc, 1:2) = -1
2108 this%face_idx_range(ifc, 1:2) = -1
2127 class(
space_t),
intent(in) :: space
2128 type(
mesh_t),
intent(in) :: mesh
2131 real(real64),
intent(in) :: dt
2133 integer :: stst, stend, kptst, kptend, sdim, mdim
2134 integer :: ist, ik, isdim, imdim, ik_map
2135 integer :: ikp, itstep
2136 integer :: idir, n_dir, nfaces
2137 complex(real64),
allocatable :: Jk_cub(:,:,:,:), spctramp_cub(:,:,:,:)
2138 integer :: ikp_start, ikp_end, isp_start, isp_end
2139 real(real64) :: vec, kpoint(1:3)
2141 complex(real64),
allocatable :: wfpw(:), gwfpw(:)
2142 complex(real64),
allocatable :: phase(:,:),vphase(:,:)
2144 integer :: tdstep_on_node
2148 integer :: ikpu, ikpv, ikpz, dir_on_face(1:2)
2149 complex(real64) :: face_int_gwf, face_int_wf
2158 call messages_write(
"Debug: calculating pes_flux cub surface integral (accelerated direct expression)")
2163 if (
bitand(this%par_strategy, option__pes_flux_parallelization__pf_time) /= 0)
then
2164 if (mesh%parallel_in_domains) tdstep_on_node = mesh%mpi_grp%rank + 1
2169 kptst = st%d%kpt%start
2170 kptend = st%d%kpt%end
2174 ikp_start = this%nkpnts_start
2175 ikp_end = this%nkpnts_end
2179 safe_allocate(jk_cub(stst:stend, 1:sdim, kptst:kptend, ikp_start:ikp_end))
2180 safe_allocate(spctramp_cub(stst:stend, 1:sdim, kptst:kptend, ikp_start:ikp_end))
2184 safe_allocate(vphase(ikp_start:ikp_end, kptst:kptend))
2185 safe_allocate(phase(ikp_start:ikp_end, kptst:kptend))
2191 if (this%surf_shape ==
pes_plane) nfaces = 1
2193 safe_allocate( wfpw(ikp_start:ikp_end))
2194 safe_allocate(gwfpw(ikp_start:ikp_end))
2199 if (this%face_idx_range(ifc, 1)<0) cycle
2202 isp_start = this%face_idx_range(ifc, 1)
2203 isp_end = this%face_idx_range(ifc, 2)
2206 nfp = isp_end - isp_start + 1
2214 if (abs(this%srfcnrml(idir, isp_start)) >=
m_epsilon)
then
2217 dir_on_face(imdim)=idir
2224 vphase(ikp_start:ikp_end,:) = this%conjgphase_prev(ikp_start:ikp_end,:)
2226 jk_cub(:, :, :, :) =
m_z0
2228 do itstep = 1, this%itstep
2230 do ik = kptst, kptend
2232 if (kpoints%have_zero_weight_path())
then
2238 kpoint(1:mdim) = kpoints%get_point(st%d%get_kpoint_index(ik))
2239 do ikp = ikp_start, ikp_end
2240 vec = sum((this%kcoords_cub(1:mdim, ikp, ik_map) - this%veca(1:mdim, itstep) /
p_c)**2)
2241 vphase(ikp, ik) = vphase(ikp, ik) *
exp(
m_zi * vec * dt /
m_two)
2244 if (space%is_periodic())
then
2245 phase(ikp, ik) = vphase(ikp, ik) * this%bvk_phase(ikp,ik)
2247 phase(ikp, ik) = vphase(ikp, ik)
2252 if (itstep /= tdstep_on_node) cycle
2254 do ist = stst, stend
2259 if (.not. this%use_symmetry .or. kpoints%have_zero_weight_path())
then
2261 do ikp = ikp_start , ikp_end
2264 sum(this%gwf(isp_start:isp_end, ist, isdim, ik, itstep, n_dir) &
2265 * this%expkr(isp_start:isp_end, ikp, ik_map, 1) &
2266 * this%srfcnrml(n_dir, isp_start:isp_end))
2270 sum(this%wf(isp_start:isp_end, ist, isdim, ik, itstep) &
2271 * this%expkr(isp_start:isp_end, ikp,ik_map, 1) &
2272 * this%srfcnrml(n_dir, isp_start:isp_end))
2277 do ikpu = 1, this%ll(dir_on_face(1))
2278 do ikpv = 1, this%ll(dir_on_face(2))
2281 face_int_gwf = sum(this%gwf(isp_start:isp_end, ist, isdim, ik, itstep, n_dir) &
2282 * this%expkr(isp_start:isp_end, ikpu, ik_map, dir_on_face(1)) &
2283 * this%expkr(isp_start:isp_end, ikpv, ik_map, dir_on_face(2)) &
2284 * this%srfcnrml(n_dir, isp_start:isp_end))
2286 face_int_wf = sum(this%wf(isp_start:isp_end, ist, isdim, ik, itstep) &
2287 * this%expkr(isp_start:isp_end, ikpu, ik_map, dir_on_face(1)) &
2288 * this%expkr(isp_start:isp_end, ikpv, ik_map, dir_on_face(2)) &
2289 * this%srfcnrml(n_dir, isp_start:isp_end))
2291 do ikpz = 1, this%ll(n_dir)
2293 gwfpw(
get_ikp(this, ikpu, ikpv, ikpz, n_dir)) = face_int_gwf &
2294 * this%expkr_perp(ikpz, ifc)
2295 wfpw(
get_ikp(this, ikpu, ikpv, ikpz, n_dir)) = face_int_wf &
2296 * this%expkr_perp(ikpz, ifc)
2308 jk_cub(ist, isdim, ik, ikp_start:ikp_end) = jk_cub(ist, isdim, ik, ikp_start:ikp_end) + &
2309 phase(ikp_start:ikp_end, ik) * (wfpw(ikp_start:ikp_end) * &
2310 (
m_two * this%veca(n_dir, itstep) /
p_c - this%kcoords_cub(n_dir, ikp_start:ikp_end, ik_map)) + &
2311 m_zi * gwfpw(ikp_start:ikp_end))
2321 spctramp_cub(:,:,:,:) = spctramp_cub(:,:,:,:) + jk_cub(:,:,:,:) *
m_half
2327 this%conjgphase_prev(ikp_start:ikp_end, :) = vphase(ikp_start:ikp_end, :)
2330 if (mesh%parallel_in_domains .and.(
bitand(this%par_strategy, option__pes_flux_parallelization__pf_time) /= 0 &
2331 .or.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0))
then
2332 call mesh%allreduce(spctramp_cub)
2337 this%spctramp_cub = this%spctramp_cub + spctramp_cub * dt
2339 safe_deallocate_a(gwfpw)
2340 safe_deallocate_a(wfpw)
2342 safe_deallocate_a(jk_cub)
2343 safe_deallocate_a(spctramp_cub)
2344 safe_deallocate_a(phase)
2345 safe_deallocate_a(vphase)
2357 type(
mesh_t),
intent(in) :: mesh
2359 real(real64),
intent(in) :: dt
2361 integer :: stst, stend, kptst, kptend, sdim
2362 integer :: ist, ik, isdim, imdim
2363 integer :: itstep, lmax
2364 integer :: ll, mm, ip
2365 complex(real64),
allocatable :: s1_node(:,:,:,:,:,:)
2366 complex(real64),
allocatable :: s2_node(:,:,:,:,:)
2367 complex(real64),
allocatable :: integ11_t(:,:,:), integ12_t(:,:,:)
2368 complex(real64),
allocatable :: integ21_t(:,:), integ22_t(:,:)
2369 complex(real64),
allocatable :: spctramp_sph(:,:,:,:,:)
2370 integer :: ikk, ikk_start, ikk_end, ikk2
2371 integer :: isp_start, isp_end
2372 integer :: iomk, iomk_start, iomk_end
2373 complex(real64),
allocatable :: phase_act(:,:)
2375 complex(real64) :: weight_x, weight_y, weight_z
2376 integer :: tdstep_on_node
2378 type(
accel_kernel_t),
save,
target :: pes_flux_sph_integrate_kernel
2379 type(
accel_kernel_t),
save,
target :: pes_flux_sph_integrate_xx_kernel
2380 type(
accel_kernel_t),
save,
target :: pes_flux_sph_integrate_xx_2_kernel
2382 type(
accel_mem_t) :: integ11_t_buff, integ21_t_buff
2383 type(
accel_mem_t) :: integ12_t_buff, integ22_t_buff
2385 complex(real64),
allocatable :: weight_x_host(:)
2386 integer(int64) :: n_buff_elements
2387 integer(int64) :: nkk
2388 integer :: nsrfcpnts
2389 integer(int64) :: gsx, wgsize
2395 call messages_write(
"Debug: calculating pes_flux sph surface integral")
2399 if (mesh%parallel_in_domains) tdstep_on_node = mesh%mpi_grp%rank + 1
2403 kptst = st%d%kpt%start
2404 kptend = st%d%kpt%end
2408 ikk_start = this%nk_start
2409 ikk_end = this%nk_end
2410 isp_start = this%nsrfcpnts_start
2411 isp_end = this%nsrfcpnts_end
2412 iomk_start = this%nstepsomegak_start
2413 iomk_end = this%nstepsomegak_end
2416 safe_allocate(integ11_t(1:this%nstepsomegak, 1:3, 0:lmax))
2417 safe_allocate(integ21_t(1:this%nstepsomegak, 0:lmax))
2418 safe_allocate(integ12_t(1:this%nstepsomegak, 1:3, ikk_start:ikk_end))
2419 safe_allocate(integ22_t(1:this%nstepsomegak, ikk_start:ikk_end))
2421 safe_allocate(spctramp_sph(1:this%nstepsomegak, stst:stend, 1:sdim, kptst:kptend, 1:this%nk))
2426 safe_allocate(phase_act(1:this%nstepsomegak, ikk_start:ikk_end))
2427 if (ikk_start > 0)
then
2428 phase_act(:, ikk_start:ikk_end) = this%conjgphase_prev(:, ikk_start:ikk_end)
2430 phase_act(:, ikk_start:ikk_end) =
m_z0
2437 safe_allocate(s1_node(1:3, -lmax:lmax, 0:lmax, stst:stend, 1:sdim, kptst:kptend))
2438 safe_allocate(s2_node(-lmax:lmax, 0:lmax, stst:stend, 1:sdim, kptst:kptend))
2443 n_buff_elements = int((2*lmax+1)*(lmax+1)*(stend-stst+1)*sdim*(kptend-kptst+1), int64)
2444 nsrfcpnts = isp_end - isp_start + 1
2448 call accel_write_buffer(this%srfcnrml_buff, 3, nsrfcpnts, this%srfcnrml(1:3, isp_start:isp_end))
2455 nsrfcpnts*(stend-stst+1)*sdim*(kptend-kptst+1))
2457 3_int64*nsrfcpnts*(stend-stst+1)*sdim*(kptend-kptst+1))
2460 nkk = iomk_end - iomk_start + 1
2465 this%ylm_k(iomk_start:iomk_end, -lmax:lmax, 0:lmax))
2469 int((lmax+1)*3,int64)*this%nstepsomegak)
2471 int((lmax+1),int64)*this%nstepsomegak)
2478 this%j_l(ikk_start:ikk_end, 0:lmax))
2482 int((ikk_end-ikk_start+1)*3,int64)*this%nstepsomegak)
2484 int((ikk_end-ikk_start+1),int64)*this%nstepsomegak)
2489 do itstep = 1, this%itstep
2495 this%wf(isp_start:isp_end,stst:stend,:,kptst:kptend,itstep:itstep))
2496 call accel_write_buffer(gwf_buff, nsrfcpnts, stend-stst+1, sdim, kptend-kptst+1, 1, 3, &
2497 this%gwf(isp_start:isp_end,stst:stend,:,kptst:kptend, itstep:itstep, 1:3))
2499 call accel_kernel_start_call(pes_flux_sph_integrate_kernel,
'pes.cu',
'zpes_flux_sph_integrate', flags =
'-DRTYPE_COMPLEX')
2515 gsx = ((n_buff_elements + wgsize - 1) / wgsize) * wgsize
2516 if (gsx >
accel%max_grid_dim(1) * wgsize) gsx =
accel%max_grid_dim(1) * wgsize
2520 if (mesh%parallel_in_domains .and.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0)
then
2521 call accel_read_buffer(s1_node_buff, 3, 2*lmax+1, lmax+1, stend-stst+1, sdim, kptend-kptst+1, &
2522 s1_node(1:3, -lmax:lmax, 0:lmax, stst:stend, 1:sdim, kptst:kptend), async=.
true.)
2523 call accel_read_buffer(s2_node_buff, 2*lmax+1, lmax+1, stend-stst+1, sdim, kptend-kptst+1, &
2524 s2_node(-lmax:lmax, 0:lmax, stst:stend, 1:sdim, kptst:kptend))
2529 do ik = kptst, kptend
2530 do ist = stst, stend
2534 s1_node(1:3, mm, ll, ist, isdim, ik) =
m_zero
2535 s2_node(mm, ll, ist, isdim, ik) =
m_zero
2537 do ip = isp_start, isp_end
2538 weight_x = this%ylm_r(ip, ll, mm) * this%srfcnrml(1, ip)
2539 weight_y = this%ylm_r(ip, ll, mm) * this%srfcnrml(2, ip)
2540 weight_z = this%ylm_r(ip, ll, mm) * this%srfcnrml(3, ip)
2541 s1_node(1, mm, ll, ist, isdim, ik) = s1_node(1, mm, ll, ist, isdim, ik) + &
2542 weight_x * this%wf(ip, ist, isdim, ik, itstep)
2543 s1_node(2, mm, ll, ist, isdim, ik) = s1_node(2, mm, ll, ist, isdim, ik) + &
2544 weight_y * this%wf(ip, ist, isdim, ik, itstep)
2545 s1_node(3, mm, ll, ist, isdim, ik) = s1_node(3, mm, ll, ist, isdim, ik) + &
2546 weight_z * this%wf(ip, ist, isdim, ik, itstep)
2548 s2_node(mm, ll, ist, isdim, ik) = s2_node(mm, ll, ist, isdim, ik) &
2549 + weight_x * this%gwf(ip, ist, isdim, ik, itstep, 1) &
2550 + weight_y * this%gwf(ip, ist, isdim, ik, itstep, 2) &
2551 + weight_z * this%gwf(ip, ist, isdim, ik, itstep, 3)
2561 if (mesh%parallel_in_domains .and.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0)
then
2562 call mesh%allreduce(s1_node)
2563 call mesh%allreduce(s2_node)
2567 call accel_write_buffer(s1_node_buff, 3, 2*lmax+1, lmax+1, stend-stst+1, sdim, kptend-kptst+1, &
2568 s1_node(1:3, -lmax:lmax, 0:lmax, stst:stend, 1:sdim, kptst:kptend), async=.
true.)
2569 call accel_write_buffer(s2_node_buff, 2*lmax+1, lmax+1, stend-stst+1, sdim, kptend-kptst+1, &
2570 s2_node(-lmax:lmax, 0:lmax, stst:stend, 1:sdim, kptst:kptend))
2580 do ikk = ikk_start, ikk_end
2581 do iomk = 1, this%nstepsomegak
2582 vec = sum((this%kcoords_sph(1:3, ikk, iomk) - this%veca(1:3, itstep) /
p_c)**2)
2583 phase_act(iomk, ikk) = phase_act(iomk, ikk) *
exp(
m_zi * vec * dt *
m_half)
2589 do ik = kptst, kptend
2590 do ist = stst, stend
2600 do ikk = 1, this%nstepsomegak
2601 integ11_t(ikk, imdim, ll) =
m_z0
2605 do ikk = 1, this%nstepsomegak
2606 integ21_t(ikk, ll) =
m_z0
2612 do ikk2 = ikk_start, ikk_end
2615 do ikk = 1, this%nstepsomegak
2616 integ12_t(ikk, imdim, ikk2) =
m_z0
2620 do ikk = 1, this%nstepsomegak
2621 integ22_t(ikk, ikk2) =
m_z0
2629 flags =
'-DRTYPE_COMPLEX')
2647 gsx = (( int((lmax+1)*nkk, int64) + wgsize - 1) / wgsize) * wgsize
2648 if (gsx >
accel%max_grid_dim(1) * wgsize) gsx =
accel%max_grid_dim(1) * wgsize
2650 call accel_kernel_run(pes_flux_sph_integrate_xx_kernel, (/gsx/), (/wgsize/))
2652 if (mesh%parallel_in_domains .and.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0)
then
2655 integ11_t(iomk_start:iomk_end, 1:3, 0:lmax), async=.
true.)
2657 integ21_t(iomk_start:iomk_end, 0:lmax))
2668 do ikk = iomk_start, iomk_end
2669 integ11_t(ikk, imdim, ll) = integ11_t(ikk, imdim, ll) + &
2670 s1_node(imdim, mm, ll, ist, isdim, ik) * this%ylm_k(ikk, mm, ll)
2674 do ikk = iomk_start, iomk_end
2675 integ21_t(ikk, ll) = integ21_t(ikk, ll) + &
2676 s2_node(mm, ll, ist, isdim, ik) * this%ylm_k(ikk, mm, ll)
2686 if (mesh%parallel_in_domains .and.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_surface) /= 0)
then
2688 call mesh%allreduce(integ11_t)
2689 call mesh%allreduce(integ21_t)
2695 integ11_t(1:this%nstepsomegak, 1:3, 0:lmax), async=.
true.)
2697 integ21_t(1:this%nstepsomegak, 0:lmax))
2708 safe_allocate(weight_x_host(0:lmax))
2710 weight_x_host(ll) = (-
m_zi)**ll
2716 safe_deallocate_a(weight_x_host)
2720 flags =
'-DRTYPE_COMPLEX')
2728 call accel_set_kernel_arg(pes_flux_sph_integrate_xx_2_kernel, 6, int(this%nstepsomegak, int64))
2729 call accel_set_kernel_arg(pes_flux_sph_integrate_xx_2_kernel, 7, int(ikk_end-ikk_start+1, int64))
2739 gsx = ((int((ikk_end-ikk_start+1)*this%nstepsomegak, int64) + wgsize - 1) / wgsize) * wgsize
2740 if (gsx >
accel%max_grid_dim(1) * wgsize) gsx =
accel%max_grid_dim(1) * wgsize
2742 call accel_kernel_run(pes_flux_sph_integrate_xx_2_kernel, (/gsx/), (/wgsize/))
2744 call accel_read_buffer(integ12_t_buff, this%nstepsomegak, 3, int(ikk_end-ikk_start+1), &
2745 integ12_t(:, 1:3, ikk_start:ikk_end), async=.
true.)
2746 call accel_read_buffer(integ22_t_buff, this%nstepsomegak, int(ikk_end-ikk_start+1), &
2747 integ22_t(:, ikk_start:ikk_end))
2753 weight_x = ( -
m_zi)**ll
2756 do ikk = ikk_start, ikk_end
2758 integ12_t(:, imdim, ikk) = integ12_t(:, imdim, ikk) + this%j_l(ikk, ll) * weight_x * integ11_t(:, imdim, ll)
2760 integ22_t(:, ikk) = integ22_t(:, ikk) + this%j_l(ikk, ll) * weight_x * integ21_t(:, ll)
2773 do ikk = ikk_start, ikk_end
2776 spctramp_sph(:, ist, isdim, ik, ikk) = &
2777 spctramp_sph(:, ist, isdim, ik, ikk) + &
2778 phase_act(:, ikk) * (integ12_t(:, imdim, ikk) * &
2779 (
m_two * this%veca(imdim, itstep) /
p_c - this%kcoords_sph(imdim, ikk,:)))
2781 spctramp_sph(:, ist, isdim, ik, ikk) = &
2782 spctramp_sph(:, ist, isdim, ik, ikk) + phase_act(:, ikk) * integ22_t(:, ikk) *
m_zi
2803 safe_deallocate_a(s1_node)
2804 safe_deallocate_a(s2_node)
2806 safe_deallocate_a(integ11_t)
2807 safe_deallocate_a(integ12_t)
2808 safe_deallocate_a(integ21_t)
2809 safe_deallocate_a(integ22_t)
2812 this%conjgphase_prev =
m_z0
2814 if (ikk_start > 0)
then
2815 this%conjgphase_prev(:, ikk_start:ikk_end) = phase_act(:, ikk_start:ikk_end)
2817 safe_deallocate_a(phase_act)
2819 if (mesh%parallel_in_domains .and.
bitand(this%par_strategy, option__pes_flux_parallelization__pf_time) /= 0)
then
2820 call mesh%allreduce(this%conjgphase_prev)
2821 call mesh%allreduce(spctramp_sph)
2826 do ik = kptst, kptend
2827 call lalg_axpy(this%nstepsomegak, stend-stst+1, sdim, dt, spctramp_sph(1:this%nstepsomegak, stst:stend, 1:sdim, ik, ikk), &
2828 this%spctramp_sph(1:this%nstepsomegak, stst:stend, 1:sdim, ik, ikk))
2831 safe_deallocate_a(spctramp_sph)
2838 type(
mesh_t),
intent(in) :: mesh
2841 real(real64),
intent(in) :: border(:)
2842 real(real64),
intent(in) :: offset(:)
2843 real(real64),
intent(in) :: fc_ptdens
2845 integer,
allocatable :: which_surface(:)
2846 real(real64) :: xx(mesh%box%dim), dd, area, dS(mesh%box%dim, 2), factor
2847 integer :: mdim, imdim, idir, isp, pm,nface, idim, ndir, iu,iv, iuv(1:2)
2848 integer(int64) :: ip_global
2850 integer :: rankmin, nsurfaces
2852 integer :: ip_local, NN(mesh%box%dim, 2), idx(mesh%box%dim, 2)
2853 integer :: isp_end, isp_start, ifc, n_dir, nfaces, mindim
2854 real(real64) :: RSmax(2), RSmin(2), RS(2), dRS(2), weight
2866 safe_allocate(this%face_idx_range(1:mdim * 2, 1:2))
2867 safe_allocate(this%LLr(mdim, 1:2))
2868 safe_allocate(this%NN(mdim, 1:2))
2870 this%face_idx_range(:, :) = 0
2875 if (this%surf_interp)
then
2892 do ndir = mdim, mindim, -1
2895 if (idir == ndir) cycle
2896 area = area * border(idir) * factor
2899 npface = int(fc_ptdens * area)
2903 if (idir == ndir) cycle
2904 nn(ndir, idim) = int(
sqrt(npface * (border(idir) * factor)**2 / area))
2905 ds(ndir, idim) = border(idir) * factor / nn(ndir, idim)
2906 this%LLr(ndir, idim) = nn(ndir, idim) * ds(ndir, idim)
2907 idx(ndir, idim) = idir
2910 this%nsrfcpnts = this%nsrfcpnts + 2 * product(nn(ndir, 1:mdim - 1))
2913 this%NN(1:mdim, :) = nn(1:mdim, :)
2916 assert(this%nsrfcpnts > 0)
2919 safe_allocate(this%srfcnrml(1:mdim, 0:this%nsrfcpnts))
2920 safe_allocate(this%rcoords(1:mdim, 0:this%nsrfcpnts))
2922 this%srfcnrml(:, :) =
m_zero
2923 this%rcoords(:, :) =
m_zero
2928 do ndir = mdim, mindim, -1
2931 this%face_idx_range(ifc,1) = isp
2932 do iu = 1, nn(ndir,1)
2933 do iv = 1, nn(ndir,2)
2934 this%rcoords(ndir, isp) = border(ndir)
2935 this%srfcnrml(ndir, isp) = product(ds(ndir,1:mdim-1))
2938 this%rcoords(idx(ndir, idim), isp) = (-nn(ndir, idim) *
m_half -
m_half + iuv(idim)) * ds(ndir, idim)
2943 this%face_idx_range(ifc, 2) = isp-1
2948 this%face_idx_range(ifc, 1) = isp
2949 do iu = 1, nn(ndir, 1)
2950 do iv = 1, nn(ndir, 2)
2951 this%rcoords(ndir, isp) = -border(ndir)
2952 this%srfcnrml(ndir, isp) = -product(ds(ndir, 1:mdim - 1))
2955 this%rcoords(idx(ndir, idim), isp) = (-nn(ndir, idim) *
m_half -
m_half + iuv(idim)) * ds(ndir, idim)
2960 this%face_idx_range(ifc, 2) = isp-1
2965 do isp = 1, this%nsrfcpnts
2966 this%rcoords(1:mdim, isp) = mesh%coord_system%to_cartesian(this%rcoords(1:mdim, isp))
2973 if (this%surf_shape ==
pes_plane) nfaces = 2
2977 safe_allocate(which_surface(1:mesh%np_global))
2982 do ip_local = 1, mesh%np
2987 xx(1:mdim) = mesh%x(1:mdim, ip_local) - offset(1:mdim)
2990 select case (abb%abtype)
2994 in_ab = abs(abb%mf(ip_local)) >
m_epsilon
3000 if (all(abs(xx(1:mdim)) <= border(1:mdim)) .and. .not. in_ab)
then
3004 dd = border(imdim) - xx(imdim)
3006 dd = border(imdim) - abs(xx(imdim))
3008 if (dd < mesh%spacing(imdim) /
m_two)
then
3009 nsurfaces = nsurfaces + 1
3010 which_surface(ip_global) = int(sign(
m_one, xx(imdim))) * imdim
3015 if (nsurfaces == 1)
then
3016 this%nsrfcpnts = this%nsrfcpnts + 1
3018 which_surface(ip_global) = 0
3024 if (mesh%parallel_in_domains)
then
3025 assert(mesh%np_global < huge(0_int32))
3026 call mesh%allreduce(this%nsrfcpnts)
3027 call mesh%allreduce(which_surface)
3030 safe_allocate(this%srfcpnt(1:this%nsrfcpnts))
3031 safe_allocate(this%srfcnrml(1:mdim, 0:this%nsrfcpnts))
3032 safe_allocate(this%rcoords(1:mdim, 0:this%nsrfcpnts))
3033 safe_allocate(this%rankmin(1:this%nsrfcpnts))
3038 this%face_idx_range(:,:) = 0
3042 do idir = mdim, 1, -1
3045 this%face_idx_range(nface, 1) = isp + 1
3047 do ip_global = 1, mesh%np_global
3048 if (abs(which_surface(ip_global)) == idir .and. sign(1, which_surface(ip_global)) == pm)
then
3052 this%rcoords(1:mdim, isp) = xx(1:mdim)
3055 this%rankmin(isp) = rankmin
3057 this%srfcnrml(idir, isp) = sign(1, which_surface(ip_global))
3060 if (imdim == idir) cycle
3061 this%srfcnrml(idir, isp) = this%srfcnrml(idir, isp) * mesh%spacing(imdim)
3066 this%face_idx_range(nface,2) = isp
3073 do ifc = 1, nint((nfaces + 0.5) / 2)
3074 isp_start = this%face_idx_range(ifc, 1)
3075 isp_end = this%face_idx_range(ifc, 2)
3080 if (abs(this%srfcnrml(idir, isp_start)) >=
m_epsilon) n_dir = idir
3087 if (idir == n_dir) cycle
3088 drs(idim)= mesh%spacing(idir)
3096 do isp = isp_start, isp_end
3098 xx = mesh%coord_system%from_cartesian(this%rcoords(1:mdim, isp))
3101 if (idir == n_dir) cycle
3103 if (rs(idim) < rsmin(idim)) rsmin(idim) = rs(idim)
3104 if (rs(idim) > rsmax(idim)) rsmax(idim) = rs(idim)
3110 do idir = 1, mdim - 1
3111 this%LLr(n_dir, idir) = rsmax(idir) - rsmin(idir) + drs(idir)
3112 if (drs(idir) >
m_zero) this%NN(n_dir, idir) = int(this%LLr(n_dir, idir) / drs(idir))
3120 if (this%anisotrpy_correction)
then
3123 do isp = 1, this%nsrfcpnts
3124 weight = sum(this%rcoords(1:mdim, isp) * this%srfcnrml(1:mdim, isp))
3125 weight = weight/sum(this%rcoords(1:mdim, isp)**2) / sum(this%srfcnrml(1:mdim, isp)**2)
3126 this%srfcnrml(1:mdim, isp) = this%srfcnrml(1:mdim, isp) * abs(weight)
3132 safe_deallocate_a(which_surface)
3140 type(
mesh_t),
intent(in) :: mesh
3141 integer,
intent(inout) :: nstepsthetar, nstepsphir
3144 integer :: isp, ith, iph
3145 real(real64) :: thetar, phir
3146 real(real64) :: weight, dthetar
3152 if (nstepsphir == 0) nstepsphir = 1
3154 if (nstepsthetar <= 1)
then
3158 dthetar =
m_pi / nstepsthetar
3159 this%nsrfcpnts = nstepsphir * (nstepsthetar - 1) + 2
3161 safe_allocate(this%srfcnrml(1:mdim, 0:this%nsrfcpnts))
3162 safe_allocate(this%rcoords(1:mdim, 0:this%nsrfcpnts))
3169 do ith = 0, nstepsthetar
3170 thetar = ith * dthetar
3172 if (ith == 0 .or. ith == nstepsthetar)
then
3175 weight = abs(
cos(thetar - dthetar /
m_two) -
cos(thetar + dthetar /
m_two)) &
3179 do iph = 0, nstepsphir - 1
3182 this%srfcnrml(1, isp) =
cos(phir) *
sin(thetar)
3183 if (mdim >= 2) this%srfcnrml(2, isp) =
sin(phir) *
sin(thetar)
3184 if (mdim == 3) this%srfcnrml(3, isp) =
cos(thetar)
3185 this%rcoords(1:mdim, isp) = this%radius * this%srfcnrml(1:mdim, isp)
3187 this%srfcnrml(1:mdim, isp) = this%radius**
m_two * weight * this%srfcnrml(1:mdim, isp)
3188 if (ith == 0 .or. ith == nstepsthetar)
exit
3200 integer,
intent(in) :: istart_global
3201 integer,
intent(in) :: iend_global
3202 integer,
intent(inout) :: istart
3203 integer,
intent(inout) :: iend
3204 type(mpi_comm),
intent(in) :: comm
3206#if defined(HAVE_MPI)
3207 integer,
allocatable :: dimrank(:)
3208 integer :: mpisize, mpirank, irest, irank
3214#if defined(HAVE_MPI)
3215 call mpi_comm_size(comm, mpisize)
3216 call mpi_comm_rank(comm, mpirank)
3218 safe_allocate(dimrank(0:mpisize-1))
3220 inumber = iend_global - istart_global + 1
3221 irest = mod(inumber, mpisize)
3222 do irank = 0, mpisize - 1
3224 dimrank(irank) = int(inumber / mpisize) + 1
3227 dimrank(irank) = int(inumber / mpisize)
3231 iend = istart_global + sum(dimrank(:mpirank)) - 1
3232 istart = iend - dimrank(mpirank) + 1
3234 if (istart > iend)
then
3239 safe_deallocate_a(dimrank)
3242 istart = istart_global
3250#include "pes_flux_out_inc.F90"
constant times a vector plus a vector
Prints out to iunit a message in the form: ["InputVariable" = value] where "InputVariable" is given b...
double exp(double __x) __attribute__((__nothrow__
double sin(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
double floor(double __x) __attribute__((__nothrow__
integer, parameter, public imaginary_absorbing
integer, parameter, public mask_absorbing
subroutine, public accel_kernel_start_call(this, file_name, kernel_name, flags)
subroutine, public accel_finish()
logical pure function, public accel_buffer_is_allocated(this)
integer, parameter, public accel_mem_read_write
subroutine, public accel_release_buffer(this, async)
pure logical function, public accel_is_enabled()
integer function, public accel_kernel_workgroup_size(kernel)
type(accel_t), public accel
integer, parameter, public accel_mem_read_only
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 handles the calculation mode.
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public zderivatives_batch_grad(der, ffb, opffb, ghost_update, set_bc, to_cartesian, factor)
apply the gradient to a batch of mesh functions
integer, parameter, public spin_polarized
type(lasers_t) function, pointer, public list_get_lasers(partners)
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_pi
some mathematical constants
complex(real64), parameter, public m_z0
complex(real64), parameter, public m_zi
real(real64), parameter, public m_epsilon
complex(real64), parameter, public m_z1
real(real64), parameter, public m_half
real(real64), parameter, public p_c
Electron gyromagnetic ratio, see Phys. Rev. Lett. 130, 071801 (2023)
real(real64), parameter, public m_one
real(real64), parameter, public m_three
This module defines classes and functions for interaction partners.
integer pure function, public kpoints_number(this)
integer, parameter, public e_field_vector_potential
integer pure elemental function, public laser_kind(laser)
subroutine, public laser_field(laser, field, time)
Retrieves the value of either the electric or the magnetic field. If the laser is given by a scalar p...
System information (time, memory, sysname)
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public ylmr_cmplx(xx, li, mi, ylm)
Computes spherical harmonics ylm at position (x, y, z)
subroutine, public mesh_interpolation_init(this, mesh)
This module defines the meshes, which are used in Octopus.
integer function, public mesh_nearest_point(mesh, pos, dmin, rankmin)
Returns the index of the point which is nearest to a given vector position pos.
integer(int64) function, public mesh_local2global(mesh, ip)
This function returns the global mesh index for a given local index.
real(real64) function, dimension(1:mesh%box%dim), public mesh_x_global(mesh, ipg)
Given a global point index, this function returns the coordinates of the point.
subroutine, public messages_not_implemented(feature, namespace)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
This module handles the communicators for the various parallelization strategies.
logical function, public parse_is_defined(namespace, name)
integer function, public parse_block(namespace, name, blk, check_varinfo_)
subroutine, public pes_flux_map_from_states(this, restart, st, ll, pesP, krng, Lp, istin)
subroutine pes_flux_getcube(this, mesh, abb, border, offset, fc_ptdens)
subroutine, public pes_flux_calc(this, space, mesh, st, der, ext_partners, kpoints, iter, dt, stopping)
subroutine, public pes_flux_out_energy(this, pesK, file, namespace, ll, Ekin, dim)
subroutine pes_flux_getsphere(this, mesh, nstepsthetar, nstepsphir)
subroutine, public pes_flux_output(this, box, st, namespace)
subroutine, public pes_flux_pmesh(this, namespace, dim, kpoints, ll, pmesh, idxZero, krng, nspin, Lp, Ekin)
subroutine, public pes_flux_reciprocal_mesh_gen(this, namespace, space, st, kpoints, comm, post)
subroutine, public pes_flux_load(restart, this, st, ierr)
subroutine, public pes_flux_dump(restart, this, mesh, st, ierr)
subroutine pes_flux_distribute_facepnts_cub(this, mesh)
subroutine pes_flux_integrate_sph(this, mesh, st, dt)
integer, parameter pes_cartesian
integer, parameter pes_polar
integer, parameter pes_plane
subroutine pes_flux_distribute(istart_global, iend_global, istart, iend, comm)
subroutine pes_flux_integrate_cub(this, space, mesh, st, kpoints, dt)
subroutine, public pes_flux_end(this)
pure integer function get_ikp(this, ikpu, ikpv, ikpz, n_dir)
subroutine pes_flux_integrate_cub_tabulate(this, space, mesh, st, kpoints)
subroutine, public pes_flux_init(this, namespace, space, mesh, st, ext_partners, kpoints, abb, save_iter, max_iter)
integer, parameter pes_spherical
subroutine, public pes_flux_out_vmap(this, pesK, file, namespace, ll, pmesh, dim)
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
This module handles spin dimensions of the states and the k-point distribution.
integer pure function, public states_elec_block_max(st, ib)
return index of last state in block ib
integer pure function, public states_elec_block_min(st, ib)
return index of first state in block ib
type(type_t), public type_float
type(type_t), public type_cmplx
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
character(len=20) pure function, public units_abbrev(this)
This module defines the unit system, used for input and output.
type(unit_system_t), public units_out
This module is intended to contain simple general-purpose utility functions and procedures.
character pure function, public index2axis(idir)
subroutine fill_non_periodic_dimension(this)
Class implementing a parallelepiped box. Currently this is restricted to a rectangular cuboid (all th...
Class implementing a spherical box.
class representing derivatives
Describes mesh distribution to nodes.
A container for the phase.
The states_elec_t class contains all electronic wave functions.
batches of electronic states