Commit 26882e59 authored by Matthias Redies's avatar Matthias Redies

move num_radfun_per_l to mpbasis

parent fd07ac0a
......@@ -19,7 +19,7 @@ CONTAINS
!> The matrices generated and diagonalized here are of type m_mat as defined in m_types_mat.
!>@author D. Wortmann
SUBROUTINE eigen(mpi,stars,sphhar,atoms,xcpot,sym,kpts,DIMENSION,vacuum,input,&
cell,enpara,banddos,noco,oneD,hybrid,iter,eig_id,results,inden,v,vx)
cell,enpara,banddos,noco,oneD,mpbasis,hybrid,iter,eig_id,results,inden,v,vx)
#include"cpp_double.h"
USE m_types
......@@ -48,6 +48,7 @@ CONTAINS
TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_dimension),INTENT(IN) :: DIMENSION
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_mpbasis), intent(inout) :: mpbasis
TYPE(t_hybrid),INTENT(INOUT) :: hybrid
TYPE(t_enpara),INTENT(INOUT) :: enpara
TYPE(t_input),INTENT(IN) :: input
......@@ -160,7 +161,7 @@ CONTAINS
IF (hybrid%l_addhf) CALL add_Vnonlocal(nk,lapw,atoms,hybrid,dimension,kpts,jsp,results,xcpot,noco,hmat)
IF(hybrid%l_subvxc) THEN
CALL subvxc(lapw,kpts%bk(:,nk),DIMENSION,input,jsp,v%mt(:,0,:,:),atoms,ud,hybrid,enpara%el0,enpara%ello0,&
CALL subvxc(lapw,kpts%bk(:,nk),DIMENSION,input,jsp,v%mt(:,0,:,:),atoms,ud,mpbasis,hybrid,enpara%el0,enpara%ello0,&
sym,cell,sphhar,stars,xcpot,mpi,oneD,hmat,vx)
END IF
END IF ! hybrid%l_hybrid
......
......@@ -4,13 +4,14 @@ MODULE m_hf_init
! preparations for HF and hybrid functional calculation
!
CONTAINS
SUBROUTINE hf_init(hybrid, atoms, input, DIMENSION, hybdat)
SUBROUTINE hf_init(mpbasis, hybrid, atoms, input, DIMENSION, hybdat)
USE m_types
USE m_hybrid_core
USE m_util
use m_intgrf
USE m_io_hybrid
IMPLICIT NONE
TYPE(t_mpbasis), intent(inout) :: mpbasis
TYPE(t_hybrid), INTENT(INOUT) :: hybrid
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_input), INTENT(IN) :: input
......@@ -24,10 +25,10 @@ CONTAINS
!Alloc variables
allocate(hybdat%lmaxc(atoms%ntype), source=0)
allocate(hybdat%bas1(atoms%jmtd, maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%bas2(atoms%jmtd, maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%bas1_MT(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%drbas1_MT(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%bas1(atoms%jmtd, maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%bas2(atoms%jmtd, maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%bas1_MT(maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
allocate(hybdat%drbas1_MT(maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), source=0.0)
! preparations for core states
CALL core_init(dimension, input, atoms, hybdat%lmaxcd, hybdat%maxindxc)
......
......@@ -3,7 +3,7 @@
CONTAINS
SUBROUTINE checkolap(atoms, hybdat,&
& hybrid,&
& mpbasis,hybrid,&
& nkpti, kpts,&
& dimension, mpi, &
& input, sym, noco,&
......@@ -19,6 +19,7 @@
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
......@@ -108,7 +109,7 @@
END DO
IF (mpi%irank == 0) WRITE (6, '(/A)') ' Overlap <core|basis>'
allocate(olapcb(maxval(hybrid%num_radfun_per_l)), olapcv(maxval(hybrid%nbands), nkpti),&
allocate(olapcb(maxval(mpbasis%num_radfun_per_l)), olapcv(maxval(hybrid%nbands), nkpti),&
& olapcv_avg(-hybdat%lmaxcd:hybdat%lmaxcd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype),&
& olapcv_max(-hybdat%lmaxcd:hybdat%lmaxcd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype),&
& olapcv_loc(2, -hybdat%lmaxcd:hybdat%lmaxcd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype))
......@@ -120,11 +121,11 @@
IF (l > atoms%lmax(itype)) EXIT ! very improbable case
IF (mpi%irank == 0) &
& WRITE (6, "(9X,'u(',A,')',4X,'udot(',A,')',:,3X,'ulo(',A,"//&
& "') ...')") (lchar(l), i=1, min(3, hybrid%num_radfun_per_l(l, itype)))
& "') ...')") (lchar(l), i=1, min(3, mpbasis%num_radfun_per_l(l, itype)))
DO i = 1, hybdat%nindxc(l, itype)
IF (mpi%irank == 0)&
& WRITE (6, '(1x,I1,A,2X)', advance='no') i + l, lchar(l)
DO j = 1, hybrid%num_radfun_per_l(l, itype)
DO j = 1, mpbasis%num_radfun_per_l(l, itype)
integrand = hybdat%core1(:, i, l, itype)*hybdat%bas1(:, j, l, itype)&
& + hybdat%core2(:, i, l, itype)*hybdat%bas2(:, j, l, itype)
......@@ -136,11 +137,11 @@
& WRITE (6, '(F10.6)', advance='no') olapcb(j)
END DO
lm = sum([(hybrid%num_radfun_per_l(j, itype)*(2*j + 1), j=0, l - 1)])
lm = sum([(mpbasis%num_radfun_per_l(j, itype)*(2*j + 1), j=0, l - 1)])
iatom = sum(atoms%neq(1:itype - 1)) + 1 ! take first of group of equivalent atoms
DO m = -l, l
olapcv = 0
DO j = 1, hybrid%num_radfun_per_l(l, itype)
DO j = 1, mpbasis%num_radfun_per_l(l, itype)
lm = lm + 1
olapcv(:, :) = olapcv(:, :) + &
& olapcb(j)*cmt(:maxval(hybrid%nbands), lm, iatom, :nkpti)
......@@ -195,7 +196,7 @@
IF (atoms%ntype > 1 .AND. mpi%irank == 0) &
& WRITE (6, '(A,I3)') ' Atom type', itype
DO l = 0, atoms%lmax(itype)
DO i = 1, hybrid%num_radfun_per_l(l, itype)
DO i = 1, mpbasis%num_radfun_per_l(l, itype)
IF (mpi%irank == 0) THEN
SELECT CASE (i)
CASE (1)
......@@ -278,7 +279,7 @@
DO l = 0, atoms%lmax(itype)
DO m = -l, l
lm = lm + 1
DO n = 1, hybrid%num_radfun_per_l(l, itype)
DO n = 1, mpbasis%num_radfun_per_l(l, itype)
lm1 = lm1 + 1
rdum = hybdat%bas1(atoms%jri(itype), n, l, itype)/atoms%rmt(itype)
DO iband = 1, hybrid%nbands(ikpt)
......
......@@ -19,7 +19,7 @@ MODULE m_exchange_core
CONTAINS
SUBROUTINE exchange_vccv(nk, atoms, hybrid, hybdat, DIMENSION, jsp, lapw, &
SUBROUTINE exchange_vccv(nk, atoms, mpbasis, hybrid, hybdat, DIMENSION, jsp, lapw, &
maxbands, mnobd, mpi, degenerat, symequivalent, results, &
ex_vv_r, ex_vv_c, l_real)
......@@ -35,6 +35,7 @@ CONTAINS
TYPE(t_results), INTENT(INOUT) :: results
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: DIMENSION
TYPE(t_mpbasis), INTENT(in) :: mpbasis
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_lapw), INTENT(IN) :: lapw
......@@ -125,7 +126,7 @@ CONTAINS
DO l2 = 0, atoms%lmax(itype)
IF (l < ABS(l1 - l2) .OR. l > l1 + l2) CYCLE
DO p2 = 1, hybrid%num_radfun_per_l(l2, itype)
DO p2 = 1, mpbasis%num_radfun_per_l(l2, itype)
n = n + 1
M = SIZE(fprod, 2)
IF (n > M) THEN
......@@ -175,7 +176,7 @@ CONTAINS
ll = larr(i)
IF (ABS(m2) > ll) CYCLE
lm = SUM([((2*l2 + 1)*hybrid%num_radfun_per_l(l2, itype), l2=0, ll - 1)]) + (m2 + ll)*hybrid%num_radfun_per_l(ll, itype) + parr(i)
lm = SUM([((2*l2 + 1)*mpbasis%num_radfun_per_l(l2, itype), l2=0, ll - 1)]) + (m2 + ll)*mpbasis%num_radfun_per_l(ll, itype) + parr(i)
carr(i, n1) = cmt(n1, lm, iatom)*gaunt(l1, ll, l, m1, m2, M, hybdat%maxfac, hybdat%fac, hybdat%sfac)
......@@ -234,7 +235,7 @@ CONTAINS
END SUBROUTINE exchange_vccv
SUBROUTINE exchange_vccv1(nk, atoms, hybrid, hybdat, DIMENSION, jsp, lapw, &
SUBROUTINE exchange_vccv1(nk, atoms, mpbasis, hybrid, hybdat, DIMENSION, jsp, lapw, &
nsymop, nsest, indx_sest, mpi, a_ex, results, mat_ex)
USE m_constants
......@@ -249,6 +250,7 @@ CONTAINS
TYPE(t_results), INTENT(INOUT) :: results
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: DIMENSION
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_lapw), INTENT(IN) :: lapw
......@@ -312,7 +314,7 @@ CONTAINS
DO l2 = 0, atoms%lmax(itype)
IF (l < ABS(l1 - l2) .OR. l > l1 + l2) CYCLE
DO p2 = 1, hybrid%num_radfun_per_l(l2, itype)
DO p2 = 1, mpbasis%num_radfun_per_l(l2, itype)
n = n + 1
M = SIZE(fprod, 2)
IF (n > M) THEN
......@@ -361,8 +363,8 @@ CONTAINS
ll = larr(i)
IF (ABS(m2) > ll) CYCLE
lm = SUM([((2*l2 + 1)*hybrid%num_radfun_per_l(l2, itype), l2=0, ll - 1)]) &
+ (m2 + ll)*hybrid%num_radfun_per_l(ll, itype) + parr(i)
lm = SUM([((2*l2 + 1)*mpbasis%num_radfun_per_l(l2, itype), l2=0, ll - 1)]) &
+ (m2 + ll)*mpbasis%num_radfun_per_l(ll, itype) + parr(i)
carr(i, n1) = cmt(n1, lm, iatom)*gaunt(l1, ll, l, m1, m2, M, hybdat%maxfac, hybdat%fac, hybdat%sfac)
......@@ -550,7 +552,7 @@ CONTAINS
END SUBROUTINE exchange_cccc
SUBROUTINE exchange_cccv(nk, atoms, hybdat, hybrid, DIMENSION, maxbands, ncstd, &
SUBROUTINE exchange_cccv(nk, atoms, hybdat, mpbasis, hybrid, DIMENSION, maxbands, ncstd, &
bkpt, sym, mpi, exch_cv_r, exch_cv_c, l_real)
USE m_constants
......@@ -565,6 +567,7 @@ CONTAINS
TYPE(t_hybdat), INTENT(IN) :: hybdat
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: DIMENSION
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_sym), INTENT(IN) :: sym
TYPE(t_atoms), INTENT(IN) :: atoms
......@@ -622,7 +625,7 @@ CONTAINS
! lmstart = lm start index for each l-quantum number and atom type (for cmt-coefficients)
DO itype = 1, atoms%ntype
DO l = 0, atoms%lmax(itype)
lmstart(l, itype) = SUM([(hybrid%num_radfun_per_l(ll, itype)*(2*ll + 1), ll=0, l - 1)])
lmstart(l, itype) = SUM([(mpbasis%num_radfun_per_l(ll, itype)*(2*ll + 1), ll=0, l - 1)])
END DO
END DO
......@@ -660,7 +663,7 @@ CONTAINS
DO m1 = -l1, l1
m2 = m1
IF (ABS(m2) > l2) CYCLE
lm2 = lmstart(l2, itype) + (m2 + l2)*hybrid%num_radfun_per_l(l2, itype)
lm2 = lmstart(l2, itype) + (m2 + l2)*mpbasis%num_radfun_per_l(l2, itype)
DO M = -l, l
mm = M - m1
......@@ -670,7 +673,7 @@ CONTAINS
*gaunt1(l, ll, l2, M, mm, m1, llmax)*rdum0
DO n = 1, hybdat%nindxc(l, itype)
DO n2 = 1, hybrid%num_radfun_per_l(l2, itype)
DO n2 = 1, mpbasis%num_radfun_per_l(l2, itype)
lmp2 = lm2 + n2
rprod(:atoms%jri(itype)) = (hybdat%core1(:atoms%jri(itype), n, l, itype)*hybdat%bas1(:atoms%jri(itype), n2, l2, itype) &
......
......@@ -77,7 +77,7 @@ CONTAINS
TYPE(t_xcpot_inbuild), INTENT(IN) :: xcpot
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_mpbasis), intent(inout) :: mpbasis
TYPE(t_hybrid), INTENT(INOUT) :: hybrid
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
......@@ -276,7 +276,7 @@ CONTAINS
IF ((ibando + iband - 1) > hybrid%nobd(nkqpt,jsp)) CYCLE
cdum = wl_iks(ibando + iband - 1, nkqpt)*conjg(phase_vv(iband, n1))/n_q(ikpt)
call timestart("spare matrix products")
IF (mat_ex%l_real) THEN
carr1_v_r(:n) = 0
CALL spmvec_invs(atoms, mpbasis, hybrid, hybdat, ikpt0, kpts, cell, coulomb_mt1, coulomb_mt2_r, coulomb_mt3_r, &
......@@ -286,7 +286,9 @@ CONTAINS
CALL spmvec_noinvs(atoms, mpbasis, hybrid, hybdat, ikpt0, kpts, cell, coulomb_mt1, coulomb_mt2_c, coulomb_mt3_c, &
coulomb_mtir_c, cprod_vv_c(:n, iband, n1), carr1_v_c(:n))
END IF
call timestop("spare matrix products")
call timestart("dot prod")
IF (mat_ex%l_real) THEN
DO n2 = 1, nsest(n1)!n1
nn2 = indx_sest(n2, n1)
......@@ -300,6 +302,7 @@ CONTAINS
dot_product(carr1_v_c(:n), cprod_vv_c(:n, iband, nn2))
END DO !n2
END IF
call timestop("dot prod")
END DO
END DO !n1
call timestop("exchange matrix")
......@@ -325,7 +328,7 @@ CONTAINS
END IF
IF (zero_order) THEN
CALL dwavefproducts(dcprod, nk, 1, hybrid%nbands(nk), 1, hybrid%nbands(nk), .false., atoms, hybrid, &
CALL dwavefproducts(dcprod, nk, 1, hybrid%nbands(nk), 1, hybrid%nbands(nk), .false., atoms, mpbasis, hybrid, &
cell, hybdat, kpts, kpts%nkpt, lapw, dimension, jsp, eig_irr)
! make dcprod hermitian
......@@ -337,7 +340,7 @@ CONTAINS
END DO
IF (ibs_corr) THEN
CALL ibs_correction(nk, atoms, dimension, input, jsp, hybdat, hybrid, lapw, kpts, kpts%nkpt, cell, mnobd, &
CALL ibs_correction(nk, atoms, dimension, input, jsp, hybdat, mpbasis, hybrid, lapw, kpts, kpts%nkpt, cell, mnobd, &
sym, proj_ibsc, olap_ibsc)
END IF
END IF
......
......@@ -15,7 +15,7 @@ MODULE m_gen_wavf
CONTAINS
SUBROUTINE gen_wavf(nkpti, kpts, sym, atoms, el_eig, ello_eig, cell, dimension, hybrid, vr0, &
SUBROUTINE gen_wavf(nkpti, kpts, sym, atoms, el_eig, ello_eig, cell, dimension, mpbasis, hybrid, vr0, &
hybdat, noco, oneD, mpi, input, jsp, zmat)
! nkpti :: number of irreducible k-points
......@@ -36,6 +36,7 @@ CONTAINS
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_oneD), INTENT(IN) :: oneD
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
......@@ -158,7 +159,7 @@ CONTAINS
#if CPP_DEBUG
! consistency check
IF (.not. all(iarr == hybrid%num_radfun_per_l)) call judft_error('gen_wavf: counting error')
IF (.not. all(iarr == mpbasis%num_radfun_per_l)) call judft_error('gen_wavf: counting error')
#endif
8000 FORMAT(1x, /, /, ' wavefunction parameters for atom type', i3, ':', /, t32, 'radial function', t79, &
......@@ -216,7 +217,7 @@ CONTAINS
! number l in the list of all local orbitals of the atom type
idum = 0
map_lo = 0
IF (hybrid%num_radfun_per_l(l, itype) > 2) THEN
IF (mpbasis%num_radfun_per_l(l, itype) > 2) THEN
DO j = 1, atoms%nlo(itype)
IF (atoms%llo(j, itype) == l) THEN
idum = idum + 1
......@@ -227,7 +228,7 @@ CONTAINS
DO M = -l, l
lm = ll + M
DO i = 1, hybrid%num_radfun_per_l(l, itype)
DO i = 1, mpbasis%num_radfun_per_l(l, itype)
indx = indx + 1
IF (i == 1) THEN
cmt(:, indx, iatom) = cdum*acof(:, lm, iatom)
......@@ -261,7 +262,7 @@ CONTAINS
IF ((kpts%bkp(ikpt) == ikpt0) .AND. (ikpt0 /= ikpt)) THEN
iop = kpts%bksym(ikpt)
CALL waveftrafo_genwavf(cmthlp, zhlp%data_r, zhlp%data_c, cmt(:, :, :), zmat(1)%l_real, zmat(ikpt0)%data_r(:, :), &
zmat(ikpt0)%data_c(:, :), ikpt0, iop, atoms, hybrid, kpts, sym, jsp, zmat(ikpt0)%matsize1, dimension, &
zmat(ikpt0)%data_c(:, :), ikpt0, iop, atoms, mpbasis, hybrid, kpts, sym, jsp, zmat(ikpt0)%matsize1, dimension, &
hybrid%nbands(ikpt0), cell, lapw(ikpt0), lapw(ikpt), .true.)
CALL write_cmt(cmthlp, ikpt)
......
......@@ -177,14 +177,14 @@ CONTAINS
! generate eigenvectors z and MT coefficients from the previous iteration at all k-points
CALL gen_wavf(kpts%nkpt, kpts, sym, atoms, enpara%el0(:, :, jsp), enpara%ello0(:, :, jsp), cell, dimension, &
hybrid, vr0, hybdat, noco, oneD, mpi, input, jsp, zmat)
mpbasis, hybrid, vr0, hybdat, noco, oneD, mpi, input, jsp, zmat)
! generate core wave functions (-> core1/2(jmtd,hybdat%nindxc,0:lmaxc,ntype) )
CALL corewf(atoms, jsp, input, DIMENSION, vr0, hybdat%lmaxcd, hybdat%maxindxc, mpi, &
hybdat%lmaxc, hybdat%nindxc, hybdat%core1, hybdat%core2, hybdat%eig_c)
! check olap between core-basis/core-valence/basis-basis
CALL checkolap(atoms, hybdat, hybrid, kpts%nkpt, kpts, dimension, mpi, &
CALL checkolap(atoms, hybdat, mpbasis, hybrid, kpts%nkpt, kpts, dimension, mpi, &
input, sym, noco, cell, lapw, jsp)
! set up pointer pntgpt
......@@ -230,8 +230,8 @@ CONTAINS
ll = l2
DO l1 = 0, ll
IF (ABS(l1 - l2) <= hybrid%lcutm1(itype)) THEN
DO n2 = 1, hybrid%num_radfun_per_l(l2, itype)
nn = hybrid%num_radfun_per_l(l1, itype)
DO n2 = 1, mpbasis%num_radfun_per_l(l2, itype)
nn = mpbasis%num_radfun_per_l(l1, itype)
IF (l1 == l2) nn = n2
DO n1 = 1, nn
! Calculate all basis-function hybdat%products to obtain
......@@ -269,7 +269,7 @@ CONTAINS
hybrid%nobd(nk,jsp) = COUNT(results%w_iks(:hybrid%ne_eig(nk), nk, jsp) > 0.0)
END DO
hybrid%maxlmindx = MAXVAL([(SUM([(hybrid%num_radfun_per_l(l, itype)*(2*l + 1), l=0, atoms%lmax(itype))]), itype=1, atoms%ntype)])
hybrid%maxlmindx = MAXVAL([(SUM([(mpbasis%num_radfun_per_l(l, itype)*(2*l + 1), l=0, atoms%lmax(itype))]), itype=1, atoms%ntype)])
hybrid%nbands = MIN(hybrid%bands1, DIMENSION%neigd)
ENDIF ! hybrid%l_calhf
......
......@@ -69,7 +69,7 @@ CONTAINS
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_lapw), INTENT(IN) :: lapw
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_mpbasis), intent(inout) :: mpbasis
TYPE(t_hybrid), INTENT(INOUT) :: hybrid
TYPE(t_hybdat), INTENT(INOUT) :: hybdat
TYPE(t_results), INTENT(INOUT) :: results
......@@ -151,7 +151,7 @@ CONTAINS
CALL timestart("symm_hf")
CALL symm_hf_init(sym, kpts, nk, nsymop, rrot, psym)
CALL symm_hf(kpts, nk, sym, dimension, hybdat, eig_irr, atoms, hybrid, cell, lapw, jsp, &
CALL symm_hf(kpts, nk, sym, dimension, hybdat, eig_irr, atoms, mpbasis, hybrid, cell, lapw, jsp, &
rrot, nsymop, psym, nkpt_EIBZ, n_q, parent, pointer_EIBZ, nsest, indx_sest)
CALL timestop("symm_hf")
......@@ -176,7 +176,7 @@ CONTAINS
IF (xcpot%is_name("hse") .OR. xcpot%is_name("vhse")) THEN
call judft_error('HSE not implemented in hsfock')
ELSE
CALL exchange_vccv1(nk, atoms, hybrid, hybdat, dimension, jsp, lapw, nsymop, nsest, indx_sest, mpi, a_ex, results, ex)
CALL exchange_vccv1(nk, atoms, mpbasis, hybrid, hybdat, dimension, jsp, lapw, nsymop, nsest, indx_sest, mpi, a_ex, results, ex)
CALL exchange_cccc(nk, atoms, hybdat, ncstd, sym, kpts, a_ex, mpi, results)
END IF
......
......@@ -131,7 +131,7 @@ CONTAINS
CALL coulombmatrix(mpi, atoms, kpts, cell, sym, mpbasis, hybrid, xcpot)
CALL hf_init(hybrid, atoms, input, DIMENSION, hybdat)
CALL hf_init(mpbasis, hybrid, atoms, input, DIMENSION, hybdat)
CALL timestop("Preparation for Hybrid functionals")
CALL timestart("Calculation of non-local HF potential")
DO jsp = 1, input%jspins
......
......@@ -5,7 +5,7 @@ CONTAINS
SUBROUTINE ibs_correction( &
nk, atoms, &
dimension, input, jsp, &
hybdat, hybrid, &
hybdat, mpbasis,hybrid, &
lapw, kpts, nkpti, &
cell, mnobd, &
sym, &
......@@ -24,6 +24,7 @@ CONTAINS
TYPE(t_hybdat), INTENT(IN) :: hybdat
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_mpbasis), intent(inout) :: mpbasis
TYPE(t_hybrid), INTENT(INOUT) :: hybrid
TYPE(t_input), INTENT(IN) :: input
TYPE(t_sym), INTENT(IN) :: sym
......@@ -69,10 +70,10 @@ CONTAINS
u2_lo(atoms%jmtd, atoms%nlod, atoms%ntype)
REAL :: kvec(3), qvec(3)
REAL :: sbes(0:atoms%lmaxd + 1), dsbes(0:atoms%lmaxd + 1)
REAL :: bas1_tmp(atoms%jmtd, maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype), &
bas2_tmp(atoms%jmtd, maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype)
REAL :: bas1_MT_tmp(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype), &
drbas1_MT_tmp(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype)
REAL :: bas1_tmp(atoms%jmtd, maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype), &
bas2_tmp(atoms%jmtd, maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype)
REAL :: bas1_MT_tmp(maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype), &
drbas1_MT_tmp(maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd + 1, atoms%ntype)
REAL :: ru1(atoms%jmtd, 3, mnobd), ru2(atoms%jmtd, 3, mnobd)
REAL :: iu1(atoms%jmtd, 3, mnobd), iu2(atoms%jmtd, 3, mnobd)
REAL :: rintegrand(atoms%jmtd), iintegrand(atoms%jmtd), &
......@@ -111,12 +112,12 @@ CONTAINS
! with this the local orbitals have a trivial k-dependence
! compute radial lo matching coefficients
hybrid%num_radfun_per_l = 2
mpbasis%num_radfun_per_l = 2
DO itype = 1, atoms%ntype
DO ilo = 1, atoms%nlo(itype)
l = atoms%llo(ilo, itype)
hybrid%num_radfun_per_l(l, itype) = hybrid%num_radfun_per_l(l, itype) + 1
p = hybrid%num_radfun_per_l(l, itype)
mpbasis%num_radfun_per_l(l, itype) = mpbasis%num_radfun_per_l(l, itype) + 1
p = mpbasis%num_radfun_per_l(l, itype)
ws = -wronskian(hybdat%bas1_MT(1, l, itype), hybdat%drbas1_MT(1, l, itype), hybdat%bas1_MT(2, l, itype), hybdat%drbas1_MT(2, l, itype))
......@@ -411,12 +412,12 @@ CONTAINS
iatom = 0
DO itype = 1, atoms%ntype
DO ieq = 1, atoms%neq(itype)
hybrid%num_radfun_per_l = 2
mpbasis%num_radfun_per_l = 2
iatom = iatom + 1
DO ilo = 1, atoms%nlo(itype)
l1 = atoms%llo(ilo, itype)
hybrid%num_radfun_per_l(l1, itype) = hybrid%num_radfun_per_l(l1, itype) + 1
p1 = hybrid%num_radfun_per_l(l1, itype)
mpbasis%num_radfun_per_l(l1, itype) = mpbasis%num_radfun_per_l(l1, itype) + 1
p1 = mpbasis%num_radfun_per_l(l1, itype)
l2 = l1 + 1
lm2 = l2**2
......@@ -706,7 +707,7 @@ CONTAINS
!
SUBROUTINE dwavefproducts( &
dcprod, nk, bandi1, bandf1, bandi2, bandf2, lwrite, &
atoms, hybrid, &
atoms, mpbasis, hybrid, &
cell, &
hybdat, kpts, nkpti, lapw, &
dimension, jsp, &
......@@ -719,6 +720,7 @@ CONTAINS
TYPE(t_hybdat), INTENT(IN) :: hybdat
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_kpts), INTENT(IN) :: kpts
......@@ -745,7 +747,7 @@ CONTAINS
!
CALL momentum_matrix( &
dcprod, nk, bandi1, bandf1, bandi2, bandf2, &
atoms, hybrid, &
atoms, mpbasis, hybrid, &
cell, &
hybdat, kpts, lapw, &
dimension, jsp)
......@@ -780,7 +782,7 @@ CONTAINS
!
SUBROUTINE momentum_matrix( &
momentum, nk, bandi1, bandf1, bandi2, bandf2, &
atoms, hybrid, &
atoms, mpbasis, hybrid, &
cell, &
hybdat, kpts, lapw, &
dimension, jsp)
......@@ -796,6 +798,7 @@ CONTAINS
IMPLICIT NONE
TYPE(t_hybdat), INTENT(IN) :: hybdat
TYPE(t_mpbasis), intent(in) :: mpbasis
TYPE(t_dimension), INTENT(IN) :: dimension
TYPE(t_hybrid), INTENT(IN) :: hybrid
TYPE(t_cell), INTENT(IN) :: cell
......@@ -823,8 +826,8 @@ CONTAINS
INTEGER :: gpt(3, lapw%nv(jsp))
REAL :: fcoeff((atoms%lmaxd + 1)**2, -1:1), gcoeff((atoms%lmaxd + 1)**2, -1:1)
REAL :: qmat1(maxval(hybrid%num_radfun_per_l), maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), dbas1(atoms%jmtd)
REAL :: qmat2(maxval(hybrid%num_radfun_per_l), maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), dbas2(atoms%jmtd)
REAL :: qmat1(maxval(mpbasis%num_radfun_per_l), maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), dbas1(atoms%jmtd)
REAL :: qmat2(maxval(mpbasis%num_radfun_per_l), maxval(mpbasis%num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), dbas2(atoms%jmtd)
REAL :: qg(lapw%nv(jsp), 3)
COMPLEX :: hlp(3, 3)
......@@ -868,7 +871,7 @@ CONTAINS
ic = 0
DO itype = 1, atoms%ntype
DO l = 0, atoms%lmax(itype)
DO n2 = 1, hybrid%num_radfun_per_l(l, itype)
DO n2 = 1, mpbasis%num_radfun_per_l(l, itype)
!ic = ic + 1
CALL derivative(dbas1, hybdat%bas1(:, n2, l, itype), atoms, itype)
dbas1 = dbas1 - hybdat%bas1(:, n2, l, itype)/atoms%rmsh(:, itype)
......@@ -877,7 +880,7 @@ CONTAINS
dbas2 = dbas2 - hybdat%bas2(:, n2, l, itype)/atoms%rmsh(:, itype)
IF (l /= 0) THEN
DO n1 = 1, hybrid%num_radfun_per_l(l - 1, itype)
DO n1 = 1, mpbasis%num_radfun_per_l(l - 1, itype)
ic = ic + 1
qmat1(n1, n2, l, itype) = intgrf(dbas1(:)*hybdat%bas1(:, n1, l - 1, itype) + &
dbas2(:)*hybdat%bas2(:, n1, l - 1, itype), atoms, itype, hybdat%gridf) &
......@@ -887,7 +890,7 @@ CONTAINS
END DO
END IF
IF (l /= atoms%lmax(itype)) THEN
DO n1 = 1, hybrid%num_radfun_per_l(l + 1, itype)
DO n1 = 1, mpbasis%num_radfun_per_l(l + 1, itype)
qmat2(n1, n2, l, itype) = intgrf(dbas1(:)*hybdat%bas1(:, n1, l + 1, itype) + dbas2(:)*hybdat%bas2(:, n1, l + 1, itype), &
atoms, itype, hybdat%gridf) &
......@@ -913,7 +916,7 @@ CONTAINS
DO itype = 1, atoms%ntype
DO ieq = 1, atoms%neq(itype)
ic = ic + 1
nn = sum([((2*l + 1)*hybrid%num_radfun_per_l(l, itype), l=0, atoms%lmax(itype))])
nn = sum([((2*l + 1)*mpbasis%num_radfun_per_l(l, itype), l=0, atoms%lmax(itype))])
DO iband1 = bandi1, bandf1
cmt1(:nn, iband1) = cmt(iband1, :nn, ic)
ENDDO
......@@ -925,11 +928,11 @@ CONTAINS
cvec1 = 0; cvec2 = 0; cvec3 = 0
! build up left vector(s) ( -> cvec1/2/3 )
lm_0 = 0 ! we start with s-functions (l=0)