Commit b777d061 authored by Matthias Redies's avatar Matthias Redies

introduce fi to wavef_noinv

parent 5a170a11
......@@ -198,9 +198,8 @@ CONTAINS
IF (mat_ex%l_real) THEN
CALL wavefproducts_inv(fi, jsp, lapw, mpi, ik, iq, hybdat, mpdata, nococonv, nkqpt, cprod_vv_r)
ELSE
CALL wavefproducts_noinv(ik, iq, fi%input, jsp, &
fi%cell, fi%atoms, mpdata, fi%hybinp, hybdat, fi%kpts, lapw, &
fi%sym, fi%noco, nococonv, fi%oneD, nkqpt, cprod_vv_c)
CALL wavefproducts_noinv(ik, iq, fi, jsp, mpdata, hybdat, lapw, &
nococonv, nkqpt, cprod_vv_c)
END IF
! The sparse matrix technique is not feasible for the HSE
......
......@@ -2,26 +2,16 @@ module m_wavefproducts_noinv
USE m_types_hybdat
CONTAINS
SUBROUTINE wavefproducts_noinv(ik, iq, &
input, jsp, cell, atoms, mpdata, hybinp,&
hybdat, kpts, lapw, sym, noco,nococonv, oneD,&
nkqpt, cprod)
SUBROUTINE wavefproducts_noinv(ik, iq, fi, jsp,mpdata,hybdat, lapw, nococonv, nkqpt, cprod)
USE m_types
use m_juDFT
use m_constants, only: cmplx_0
IMPLICIT NONE
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
type(t_fleurinput), intent(in) :: fi
type(t_nococonv), intent(in) :: nococonv
type(t_oneD), intent(in) :: oneD
TYPE(t_sym), INTENT(IN) :: sym
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_lapw), INTENT(IN) :: lapw
TYPE(t_mpdata), intent(in) :: mpdata
TYPE(t_hybinp), INTENT(IN) :: hybinp
TYPE(t_hybdat), INTENT(INOUT) :: hybdat
! - scalars -
......@@ -42,33 +32,27 @@ CONTAINS
cprod = cmplx_0; nkqpt = 0
! calculate nkpqt
kqpthlp = kpts%bkf(:,ik) + kpts%bkf(:,iq)
kqpt = kpts%to_first_bz(kqpthlp)
kqpthlp = fi%kpts%bkf(:,ik) + fi%kpts%bkf(:,iq)
kqpt = fi%kpts%to_first_bz(kqpthlp)
g_t = nint(kqpt - kqpthlp)
! determine number of kqpt
nkqpt = kpts%get_nk(kqpt)
nkqpt = fi%kpts%get_nk(kqpt)
allocate(c_phase_kqpt(hybdat%nbands(nkqpt)))
IF (.not. kpts%is_kpt(kqpt)) then
IF (.not. fi%kpts%is_kpt(kqpt)) then
call juDFT_error('wavefproducts: k-point not found')
endif
call wavefproducts_noinv_IS(ik, iq, g_t,&
input, jsp, cell, atoms, mpdata, hybinp,&
hybdat, kpts, lapw, sym, noco, nococonv,&
nkqpt, z_k_p, c_phase_k, z_kqpt_p, c_phase_kqpt, cprod)
call wavefproducts_noinv_IS(fi, ik, iq, g_t, jsp, mpdata, hybdat, lapw, nococonv,&
nkqpt, z_k_p, c_phase_k, z_kqpt_p, c_phase_kqpt, cprod)
call wavefproducts_noinv_MT(ik, iq, &
input,atoms, cell, noco,nococonv, oneD, sym,&
mpdata, hybinp, hybdat, kpts, &
call wavefproducts_noinv_MT(fi, ik, iq, nococonv, mpdata, hybdat, &
jsp, nkqpt, z_k_p, c_phase_k, z_kqpt_p, c_phase_kqpt, cprod)
call timestop("wavefproducts_noinv5")
END SUBROUTINE wavefproducts_noinv
subroutine wavefproducts_noinv_IS(ik, iq, g_t, &
input, jsp, cell, atoms, mpdata, hybinp,&
hybdat, kpts, lapw, sym, noco,nococonv,&
subroutine wavefproducts_noinv_IS(fi, ik, iq, g_t, jsp, mpdata, hybdat, lapw, nococonv,&
nkqpt, z_k_p, c_phase_k, z_kqpt_p, c_phase_kqpt, cprod)
use m_types
use m_constants
......@@ -76,16 +60,10 @@ CONTAINS
use m_judft
use m_io_hybinp
implicit NONE
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
type(t_fleurinput), intent(in) :: fi
TYPE(t_nococonv), INTENT(IN) :: nococonv
TYPE(t_sym), INTENT(IN) :: sym
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_lapw), INTENT(IN) :: lapw
TYPE(t_mpdata), intent(in) :: mpdata
TYPE(t_hybinp), INTENT(IN) :: hybinp
TYPE(t_mpdata), intent(in) :: mpdata
TYPE(t_hybdat), INTENT(INOUT) :: hybdat
type(t_mat), intent(inout) :: z_k_p, z_kqpt_p
......@@ -125,26 +103,26 @@ CONTAINS
!
! compute G's fulfilling |bk(:,nkqpt) + G| <= rkmax
!
CALL lapw_nkqpt%init(input, noco, nococonv,kpts, atoms, sym, nkqpt, cell, sym%zrfs)
nbasfcn = calc_number_of_basis_functions(lapw, atoms, noco)
call z_nk%alloc(.false., nbasfcn, input%neig)
CALL lapw_nkqpt%init(fi%input, fi%noco, nococonv,fi%kpts, fi%atoms, fi%sym, nkqpt, fi%cell, fi%sym%zrfs)
nbasfcn = calc_number_of_basis_functions(lapw, fi%atoms, fi%noco)
call z_nk%alloc(.false., nbasfcn, fi%input%neig)
call z_k_p%init(z_nk)
nbasfcn = calc_number_of_basis_functions(lapw_nkqpt, atoms, noco)
call z_kqpt%alloc(.false., nbasfcn, input%neig)
nbasfcn = calc_number_of_basis_functions(lapw_nkqpt, fi%atoms, fi%noco)
call z_kqpt%alloc(.false., nbasfcn, fi%input%neig)
call z_kqpt_p%init(z_kqpt)
! read in z at k-point ik and nkqpt
call read_z(atoms, cell, hybdat, kpts, sym, noco, nococonv, input, ik, jsp, z_nk, &
call read_z(fi%atoms, fi%cell, hybdat, fi%kpts, fi%sym, fi%noco, nococonv, fi%input, ik, jsp, z_nk, &
c_phase=c_phase_k, parent_z=z_k_p)
call read_z(atoms, cell, hybdat, kpts, sym, noco, nococonv, input, nkqpt, jsp, z_kqpt, &
call read_z(fi%atoms, fi%cell, hybdat, fi%kpts, fi%sym, fi%noco, nococonv, fi%input, nkqpt, jsp, z_kqpt, &
c_phase=c_phase_kqpt, parent_z=z_kqpt_p)
g = maxval(abs(lapw%gvec(:,:lapw%nv(jsp), jsp)), dim=2) &
+ maxval(abs(lapw_nkqpt%gvec(:,:lapw_nkqpt%nv(jsp), jsp)), dim=2)&
+ maxval(abs(mpdata%g(:,mpdata%gptm_ptr(:mpdata%n_g(iq), iq))), dim=2) + 1
call hybdat%set_stepfunction(cell, atoms, g, sqrt(cell%omtil))
call hybdat%set_stepfunction(fi%cell, fi%atoms, g, sqrt(fi%cell%omtil))
!
! convolute phi(n,k) with the step function and store in cpw0
......@@ -209,10 +187,8 @@ CONTAINS
end subroutine wavefproducts_noinv_IS
subroutine wavefproducts_noinv_MT(ik, iq, &
input,atoms, cell, noco,nococonv, oneD, sym,&
mpdata, hybinp, hybdat, kpts, &
jsp, ikqpt, z_k_p, c_phase_k, z_kqpt_p, c_phase_kqpt, cprod)
subroutine wavefproducts_noinv_MT(fi,ik, iq,nococonv, mpdata, hybdat, jsp, ikqpt,&
z_k_p, c_phase_k, z_kqpt_p, c_phase_kqpt, cprod)
use m_types
USE m_constants
use m_io_hybinp
......@@ -220,16 +196,9 @@ CONTAINS
use m_wavefproducts_aux
use m_calc_cmt
IMPLICIT NONE
TYPE(t_input),INTENT(IN) :: input
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_atoms), INTENT(IN) :: atoms
type(t_cell), intent(in) :: cell
type(t_noco), intent(in) :: noco
type(t_fleurinput), intent(in) :: fi
type(t_nococonv), intent(in) :: nococonv
type(t_oneD), intent(in) :: oneD
type(t_sym), intent(in) :: sym
TYPE(t_mpdata), INTENT(IN) :: mpdata
TYPE(t_hybinp), INTENT(IN) :: hybinp
TYPE(t_hybdat), INTENT(INOUT) :: hybdat
type(t_mat), intent(in) :: z_k_p, z_kqpt_p
......@@ -252,27 +221,27 @@ CONTAINS
LOGICAL :: offdiag
! - local arrays -
INTEGER :: lmstart(0:atoms%lmaxd, atoms%ntype)
INTEGER :: lmstart(0:fi%atoms%lmaxd, fi%atoms%ntype)
COMPLEX :: carr(1:MAXVAL(hybdat%nobd(:, jsp)), hybdat%nbands(ik))
COMPLEX :: cmt_ikqpt(hybdat%nbands(ikqpt), hybdat%maxlmindx, atoms%nat)
COMPLEX :: cmt_nk(hybdat%nbands(ik), hybdat%maxlmindx, atoms%nat)
COMPLEX :: cmt_ikqpt(hybdat%nbands(ikqpt), hybdat%maxlmindx, fi%atoms%nat)
COMPLEX :: cmt_nk(hybdat%nbands(ik), hybdat%maxlmindx, fi%atoms%nat)
call timestart("wavefproducts_noinv5 MT")
! lmstart = lm start index for each l-quantum number and atom type (for cmt-coefficients)
call timestart("set lmstart")
DO itype = 1, atoms%ntype
DO l = 0, atoms%lmax(itype)
DO itype = 1, fi%atoms%ntype
DO l = 0, fi%atoms%lmax(itype)
lmstart(l, itype) = sum([(mpdata%num_radfun_per_l(ll, itype)*(2*ll+1), ll=0, l-1)])
END DO
END DO
call timestop("set lmstart")
! read in cmt coefficients from direct access file cmt
call calc_cmt(atoms, cell, input, noco,nococonv, hybinp, hybdat, mpdata, kpts, &
sym, oneD, z_k_p, jsp, ik, c_phase_k, cmt_nk)
call calc_cmt(atoms, cell, input, noco,nococonv, hybinp, hybdat, mpdata, kpts, &
sym, oneD, z_kqpt_p, jsp, ikqpt, c_phase_kqpt, cmt_ikqpt)
call calc_cmt(fi%atoms, fi%cell, fi%input, fi%noco,nococonv, fi%hybinp, hybdat, mpdata, fi%kpts, &
fi%sym, fi%oneD, z_k_p, jsp, ik, c_phase_k, cmt_nk)
call calc_cmt(fi%atoms, fi%cell, fi%input, fi%noco,nococonv, fi%hybinp, hybdat, mpdata, fi%kpts, &
fi%sym, fi%oneD, z_kqpt_p, jsp, ikqpt, c_phase_kqpt, cmt_ikqpt)
call timestart("loop over l, l1, l2, n, n1, n2")
!$OMP PARALLEL PRIVATE(m, carr, lm1, m1, m2, lm2, i,j,k, &
......@@ -280,14 +249,14 @@ CONTAINS
!$OMP ic, lm_0)
lm_0 = 0
ic = 0
DO itype = 1, atoms%ntype
DO ieq = 1, atoms%neq(itype)
DO itype = 1, fi%atoms%ntype
DO ieq = 1, fi%atoms%neq(itype)
ic = ic + 1
ic1 = 0
atom_phase = exp(-ImagUnit*tpi_const*dot_product(kpts%bkf(:,iq), atoms%taual(:,ic)))
atom_phase = exp(-ImagUnit*tpi_const*dot_product(fi%kpts%bkf(:,iq), fi%atoms%taual(:,ic)))
DO l = 0, hybinp%lcutm1(itype)
DO l = 0, fi%hybinp%lcutm1(itype)
DO n = 1, hybdat%nindxp1(l, itype) ! loop over basis-function products
call mpdata%set_nl(n,l,itype, n1,l1,n2,l2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment