Commit 14ec1a50 authored by Gregor Michalicek's avatar Gregor Michalicek

Add spin dimension to hybrid%nobd array

This is required in comparison to the ancient fleur version because
now this array is used in different spin loops.
parent 2ed4eaf7
......@@ -122,7 +122,7 @@ CONTAINS
ELSE
exch(iband, iband) = dot_product(z%data_c(:z%matsize1, iband), tmp%data_c(:, iband))
END IF
IF (iband <= hybrid%nobd(nk)) THEN
IF (iband <= hybrid%nobd(nk,jsp)) THEN
results%te_hfex%valence = results%te_hfex%valence - a_ex*results%w_iks(iband, nk, jsp)*exch(iband, iband)
END IF
IF (hybrid%l_calhf) THEN
......
......@@ -211,14 +211,14 @@ CONTAINS
! ic = 0
sum_offdia = 0
IF (l_real) THEN
DO n1 = 1, hybrid%nobd(nk)
DO n1 = 1, hybrid%nobd(nk,jsp)
DO n2 = 1, hybrid%nbands(nk)
ex_vv_r(n2, n1, nk) = ex_vv_r(n2, n1, nk) - exchange(n1, n2)
IF (n1 /= n2) sum_offdia = sum_offdia + 2*ABS(exchange(n1, n2))
END DO
END DO
ELSE
DO n1 = 1, hybrid%nobd(nk)
DO n1 = 1, hybrid%nobd(nk,jsp)
DO n2 = 1, hybrid%nbands(nk)
ex_vv_c(n2, n1, nk) = ex_vv_c(n2, n1, nk) - exchange(n1, n2)
IF (n1 /= n2) sum_offdia = sum_offdia + 2*ABS(exchange(n1, n2))
......@@ -226,7 +226,7 @@ CONTAINS
END DO
END IF
DO n1 = 1, hybrid%nobd(nk)
DO n1 = 1, hybrid%nobd(nk,jsp)
results%te_hfex%core = results%te_hfex%core - results%w_iks(n1, nk, jsp)*exchange(n1, n1)
END DO
......@@ -391,7 +391,7 @@ CONTAINS
END IF
ENDIF
DO n1 = 1, hybrid%nobd(nk)
DO n1 = 1, hybrid%nobd(nk,jsp)
results%te_hfex%core = results%te_hfex%Core - a_ex*results%w_iks(n1, nk, jsp)*exchange(n1, n1)
END DO
......
......@@ -279,7 +279,7 @@ CONTAINS
! in Fourier space
#ifndef CPP_NOSPMVEC
IF (xcpot%is_name("hse") .OR. xcpot%is_name("vhse")) THEN
iband1 = hybrid%nobd(nkqpt)
iband1 = hybrid%nobd(nkqpt,jsp)
exch_vv = exch_vv + &
dynamic_hse_adjustment(atoms%rmsh, atoms%rmt, atoms%dx, atoms%jri, atoms%jmtd, kpts%bkf(:, ikpt0), ikpt0, &
......@@ -314,7 +314,7 @@ CONTAINS
call timestart("exchange matrix")
DO n1 = 1, hybrid%nbands(nk)
DO iband = 1, psize
IF ((ibando + iband - 1) > hybrid%nobd(nkqpt)) CYCLE
IF ((ibando + iband - 1) > hybrid%nobd(nkqpt,jsp)) CYCLE
cdum = wl_iks(ibando + iband - 1, nkqpt)*conjg(phase_vv(iband, n1))/n_q(ikpt)
......
......@@ -129,7 +129,7 @@ CONTAINS
WRITE (6, '(A)') " k-point | number of occupied bands | maximal number of bands"
END IF
degenerat = 1
hybrid%nobd = 0
hybrid%nobd(:,jsp) = 0
DO nk = 1, kpts%nkpt
DO i = 1, hybrid%ne_eig(nk)
DO j = i + 1, hybrid%ne_eig(nk)
......@@ -163,23 +163,23 @@ CONTAINS
END DO
DO i = 1, hybrid%ne_eig(nk)
IF (results%w_iks(i, nk, jsp) > 0.0) hybrid%nobd(nk) = hybrid%nobd(nk) + 1
IF (results%w_iks(i, nk, jsp) > 0.0) hybrid%nobd(nk,jsp) = hybrid%nobd(nk,jsp) + 1
END DO
IF (hybrid%nobd(nk) > hybrid%nbands(nk)) THEN
IF (hybrid%nobd(nk,jsp) > hybrid%nbands(nk)) THEN
WRITE (*, *) 'k-point: ', nk
WRITE (*, *) 'number of bands: ', hybrid%nbands(nk)
WRITE (*, *) 'number of occupied bands: ', hybrid%nobd(nk)
WRITE (*, *) 'number of occupied bands: ', hybrid%nobd(nk,jsp)
CALL judft_warn("More occupied bands than total no of bands!?")
hybrid%nbands(nk) = hybrid%nobd(nk)
hybrid%nbands(nk) = hybrid%nobd(nk,jsp)
END IF
PRINT *, "bands:", nk, hybrid%nobd(nk), hybrid%nbands(nk), hybrid%ne_eig(nk)
PRINT *, "bands:", nk, hybrid%nobd(nk,jsp), hybrid%nbands(nk), hybrid%ne_eig(nk)
END DO
! spread hybrid%nobd from IBZ to whole BZ
DO nk = 1, kpts%nkptf
i = kpts%bkp(nk)
hybrid%nobd(nk) = hybrid%nobd(i)
hybrid%nobd(nk,jsp) = hybrid%nobd(i,jsp)
END DO
! generate eigenvectors z and MT coefficients from the previous iteration at all k-points
......@@ -275,7 +275,7 @@ CONTAINS
!DO nk = n_start,kpts%nkpt,n_stride
DO nk = 1, kpts%nkpt, 1
hybrid%ne_eig(nk) = results%neig(nk, jsp)
hybrid%nobd(nk) = COUNT(results%w_iks(:hybrid%ne_eig(nk), nk, jsp) > 0.0)
hybrid%nobd(nk,jsp) = COUNT(results%w_iks(:hybrid%ne_eig(nk), nk, jsp) > 0.0)
END DO
hybrid%maxlmindx = MAXVAL((/(SUM((/(hybrid%nindx(l, itype)*(2*l + 1), l=0, atoms%lmax(itype))/)), itype=1, atoms%ntype)/))
......
......@@ -81,7 +81,7 @@ CONTAINS
!In first iteration allocate some memory
IF (init_vex) THEN
ALLOCATE (hybrid%ne_eig(kpts%nkpt), hybrid%nbands(kpts%nkpt), hybrid%nobd(kpts%nkptf))
ALLOCATE (hybrid%ne_eig(kpts%nkpt), hybrid%nbands(kpts%nkpt), hybrid%nobd(kpts%nkptf,input%jspins))
ALLOCATE (hybrid%nbasm(kpts%nkptf))
ALLOCATE (hybrid%div_vv(DIMENSION%neigd, kpts%nkpt, input%jspins))
init_vex = .FALSE.
......@@ -125,7 +125,7 @@ CONTAINS
!DO nk = mpi%n_start,kpts%nkpt,mpi%n_stride
CALL lapw%init(input, noco, kpts, atoms, sym, nk, cell, l_zref)
CALL hsfock(nk, atoms, hybrid, lapw, DIMENSION, kpts, jsp, input, hybdat, eig_irr, sym, cell, &
noco, results, iterHF, MAXVAL(hybrid%nobd), xcpot, mpi)
noco, results, iterHF, MAXVAL(hybrid%nobd(:,jsp)), xcpot, mpi)
END DO
END DO
CALL timestop("Calculation of non-local HF potential")
......
......@@ -149,7 +149,7 @@ CONTAINS
END DO
DO iband1 = 1, hybrid%nobd(nkqpt)
DO iband1 = 1, hybrid%nobd(nkqpt,jsp)
where (iarr > 0)
z_help(:) = z_kqpt%data_c(iarr(:), iband1)
elsewhere
......@@ -404,7 +404,7 @@ CONTAINS
END DO
DO iband1 = 1, hybrid%nobd(nkqpt)
DO iband1 = 1, hybrid%nobd(nkqpt,jsp)
where (iarr > 0)
z_help(:) = z_kqpt%data_r(iarr(:), iband1)
elsewhere
......
......@@ -330,7 +330,7 @@ SUBROUTINE rdmft(eig_id,mpi,input,kpts,banddos,sliceplot,cell,atoms,enpara,stars
IF(ALLOCATED(hybrid%nobd)) DEALLOCATE(hybrid%nobd)
IF(ALLOCATED(hybrid%nbasm)) DEALLOCATE(hybrid%nbasm)
IF(ALLOCATED(hybrid%div_vv)) DEALLOCATE(hybrid%div_vv)
ALLOCATE(hybrid%ne_eig(kpts%nkpt),hybrid%nbands(kpts%nkpt),hybrid%nobd(kpts%nkptf))
ALLOCATE(hybrid%ne_eig(kpts%nkpt),hybrid%nbands(kpts%nkpt),hybrid%nobd(kpts%nkptf,input%jspins))
ALLOCATE(hybrid%nbasm(kpts%nkptf))
ALLOCATE(hybrid%div_vv(DIMENSION%neigd,kpts%nkpt,input%jspins))
l_restart = .FALSE.
......@@ -463,7 +463,7 @@ SUBROUTINE rdmft(eig_id,mpi,input,kpts,banddos,sliceplot,cell,atoms,enpara,stars
results%neig(:,:) = highestState(:,:) + 1
mnobd = MAXVAL(hybrid%nobd)
mnobd = MAXVAL(hybrid%nobd(:,jsp))
DO ikpt = 1,kpts%nkpt
......
......@@ -315,7 +315,7 @@ MODULE m_types_setup
REAL :: tolerance1 !only read in
REAL, ALLOCATABLE :: basm1(:, :, :, :)
COMPLEX, ALLOCATABLE :: d_wgn2(:, :, :, :)
INTEGER, ALLOCATABLE :: ne_eig(:), nbands(:), nobd(:) !alloc in eigen_HF_init
INTEGER, ALLOCATABLE :: ne_eig(:), nbands(:), nobd(:,:) !alloc in eigen_HF_init
REAL, ALLOCATABLE :: div_vv(:, :, :)
END TYPE t_hybrid
......
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