Commit ce2a6ee6 authored by Matthias Redies's avatar Matthias Redies

delete maxlcutm1

parent 053a6dc0
......@@ -41,7 +41,7 @@ CONTAINS
! pre-calculate gaunt coefficients
hybdat%maxfac = max(2*atoms%lmaxd + hybrid%maxlcutm1 + 1, 2*hybdat%lmaxcd + 2*atoms%lmaxd + 1)
hybdat%maxfac = max(2*atoms%lmaxd + maxval(hybrid%lcutm1) + 1, 2*hybdat%lmaxcd + 2*atoms%lmaxd + 1)
allocate(hybdat%fac(0:hybdat%maxfac), hybdat%sfac(0:hybdat%maxfac), stat=ok, source=0.0)
IF (ok /= 0) call judft_error('eigen_hf: failure allocation fac,hybdat%sfac')
hybdat%fac(0) = 1
......@@ -51,14 +51,14 @@ CONTAINS
hybdat%sfac(i) = hybdat%sfac(i - 1)*sqrt(i*1.0) ! hybdat%sfac(i) = sqrt(i!)
END DO
ALLOCATE(hybdat%gauntarr(2, 0:atoms%lmaxd, 0:atoms%lmaxd, 0:hybrid%maxlcutm1,&
-atoms%lmaxd:atoms%lmaxd, -hybrid%maxlcutm1:hybrid%maxlcutm1),&
ALLOCATE(hybdat%gauntarr(2, 0:atoms%lmaxd, 0:atoms%lmaxd, 0:maxval(hybrid%lcutm1),&
-atoms%lmaxd:atoms%lmaxd, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1)),&
stat=ok, source=0.0)
IF (ok /= 0) call judft_error('eigen: failure allocation hybdat%gauntarr')
DO l2 = 0, atoms%lmaxd
DO l1 = 0, atoms%lmaxd
DO l = abs(l1 - l2), min(l1 + l2, hybrid%maxlcutm1)
DO l = abs(l1 - l2), min(l1 + l2, maxval(hybrid%lcutm1))
DO m = -l, l
DO m1 = -l1, l1
m2 = m1 + m ! Gaunt condition -m1+m2-m = 0
......
......@@ -98,24 +98,24 @@ CONTAINS
REAL :: q(3), q1(3), q2(3)
REAL :: integrand(atoms%jmtd), primf1(atoms%jmtd), primf2(atoms%jmtd)
REAL :: mat(maxval(hybrid%nindxm1)*(maxval(hybrid%nindxm1) + 1)/2)
REAL :: moment(maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%ntype), &
REAL :: moment(maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%ntype), &
moment2(maxval(hybrid%nindxm1), atoms%ntype)
REAL :: sphbes_var(atoms%jmtd, 0:hybrid%maxlcutm1)
REAL :: sphbesmoment1(atoms%jmtd, 0:hybrid%maxlcutm1)
REAL :: rarr(0:hybrid%lexp + 1), rarr1(0:hybrid%maxlcutm1)
REAL :: sphbes_var(atoms%jmtd, 0:maxval(hybrid%lcutm1))
REAL :: sphbesmoment1(atoms%jmtd, 0:maxval(hybrid%lcutm1))
REAL :: rarr(0:hybrid%lexp + 1), rarr1(0:maxval(hybrid%lcutm1))
REAL, ALLOCATABLE :: gmat(:, :), qnrm(:)
REAL, ALLOCATABLE :: sphbesmoment(:, :, :)
REAL, ALLOCATABLE :: sphbes0(:, :, :)
REAL, ALLOCATABLE :: olap(:, :, :, :), integral(:, :, :, :)
REAL, ALLOCATABLE :: gridf(:, :)
REAL :: facA(0:MAX(2*atoms%lmaxd + hybrid%maxlcutm1 + 1, 4*MAX(hybrid%maxlcutm1, hybrid%lexp) + 1))
REAL :: facB(0:MAX(2*atoms%lmaxd + hybrid%maxlcutm1 + 1, 4*MAX(hybrid%maxlcutm1, hybrid%lexp) + 1))
REAL :: facC(-1:MAX(2*atoms%lmaxd + hybrid%maxlcutm1 + 1, 4*MAX(hybrid%maxlcutm1, hybrid%lexp) + 1))
REAL :: facA(0:MAX(2*atoms%lmaxd + maxval(hybrid%lcutm1) + 1, 4*MAX(maxval(hybrid%lcutm1), hybrid%lexp) + 1))
REAL :: facB(0:MAX(2*atoms%lmaxd + maxval(hybrid%lcutm1) + 1, 4*MAX(maxval(hybrid%lcutm1), hybrid%lexp) + 1))
REAL :: facC(-1:MAX(2*atoms%lmaxd + maxval(hybrid%lcutm1) + 1, 4*MAX(maxval(hybrid%lcutm1), hybrid%lexp) + 1))
COMPLEX :: cexp1(atoms%ntype), csumf(9)
COMPLEX :: structconst((2*hybrid%lexp + 1)**2, atoms%nat, atoms%nat, kpts%nkpt) ! nw = 1
COMPLEX :: y((hybrid%lexp + 1)**2), y1((hybrid%lexp + 1)**2), y2((hybrid%lexp + 1)**2)
COMPLEX :: dwgn(-hybrid%maxlcutm1:hybrid%maxlcutm1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1, sym%nsym)
COMPLEX :: dwgn(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1), sym%nsym)
COMPLEX, ALLOCATABLE :: smat(:, :)
COMPLEX, ALLOCATABLE :: coulmat(:, :)
COMPLEX, ALLOCATABLE :: carr2(:, :), carr2a(:, :), carr2b(:, :)
......@@ -139,7 +139,7 @@ CONTAINS
svol = SQRT(cell%vol)
fcoulfac = 4*pi_const/cell%vol
maxfac = MAX(2*atoms%lmaxd + hybrid%maxlcutm1 + 1, 4*MAX(hybrid%maxlcutm1, hybrid%lexp) + 1)
maxfac = MAX(2*atoms%lmaxd + maxval(hybrid%lcutm1) + 1, 4*MAX(maxval(hybrid%lcutm1), hybrid%lexp) + 1)
facA(0) = 1 !
facB(0) = 1 ! Define:
......@@ -183,15 +183,15 @@ CONTAINS
IF (isym <= sym%nop) THEN
inviop = sym%invtab(isym)
rrot(:, :, isym) = TRANSPOSE(sym%mrot(:, :, inviop))
DO l = 0, hybrid%maxlcutm1
dwgn(:, :, l, isym) = TRANSPOSE(hybrid%d_wgn2(-hybrid%maxlcutm1:hybrid%maxlcutm1, &
-hybrid%maxlcutm1:hybrid%maxlcutm1, l, isym))
DO l = 0, maxval(hybrid%lcutm1)
dwgn(:, :, l, isym) = TRANSPOSE(hybrid%d_wgn2(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), &
-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), l, isym))
END DO
ELSE
inviop = isym - sym%nop
rrot(:, :, isym) = -rrot(:, :, inviop)
dwgn(:, :, :, isym) = dwgn(:, :, :, inviop)
DO l = 0, hybrid%maxlcutm1
DO l = 0, maxval(hybrid%lcutm1)
DO m1 = -l, l
DO m2 = -l, -1
cdum = dwgn(m1, m2, l, isym)
......@@ -318,8 +318,8 @@ CONTAINS
! Look for different qnorm = |k+G|, definition of qnrm and pqnrm.
CALL getnorm(kpts, mpbasis%gptm, mpbasis%ngptm, mpbasis%gptm_ptr, qnrm, nqnrm, pqnrm, cell)
allocate(sphbesmoment(0:hybrid%lexp, atoms%ntype, nqnrm), &
olap(maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%ntype, nqnrm), &
integral(maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%ntype, nqnrm))
olap(maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%ntype, nqnrm), &
integral(maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%ntype, nqnrm))
sphbes_var = 0
sphbesmoment = 0
sphbesmoment1 = 0
......@@ -518,7 +518,7 @@ CONTAINS
IF (sym%invs) THEN
!symmetrize makes the Coulomb matrix real symmetric
CALL symmetrize(coulmat, hybrid%nbasp, hybrid%nbasp, 3, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
ENDIF
......@@ -673,7 +673,7 @@ CONTAINS
IF (sym%invs) THEN
CALL symmetrize(coulmat, hybrid%nbasp, mpbasis%ngptm(ikpt), 1, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1, sym)
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1, sym)
ENDIF
M = hybrid%nbasp*(hybrid%nbasp + 1)/2
......@@ -1098,7 +1098,7 @@ CONTAINS
carr2(:, 1), igpt1, &
carr2(:, 2), igpt2, ikpt, isym, .FALSE., POINTER(ikpt, :, :, :), &
sym, rrot(:, :, isym), invrrot(:, :, isym), mpbasis, hybrid, &
kpts, hybrid%maxlcutm1, atoms, hybrid%lcutm1, &
kpts, maxval(hybrid%lcutm1), atoms, hybrid%lcutm1, &
hybrid%nindxm1, maxval(hybrid%nindxm1), dwgn(:, :, :, isym), &
hybrid%nbasp, nbasm1)
IF (iarr(igpt1) == 0) THEN
......@@ -1106,7 +1106,7 @@ CONTAINS
carr2(:, 1), igpt1, &
carr2(:, 2), igpt2, ikpt, isym, .TRUE., POINTER(ikpt, :, :, :), &
sym, rrot(:, :, isym), invrrot(:, :, isym), mpbasis, hybrid, &
kpts, hybrid%maxlcutm1, atoms, hybrid%lcutm1, &
kpts, maxval(hybrid%lcutm1), atoms, hybrid%lcutm1, &
hybrid%nindxm1, maxval(hybrid%nindxm1), &
dwgn(:, :, :, isym), hybrid%nbasp, nbasm1)
l = (hybrid%nbasp + igpt1 - 1)*(hybrid%nbasp + igpt1)/2
......@@ -1223,17 +1223,17 @@ CONTAINS
! rearrange coulomb matrix
!
allocate(coulomb_mt1(maxval(hybrid%nindxm1) - 1, maxval(hybrid%nindxm1) - 1, 0:hybrid%maxlcutm1, atoms%ntype, 1))
ic = (hybrid%maxlcutm1 + 1)**2*atoms%nat
allocate(coulomb_mt1(maxval(hybrid%nindxm1) - 1, maxval(hybrid%nindxm1) - 1, 0:maxval(hybrid%lcutm1), atoms%ntype, 1))
ic = (maxval(hybrid%lcutm1) + 1)**2*atoms%nat
idum = ic + maxval(mpbasis%ngptm)
idum = (idum*(idum + 1))/2
if (sym%invs) THEN
allocate(coulomb_mt2_r(maxval(hybrid%nindxm1) - 1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1 + 1, atoms%nat, 1))
allocate(coulomb_mt2_r(maxval(hybrid%nindxm1) - 1, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1) + 1, atoms%nat, 1))
allocate(coulomb_mt3_r(maxval(hybrid%nindxm1) - 1, atoms%nat, atoms%nat, 1))
allocate(coulomb_mtir_r(ic + maxval(mpbasis%ngptm), ic + maxval(mpbasis%ngptm), 1))
allocate(coulombp_mtir_r(idum, 1))
else
allocate(coulomb_mt2_c(maxval(hybrid%nindxm1) - 1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1 + 1, atoms%nat, 1))
allocate(coulomb_mt2_c(maxval(hybrid%nindxm1) - 1, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1) + 1, atoms%nat, 1))
allocate(coulomb_mt3_c(maxval(hybrid%nindxm1) - 1, atoms%nat, atoms%nat, 1))
allocate(coulomb_mtir_c(ic + maxval(mpbasis%ngptm), ic + maxval(mpbasis%ngptm), 1))
allocate(coulombp_mtir_c(idum, 1))
......@@ -1321,7 +1321,7 @@ CONTAINS
IF (ikpt == 1) THEN
!
! store the contribution of the G=0 plane wave with the MT l=0 functions in
! coulomb_mt2(:hybrid%nindxm1(l=0,itype),0,hybrid%maxlcutm1+1,iatom)
! coulomb_mt2(:hybrid%nindxm1(l=0,itype),0,maxval(hybrid%lcutm1)+1,iatom)
!
ic = 0
iatom = 0
......@@ -1330,9 +1330,9 @@ CONTAINS
iatom = iatom + 1
DO n = 1, hybrid%nindxm1(0, itype) - 1
if (coulhlp%l_real) THEN
coulomb_mt2_r(n, 0, hybrid%maxlcutm1 + 1, iatom, ikpt0) = coulhlp%data_r(ic + n, hybrid%nbasp + 1)
coulomb_mt2_r(n, 0, maxval(hybrid%lcutm1) + 1, iatom, ikpt0) = coulhlp%data_r(ic + n, hybrid%nbasp + 1)
else
coulomb_mt2_c(n, 0, hybrid%maxlcutm1 + 1, iatom, ikpt0) = coulhlp%data_c(ic + n, hybrid%nbasp + 1)
coulomb_mt2_c(n, 0, maxval(hybrid%lcutm1) + 1, iatom, ikpt0) = coulhlp%data_c(ic + n, hybrid%nbasp + 1)
endif
END DO
ic = ic + SUM([((2*l + 1)*hybrid%nindxm1(l, itype), l=0, hybrid%lcutm1(itype))])
......@@ -1599,19 +1599,19 @@ CONTAINS
END IF
IF (sym%invs) THEN
CALL symmetrize(coeff, 1, nbasm1(1), 2, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
CALL symmetrize(claplace, 1, nbasm1(1), 2, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
CALL symmetrize(cderiv(:, -1), 1, nbasm1(1), 2, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
CALL symmetrize(cderiv(:, 0), 1, nbasm1(1), 2, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
CALL symmetrize(cderiv(:, 1), 1, nbasm1(1), 2, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
ENDIF
! Subtract head contributions from coulomb(:nn,1) to obtain the body
......@@ -1630,10 +1630,10 @@ CONTAINS
IF (sym%invs) THEN
CALL desymmetrize(coeff, 1, nbasm1(1), 2, &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
CALL symmetrize(coeff, nbasm1(1), 1, 1, .FALSE., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, &
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), &
hybrid%nindxm1, sym)
ENDIF
! Explicit normalization here in order to prevent failure of the diagonalization in diagonalize_coulomb
......
......@@ -134,16 +134,16 @@ CONTAINS
REAL, ALLOCATABLE :: cprod_vv_r(:, :, :), carr3_vv_r(:, :, :)
COMPLEX, ALLOCATABLE :: cprod_vv_c(:, :, :), carr3_vv_c(:, :, :)
REAL :: coulomb_mt1(maxval(hybrid%nindxm1) - 1, maxval(hybrid%nindxm1) - 1, 0:hybrid%maxlcutm1, atoms%ntype)
REAL :: coulomb_mt2_r(maxval(hybrid%nindxm1) - 1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1 + 1, atoms%nat)
REAL :: coulomb_mt1(maxval(hybrid%nindxm1) - 1, maxval(hybrid%nindxm1) - 1, 0:maxval(hybrid%lcutm1), atoms%ntype)
REAL :: coulomb_mt2_r(maxval(hybrid%nindxm1) - 1, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1) + 1, atoms%nat)
REAL :: coulomb_mt3_r(maxval(hybrid%nindxm1) - 1, atoms%nat, atoms%nat)
COMPLEX :: coulomb_mt2_c(maxval(hybrid%nindxm1) - 1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1 + 1, atoms%nat)
COMPLEX :: coulomb_mt2_c(maxval(hybrid%nindxm1) - 1, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1) + 1, atoms%nat)
COMPLEX :: coulomb_mt3_c(maxval(hybrid%nindxm1) - 1, atoms%nat, atoms%nat)
REAL :: coulomb_mtir_r(((hybrid%maxlcutm1 + 1)**2*atoms%nat + maxval(mpbasis%ngptm))* &
((hybrid%maxlcutm1 + 1)**2*atoms%nat + maxval(mpbasis%ngptm) + 1)/2)
COMPLEX :: coulomb_mtir_c(((hybrid%maxlcutm1 + 1)**2*atoms%nat + maxval(mpbasis%ngptm))* &
((hybrid%maxlcutm1 + 1)**2*atoms%nat + maxval(mpbasis%ngptm) + 1)/2)
REAL :: coulomb_mtir_r(((maxval(hybrid%lcutm1) + 1)**2*atoms%nat + maxval(mpbasis%ngptm))* &
((maxval(hybrid%lcutm1) + 1)**2*atoms%nat + maxval(mpbasis%ngptm) + 1)/2)
COMPLEX :: coulomb_mtir_c(((maxval(hybrid%lcutm1) + 1)**2*atoms%nat + maxval(mpbasis%ngptm))* &
((maxval(hybrid%lcutm1) + 1)**2*atoms%nat + maxval(mpbasis%ngptm) + 1)/2)
LOGICAL :: occup(dimension%neigd)
CALL timestart("valence exchange calculation")
......@@ -244,7 +244,7 @@ CONTAINS
exch_vv = exch_vv + &
dynamic_hse_adjustment(atoms%rmsh, atoms%rmt, atoms%dx, atoms%jri, atoms%jmtd, kpts%bkf(:, ikpt0), ikpt0, &
kpts%nkptf, cell%bmat, cell%omtil, atoms%ntype, atoms%neq, atoms%nat, atoms%taual, &
hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1, maxval(hybrid%nindxm1), mpbasis%gptm, &
hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1, maxval(hybrid%nindxm1), mpbasis%gptm, &
mpbasis%ngptm(ikpt0), mpbasis%gptm_ptr(:, ikpt0), mpbasis%num_gpts(), hybrid%basm1, &
hybrid%nbasm(ikpt0), iband1, hybrid%nbands(nk), nsest, ibando, psize, indx_sest, &
atoms%invsat, sym%invsatnr, mpi%irank, cprod_vv_r(:hybrid%nbasm(ikpt0), :, :), &
......
......@@ -215,7 +215,7 @@ CONTAINS
allocate(basprod(atoms%jmtd), stat=ok)
IF (ok /= 0) call judft_error('eigen_hf: failure allocation basprod')
allocate(hybdat%prodm(maxval(hybrid%nindxm1), hybrid%max_indx_p_1, 0:hybrid%maxlcutm1, atoms%ntype), stat=ok)
allocate(hybdat%prodm(maxval(hybrid%nindxm1), hybrid%max_indx_p_1, 0:maxval(hybrid%lcutm1), atoms%ntype), stat=ok)
IF (ok /= 0) call judft_error('eigen_hf: failure allocation hybdat%prodm')
call hybdat%prod%init(hybrid, atoms)
......@@ -223,7 +223,7 @@ CONTAINS
basprod = 0; hybdat%prodm = 0; hybdat%prod%l1 = 0; hybdat%prod%l2 = 0
hybdat%prod%n1 = 0; hybdat%prod%n2 = 0
IF(ALLOCATED(hybdat%nindxp1)) DEALLOCATE(hybdat%nindxp1) ! for spinpolarized systems
ALLOCATE (hybdat%nindxp1(0:hybrid%maxlcutm1, atoms%ntype))
ALLOCATE (hybdat%nindxp1(0:maxval(hybrid%lcutm1), atoms%ntype))
hybdat%nindxp1 = 0
DO itype = 1, atoms%ntype
ng = atoms%jri(itype)
......
......@@ -204,9 +204,7 @@ CONTAINS
WRITE (6, '(A)') 'Reduction due to overlap (quality of orthonormality, should be < 1.0E-06)'
END IF
hybrid%maxlcutm1 = MAXVAL(hybrid%lcutm1)
allocate(hybrid%nindxm1(0:hybrid%maxlcutm1, atoms%ntype))
allocate(hybrid%nindxm1(0:maxval(hybrid%lcutm1), atoms%ntype))
allocate(seleco(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd), selecu(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd))
allocate(selecmat(maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd, maxval(hybrid%num_radfun_per_l), 0:atoms%lmaxd))
hybrid%nindxm1 = 0 !!! 01/12/10 jij%M.b.
......@@ -264,7 +262,7 @@ CONTAINS
END DO
END DO
allocate(hybrid%basm1(atoms%jmtd, maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%ntype))
allocate(hybrid%basm1(atoms%jmtd, maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%ntype))
hybrid%basm1 = 0
! Define product bases and reduce them according to overlap
......@@ -381,10 +379,10 @@ CONTAINS
! Check if basm1 must be reallocated
IF (nn + 1 > SIZE(hybrid%basm1, 2)) THEN
allocate(basmhlp(atoms%jmtd, nn + 1, 0:hybrid%maxlcutm1, atoms%ntype))
allocate(basmhlp(atoms%jmtd, nn + 1, 0:maxval(hybrid%lcutm1), atoms%ntype))
basmhlp(:,1:nn, :,:) = hybrid%basm1
deallocate(hybrid%basm1)
allocate(hybrid%basm1(atoms%jmtd, nn + 1, 0:hybrid%maxlcutm1, atoms%ntype))
allocate(hybrid%basm1(atoms%jmtd, nn + 1, 0:maxval(hybrid%lcutm1), atoms%ntype))
hybrid%basm1(:,1:nn, :,:) = basmhlp(:,1:nn, :,:)
deallocate(basmhlp)
END IF
......@@ -446,11 +444,11 @@ CONTAINS
IF (mpi%irank == 0) WRITE (6, '(6X,A,I7)') 'Total:', SUM(hybrid%nindxm1(0:hybrid%lcutm1(itype), itype))
END DO ! itype
allocate(basmhlp(atoms%jmtd, maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%ntype))
basmhlp(1:atoms%jmtd, 1:maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, 1:atoms%ntype) &
= hybrid%basm1(1:atoms%jmtd, 1:maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, 1:atoms%ntype)
allocate(basmhlp(atoms%jmtd, maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%ntype))
basmhlp(1:atoms%jmtd, 1:maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), 1:atoms%ntype) &
= hybrid%basm1(1:atoms%jmtd, 1:maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), 1:atoms%ntype)
deallocate(hybrid%basm1)
allocate(hybrid%basm1(atoms%jmtd, maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%ntype))
allocate(hybrid%basm1(atoms%jmtd, maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%ntype))
hybrid%basm1 = basmhlp
deallocate(basmhlp, seleco, selecu, selecmat)
......
......@@ -27,9 +27,9 @@ CONTAINS
! - arrays -
REAL, INTENT(IN) :: coulomb_mt1(maxval(hybrid%nindxm1) - 1, maxval(hybrid%nindxm1) - 1,&
& 0:hybrid%maxlcutm1, atoms%ntype)
REAL, INTENT(IN) :: coulomb_mt2(maxval(hybrid%nindxm1) - 1, -hybrid%maxlcutm1:hybrid%maxlcutm1,&
& 0:hybrid%maxlcutm1 + 1, atoms%nat)
& 0:maxval(hybrid%lcutm1), atoms%ntype)
REAL, INTENT(IN) :: coulomb_mt2(maxval(hybrid%nindxm1) - 1, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1),&
& 0:maxval(hybrid%lcutm1) + 1, atoms%nat)
REAL, INTENT(IN) :: coulomb_mt3(:, :, :)
REAL, INTENT(IN) :: coulomb_mtir(:)
REAL, INTENT(IN) :: vecin(:)!(hybrid%nbasm)
......@@ -53,7 +53,7 @@ CONTAINS
vecinhlp = vecin
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1, 1, vecinhlp)
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1, 1, vecinhlp)
ibasm = 0
iatom = 0
......@@ -124,7 +124,7 @@ CONTAINS
IF (indx3 /= hybrid%nbasp) call judft_error('spmvec: error counting index indx3')
vecout(indx1:indx2) = vecout(indx1:indx2) + coulomb_mt2(:hybrid%nindxm1(l, itype) - 1, 0, hybrid%maxlcutm1 + 1, iatom)*vecinhlp(indx3 + 1)
vecout(indx1:indx2) = vecout(indx1:indx2) + coulomb_mt2(:hybrid%nindxm1(l, itype) - 1, 0, maxval(hybrid%lcutm1) + 1, iatom)*vecinhlp(indx3 + 1)
indx0 = indx0 + ishift
END DO
......@@ -167,7 +167,7 @@ CONTAINS
iatom = iatom + 1
indx1 = indx0 + 1
indx2 = indx1 + hybrid%nindxm1(0, itype) - 2
vecout(hybrid%nbasp + 1) = vecout(hybrid%nbasp + 1) + dot_product(coulomb_mt2(:hybrid%nindxm1(0, itype) - 1, 0, hybrid%maxlcutm1 + 1, iatom), vecinhlp(indx1:indx2))
vecout(hybrid%nbasp + 1) = vecout(hybrid%nbasp + 1) + dot_product(coulomb_mt2(:hybrid%nindxm1(0, itype) - 1, 0, maxval(hybrid%lcutm1) + 1, iatom), vecinhlp(indx1:indx2))
indx0 = indx0 + ishift
END DO
......@@ -203,7 +203,7 @@ CONTAINS
IF (indx0 /= hybrid%nbasp) call judft_error('spmvec: error index counting (indx0)')
END IF
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1,&
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1,&
& 2,&
& vecout)
......@@ -233,9 +233,9 @@ CONTAINS
! - arrays -
REAL, INTENT(IN) :: coulomb_mt1(maxval(hybrid%nindxm1) - 1, maxval(hybrid%nindxm1) - 1,&
& 0:hybrid%maxlcutm1, atoms%ntype)
COMPLEX, INTENT(IN) :: coulomb_mt2(maxval(hybrid%nindxm1) - 1, -hybrid%maxlcutm1:hybrid%maxlcutm1,&
& 0:hybrid%maxlcutm1 + 1, atoms%nat)
& 0:maxval(hybrid%lcutm1), atoms%ntype)
COMPLEX, INTENT(IN) :: coulomb_mt2(maxval(hybrid%nindxm1) - 1, -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1),&
& 0:maxval(hybrid%lcutm1) + 1, atoms%nat)
COMPLEX, INTENT(IN) :: coulomb_mt3(:, :, :)
COMPLEX, INTENT(IN) :: coulomb_mtir(:)
COMPLEX, INTENT(IN) :: vecin(:)!(hybrid%nbasm)
......@@ -260,7 +260,7 @@ CONTAINS
vecinhlp = vecin
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1, 1, vec_c=vecinhlp)
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1, 1, vec_c=vecinhlp)
ibasm = 0
iatom = 0
......@@ -332,7 +332,7 @@ CONTAINS
IF (indx3 /= hybrid%nbasp) call judft_error('spmvec: error counting index indx3')
vecout(indx1:indx2) = vecout(indx1:indx2) + coulomb_mt2(:hybrid%nindxm1(l, itype) - 1, 0, hybrid%maxlcutm1 + 1, iatom)*vecinhlp(indx3 + 1)
vecout(indx1:indx2) = vecout(indx1:indx2) + coulomb_mt2(:hybrid%nindxm1(l, itype) - 1, 0, maxval(hybrid%lcutm1) + 1, iatom)*vecinhlp(indx3 + 1)
indx0 = indx0 + ishift
END DO
......@@ -375,7 +375,7 @@ CONTAINS
iatom = iatom + 1
indx1 = indx0 + 1
indx2 = indx1 + hybrid%nindxm1(0, itype) - 2
vecout(hybrid%nbasp + 1) = vecout(hybrid%nbasp + 1) + dot_product(coulomb_mt2(:hybrid%nindxm1(0, itype) - 1, 0, hybrid%maxlcutm1 + 1, iatom), vecinhlp(indx1:indx2))
vecout(hybrid%nbasp + 1) = vecout(hybrid%nbasp + 1) + dot_product(coulomb_mt2(:hybrid%nindxm1(0, itype) - 1, 0, maxval(hybrid%lcutm1) + 1, iatom), vecinhlp(indx1:indx2))
indx0 = indx0 + ishift
END DO
......@@ -411,7 +411,7 @@ CONTAINS
IF (indx0 /= hybrid%nbasp) call judft_error('spmvec: error index counting (indx0)')
END IF
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1,&
CALL reorder(hybrid%nbasm(ikpt), hybrid%nbasp, atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1,&
& 2,&
& vec_c=vecout)
......
......@@ -577,12 +577,12 @@ CONTAINS
! - arrays -
INTEGER :: rrot(3, 3), invrot(3, 3)
INTEGER :: pnt(maxval(hybrid%nindxm1), 0:hybrid%maxlcutm1, atoms%nat)
INTEGER :: pnt(maxval(hybrid%nindxm1), 0:maxval(hybrid%lcutm1), atoms%nat)
INTEGER :: g(3), g1(3)
REAL :: rkpt(3), rkpthlp(3), rtaual(3), trans(3)
REAL :: arg
COMPLEX :: dwgn(-hybrid%maxlcutm1:hybrid%maxlcutm1,&
& -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1)
COMPLEX :: dwgn(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1),&
& -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1))
! COMPLEX :: vecin1(dim,nobd,nbands),vecout1(dim,nobd,nbands)
COMPLEX, ALLOCATABLE :: vecin1(:, :, :), vecout1(:, :, :)
......@@ -594,7 +594,7 @@ CONTAINS
& call judft_error('bra_trafo2: error allocating vecin1 or vecout1')
vecin1 = 0; vecout1 = 0
IF (hybrid%maxlcutm1 > atoms%lmaxd) call judft_error('bra_trafo2: maxlcutm > atoms%lmaxd') ! very improbable case
IF (maxval(hybrid%lcutm1) > atoms%lmaxd) call judft_error('bra_trafo2: maxlcutm > atoms%lmaxd') ! very improbable case
! transform back to unsymmetrized product basis in case of inversion symmetry
if (l_real) THEN
......@@ -602,7 +602,7 @@ CONTAINS
DO i = 1, nbands
DO j = 1, nobd
CALL desymmetrize(vecin1(:hybrid%nbasp, j, i), hybrid%nbasp, 1, 1, &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1, sym)
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1, sym)
END DO
END DO
else
......@@ -615,8 +615,8 @@ CONTAINS
invrot = sym%mrot(:, :, sym%invtab(iop))
trans = sym%tau(:, iop)
dwgn(-hybrid%maxlcutm1:hybrid%maxlcutm1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1) &
= hybrid%d_wgn2(-hybrid%maxlcutm1:hybrid%maxlcutm1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1, inviop)
dwgn(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1)) &
= hybrid%d_wgn2(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1), inviop)
ELSE
iiop = iop - sym%nop
......@@ -625,8 +625,8 @@ CONTAINS
invrot = sym%mrot(:, :, sym%invtab(iiop))
trans = sym%tau(:, iiop)
dwgn(-hybrid%maxlcutm1:hybrid%maxlcutm1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1) &
= conjg(hybrid%d_wgn2(-hybrid%maxlcutm1:hybrid%maxlcutm1, -hybrid%maxlcutm1:hybrid%maxlcutm1, 0:hybrid%maxlcutm1, inviop))
dwgn(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1)) &
= conjg(hybrid%d_wgn2(-maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), -maxval(hybrid%lcutm1):maxval(hybrid%lcutm1), 0:maxval(hybrid%lcutm1), inviop))
END IF
......@@ -740,7 +740,7 @@ CONTAINS
DO j = 1, nobd
CALL symmetrize(vecout1(:, j, i), dim, 1, 1, .false., &
atoms, hybrid%lcutm1, hybrid%maxlcutm1, hybrid%nindxm1, sym)
atoms, hybrid%lcutm1, maxval(hybrid%lcutm1), hybrid%nindxm1, sym)
CALL commonphase(phase(j, i), vecout1(:, j, i), dim)
vecout1(:, j, i) = vecout1(:, j, i)/phase(j, i)
......
......@@ -330,7 +330,7 @@ CONTAINS
INTEGER :: gsum(3)
INTEGER :: g_t(3)
INTEGER :: lmstart(0:atoms%lmaxd, atoms%ntype)
INTEGER :: lmstart2(0:hybrid%maxlcutm1, atoms%nat)
INTEGER :: lmstart2(0:maxval(hybrid%lcutm1), atoms%nat)
REAL :: kqpt(3), kqpthlp(3)
REAL, ALLOCATABLE :: cprod_ir(:, :, :)
......
......@@ -69,11 +69,11 @@ contains
#else
! if the sparse matrix technique is used, several entries of the
! matrix vanish so that the size of each entry is smaller
irecl_coulomb = ( atoms%ntype*(hybrid%maxlcutm1+1)*(maxval(hybrid%nindxm1)-1)**2&
+ atoms%nat *(hybrid%maxlcutm1+2)*(2*hybrid%maxlcutm1+1)*(maxval(hybrid%nindxm1)-1)&
irecl_coulomb = ( atoms%ntype*(maxval(hybrid%lcutm1)+1)*(maxval(hybrid%nindxm1)-1)**2&
+ atoms%nat *(maxval(hybrid%lcutm1)+2)*(2*maxval(hybrid%lcutm1)+1)*(maxval(hybrid%nindxm1)-1)&
+ (maxval(hybrid%nindxm1)-1)*atoms%nat**2&
+ ((hybrid%maxlcutm1+1)**2*atoms%nat+maxval(mpbasis%ngptm))&
*((hybrid%maxlcutm1+1)**2*atoms%nat+maxval(mpbasis%ngptm)+1)/2 )*8
+ ((maxval(hybrid%lcutm1)+1)**2*atoms%nat+maxval(mpbasis%ngptm))&
*((maxval(hybrid%lcutm1)+1)**2*atoms%nat+maxval(mpbasis%ngptm)+1)/2 )*8
if (.not.l_real) irecl_coulomb =irecl_coulomb *2
OPEN(unit=778,file='coulomb1',form='unformatted',access='direct', recl=irecl_coulomb)
id_coulomb_spm=778
......
......@@ -10,7 +10,6 @@ MODULE m_types_hybrid
INTEGER :: lexp = 0
INTEGER :: bands1 !Only read in
INTEGER :: nbasp
INTEGER :: maxlcutm1
INTEGER :: maxbasm1
INTEGER :: max_indx_p_1
INTEGER :: maxgptm1
......@@ -155,7 +154,7 @@ contains
type(t_atoms), intent(in) :: atoms
integer :: ok
ALLOCATE (prod%l1(hybrid%max_indx_p_1, 0:hybrid%maxlcutm1, atoms%ntype), stat=ok)
ALLOCATE (prod%l1(hybrid%max_indx_p_1, 0:maxval(hybrid%lcutm1), atoms%ntype), stat=ok)
IF (ok /= 0) call judft_error('init_prodtype: failure allocation prod%l1')
ALLOCATE (prod%l2, mold=prod%l1, stat=ok)
......
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