these are redundant

parent 7a1e140b
......@@ -102,51 +102,49 @@ CONTAINS
hybdat%l_subvxc = (hybdat%l_subvxc .AND. hybdat%l_addhf)
IF (.NOT. ALLOCATED(results%w_iks)) allocate(results%w_iks(fi%input%neig, fi%kpts%nkpt, fi%input%jspins))
IF (hybdat%l_calhf) THEN
iterHF = iterHF + 1
!Delete broyd files
CALL system("rm -f broyd*")
!check if z-reflection trick can be used
l_zref = (fi%sym%zrfs .AND. (SUM(ABS(fi%kpts%bk(3, :fi%kpts%nkpt))) < 1e-9) .AND. .NOT. fi%noco%l_noco)
CALL timestart("Preparation for hybrid functionals")
! CALL juDFT_WARN ("fi%hybinp functionals not working in this version")
!construct the mixed-basis
CALL timestart("generation of mixed basis")
write (*,*) "iterHF = ", iterHF
CALL mixedbasis(fi%atoms, fi%kpts, fi%input, fi%cell, xcpot, fi%mpinp, mpdata, fi%hybinp, hybdat,&
enpara, mpi, v, iterHF)
CALL timestop("generation of mixed basis")
CALL open_hybinp_io2(mpdata, fi%hybinp, hybdat, fi%input, fi%atoms, fi%sym%invs)
CALL coulombmatrix(mpi, fi%atoms, fi%kpts, fi%cell, fi%sym, mpdata, fi%hybinp, hybdat, xcpot)
CALL hf_init(eig_id, mpdata, fi%hybinp, fi%atoms, fi%input, hybdat)
CALL timestop("Preparation for hybrid functionals")
CALL timestart("Calculation of non-local HF potential")
DO jsp = 1, fi%input%jspins
call timestart("HF_setup")
CALL HF_setup(mpdata,fi%hybinp, fi%input, fi%sym, fi%kpts, fi%atoms, &
mpi, fi%noco, nococonv,fi%cell, fi%oneD, results, jsp, enpara, &
hybdat, fi%sym%invs, v%mt(:, 0, :, :), eig_irr)
call timestop("HF_setup")
DO nk = 1, fi%kpts%nkpt
!DO nk = mpi%n_start,fi%kpts%nkpt,mpi%n_stride
CALL lapw%init(fi%input, fi%noco, nococonv,fi%kpts, fi%atoms, fi%sym, nk, fi%cell, l_zref)
CALL hsfock(fi,nk, mpdata, lapw, jsp, hybdat, eig_irr, &
nococonv, results, MAXVAL(hybdat%nobd(:,jsp)), xcpot, mpi)
END DO
iterHF = iterHF + 1
!Delete broyd files
CALL system("rm -f broyd*")
!check if z-reflection trick can be used
l_zref = (fi%sym%zrfs .AND. (SUM(ABS(fi%kpts%bk(3, :fi%kpts%nkpt))) < 1e-9) .AND. .NOT. fi%noco%l_noco)
CALL timestart("Preparation for hybrid functionals")
! CALL juDFT_WARN ("fi%hybinp functionals not working in this version")
!construct the mixed-basis
CALL timestart("generation of mixed basis")
write (*,*) "iterHF = ", iterHF
CALL mixedbasis(fi%atoms, fi%kpts, fi%input, fi%cell, xcpot, fi%mpinp, mpdata, fi%hybinp, hybdat,&
enpara, mpi, v, iterHF)
CALL timestop("generation of mixed basis")
CALL open_hybinp_io2(mpdata, fi%hybinp, hybdat, fi%input, fi%atoms, fi%sym%invs)
CALL coulombmatrix(mpi, fi%atoms, fi%kpts, fi%cell, fi%sym, mpdata, fi%hybinp, hybdat, xcpot)
CALL hf_init(eig_id, mpdata, fi%hybinp, fi%atoms, fi%input, hybdat)
CALL timestop("Preparation for hybrid functionals")
CALL timestart("Calculation of non-local HF potential")
DO jsp = 1, fi%input%jspins
call timestart("HF_setup")
CALL HF_setup(mpdata,fi%hybinp, fi%input, fi%sym, fi%kpts, fi%atoms, &
mpi, fi%noco, nococonv,fi%cell, fi%oneD, results, jsp, enpara, &
hybdat, fi%sym%invs, v%mt(:, 0, :, :), eig_irr)
call timestop("HF_setup")
DO nk = 1, fi%kpts%nkpt
!DO nk = mpi%n_start,fi%kpts%nkpt,mpi%n_stride
CALL lapw%init(fi%input, fi%noco, nococonv,fi%kpts, fi%atoms, fi%sym, nk, fi%cell, l_zref)
CALL hsfock(fi,nk, mpdata, lapw, jsp, hybdat, eig_irr, &
nococonv, results, MAXVAL(hybdat%nobd(:,jsp)), xcpot, mpi)
END DO
CALL timestop("Calculation of non-local HF potential")
CALL close_eig(eig_id)
END DO
CALL timestop("Calculation of non-local HF potential")
CALL close_eig(eig_id)
ENDIF
CALL timestop("hybrid code")
END SUBROUTINE calc_hybrid
END MODULE m_calc_hybrid
......@@ -120,66 +120,62 @@ CONTAINS
call read_olap(olap, fi%kpts%nkpt*(jsp - 1) + nk, nbasfcn)
call timestop("read in olap")
IF(hybdat%l_calhf) THEN
ncstd = sum([((hybdat%nindxc(l, itype)*(2*l + 1)*fi%atoms%neq(itype), l=0, hybdat%lmaxc(itype)), itype=1, fi%atoms%ntype)])
IF(nk == 1 .and. mpi%irank == 0) WRITE(*, *) 'calculate new HF matrix'
IF(nk == 1 .and. jsp == 1 .and. fi%input%imix > 10) CALL system('rm -f broyd*')
! calculate all symmetrie operations, which yield k invariant
allocate(parent(fi%kpts%nkptf), stat=ok)
IF(ok /= 0) call judft_error('mhsfock: failure allocation parent')
parent = 0
call z%init(olap%l_real, nbasfcn, hybdat%nbands(nk))
if(nk /= fi%kpts%bkp(nk)) call juDFT_error("We should be reading the parent z-mat here!")
call read_z(fi%atoms, fi%cell, hybdat, fi%kpts, fi%sym, fi%noco, nococonv, fi%input, nk, jsp, z, c_phase=c_phase)
CALL timestart("symm_hf")
CALL symm_hf_init(fi%sym, fi%kpts, nk, nsymop, rrot, psym)
CALL symm_hf(fi%kpts, nk, fi%sym, hybdat, eig_irr, fi%input, fi%atoms, mpdata, fi%hybinp, fi%cell, lapw, &
fi%noco, nococonv, fi%oneD, z, c_phase, jsp, &
rrot, nsymop, psym, nkpt_EIBZ, n_q, parent, pointer_EIBZ, nsest, indx_sest)
CALL timestop("symm_hf")
! remove weights(wtkpt) in w_iks
DO ikpt = 1, fi%kpts%nkptf
DO iband = 1, fi%input%neig
ikpt0 = fi%kpts%bkp(ikpt)
wl_iks(iband, ikpt) = results%w_iks(iband, ikpt0, jsp)/(fi%kpts%wtkpt(ikpt0)*fi%kpts%nkptf)
END DO
END DO
! calculate contribution from valence electrons to the
! HF exchange
ex%l_real = fi%sym%invs
CALL exchange_valence_hf(nk, fi%kpts, nkpt_EIBZ, fi%sym, fi%atoms, mpdata, fi%hybinp, fi%cell, fi%input, jsp, hybdat, mnobd, lapw, &
eig_irr, results, pointer_EIBZ, n_q, wl_iks, xcpot, fi%noco, nococonv, fi%oneD, nsest, indx_sest, &
mpi, ex)
ncstd = sum([((hybdat%nindxc(l, itype)*(2*l + 1)*fi%atoms%neq(itype), l=0, hybdat%lmaxc(itype)), itype=1, fi%atoms%ntype)])
IF(nk == 1 .and. mpi%irank == 0) WRITE(*, *) 'calculate new HF matrix'
IF(nk == 1 .and. jsp == 1 .and. fi%input%imix > 10) CALL system('rm -f broyd*')
! calculate all symmetrie operations, which yield k invariant
CALL timestart("core exchange calculation")
allocate(parent(fi%kpts%nkptf), stat=ok)
IF(ok /= 0) call judft_error('mhsfock: failure allocation parent')
parent = 0
! calculate contribution from the core states to the HF exchange
IF(xcpot%is_name("hse") .OR. xcpot%is_name("vhse")) THEN
call judft_error('HSE not implemented in hsfock')
ELSE
CALL exchange_vccv1(nk, fi%input, fi%atoms, fi%cell, fi%kpts, fi%sym, fi%noco, nococonv, fi%oneD, &
mpdata, fi%hybinp, hybdat, jsp, &
lapw, nsymop, nsest, indx_sest, mpi, a_ex, results, ex)
CALL exchange_cccc(nk, fi%atoms, hybdat, ncstd, fi%sym, fi%kpts, a_ex, results)
END IF
call z%init(olap%l_real, nbasfcn, hybdat%nbands(nk))
deallocate(n_q)
CALL timestop("core exchange calculation")
if(nk /= fi%kpts%bkp(nk)) call juDFT_error("We should be reading the parent z-mat here!")
call read_z(fi%atoms, fi%cell, hybdat, fi%kpts, fi%sym, fi%noco, nococonv, fi%input, nk, jsp, z, c_phase=c_phase)
call ex_to_vx(fi, nk, jsp, nsymop, psym, hybdat, lapw, z, olap, ex, v_x)
CALL timestart("symm_hf")
CALL symm_hf_init(fi%sym, fi%kpts, nk, nsymop, rrot, psym)
CALL write_v_x(v_x, fi%kpts%nkpt*(jsp - 1) + nk)
END IF ! hybdat%l_calhf
CALL symm_hf(fi%kpts, nk, fi%sym, hybdat, eig_irr, fi%input, fi%atoms, mpdata, fi%hybinp, fi%cell, lapw, &
fi%noco, nococonv, fi%oneD, z, c_phase, jsp, &
rrot, nsymop, psym, nkpt_EIBZ, n_q, parent, pointer_EIBZ, nsest, indx_sest)
CALL timestop("symm_hf")
CALL timestop("total time hsfock")
! remove weights(wtkpt) in w_iks
DO ikpt = 1, fi%kpts%nkptf
DO iband = 1, fi%input%neig
ikpt0 = fi%kpts%bkp(ikpt)
wl_iks(iband, ikpt) = results%w_iks(iband, ikpt0, jsp)/(fi%kpts%wtkpt(ikpt0)*fi%kpts%nkptf)
END DO
END DO
END SUBROUTINE hsfock
! calculate contribution from valence electrons to the
! HF exchange
ex%l_real = fi%sym%invs
CALL exchange_valence_hf(nk, fi%kpts, nkpt_EIBZ, fi%sym, fi%atoms, mpdata, fi%hybinp, fi%cell, fi%input, jsp, hybdat, mnobd, lapw, &
eig_irr, results, pointer_EIBZ, n_q, wl_iks, xcpot, fi%noco, nococonv, fi%oneD, nsest, indx_sest, &
mpi, ex)
CALL timestart("core exchange calculation")
! calculate contribution from the core states to the HF exchange
IF(xcpot%is_name("hse") .OR. xcpot%is_name("vhse")) THEN
call judft_error('HSE not implemented in hsfock')
ELSE
CALL exchange_vccv1(nk, fi%input, fi%atoms, fi%cell, fi%kpts, fi%sym, fi%noco, nococonv, fi%oneD, &
mpdata, fi%hybinp, hybdat, jsp, &
lapw, nsymop, nsest, indx_sest, mpi, a_ex, results, ex)
CALL exchange_cccc(nk, fi%atoms, hybdat, ncstd, fi%sym, fi%kpts, a_ex, results)
END IF
deallocate(n_q)
CALL timestop("core exchange calculation")
call ex_to_vx(fi, nk, jsp, nsymop, psym, hybdat, lapw, z, olap, ex, v_x)
CALL write_v_x(v_x, fi%kpts%nkpt*(jsp - 1) + nk)
CALL timestop("total time hsfock")
END SUBROUTINE hsfock
END MODULE m_hsfock
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