Commit 26f356f9 authored by Gregor Michalicek's avatar Gregor Michalicek

Bugfix for hybrid functionals

...related to the choice whether the nonlocal potential should be added in a certain iteration
parent c2ba2abc
......@@ -68,7 +68,6 @@ CONTAINS
!If this is the first iteration loop we can not calculate a new non-local potential
hybrid%l_calhf = (results%last_distance.GE.0.0).AND.(results%last_distance.LT.input%minDistance)
IF(.NOT.hybrid%l_calhf) THEN
IF (hybrid%l_addhf) INQUIRE(file="cdnc",exist=hybrid%l_addhf)
hybrid%l_subvxc = hybrid%l_subvxc.AND.hybrid%l_addhf
RETURN
ENDIF
......@@ -78,8 +77,10 @@ CONTAINS
CALL judft_error("Hybrid functionals do not work in parallel version yet")
CALL MPI_BCAST(results%last_distance ....
#endif
CALL open_hybrid_io1b(DIMENSION,sym%invs)
hybrid%l_addhf = .TRUE.
!In first iteration allocate some memory
IF (init_vex) THEN
ALLOCATE(hybrid%ne_eig(kpts%nkpt),hybrid%nbands(kpts%nkpt),hybrid%nobd(kpts%nkptf))
......
......@@ -20,8 +20,6 @@ contains
LOGICAL,INTENT(IN) :: l_real
LOGICAL :: opened=.false.
if (opened) return
opened=.true.
......@@ -29,9 +27,23 @@ contains
id_olap=OPEN_MATRIX(l_real,dimension%nbasfcn,1,"olap.mat")
print *,"Open z.mat"
id_z=OPEN_MATRIX(l_real,dimension%nbasfcn,1,"z.mat")
END SUBROUTINE open_hybrid_io1
SUBROUTINE open_hybrid_io1b(DIMENSION,l_real)
implicit none
TYPE(t_dimension),INTENT(IN):: dimension
LOGICAL,INTENT(IN) :: l_real
LOGICAL :: opened=.false.
if (opened) return
opened=.true.
print *,"Open v_x.mat"
id_v_x=OPEN_MATRIX(l_real,dimension%nbasfcn,1,"v_x.mat")
END SUBROUTINE open_hybrid_io1
END SUBROUTINE open_hybrid_io1b
SUBROUTINE open_hybrid_io2(hybrid,DIMENSION,atoms,l_real)
IMPLICIT NONE
TYPE(t_hybrid),INTENT(IN) :: hybrid
......
......@@ -422,10 +422,10 @@ CONTAINS
ELSE
l_cont = l_cont.AND.(iter < 50) ! Security stop for non-converging nested PBE calculations
END IF
!!$ IF (hybrid%l_subvxc) THEN
!!$ results%te_hfex%core = 0
!!$ results%te_hfex%valence = 0
!!$ END IF
IF (hybrid%l_subvxc) THEN
results%te_hfex%core = 0
results%te_hfex%valence = 0
END IF
ELSE
l_cont = l_cont.AND.(iter < input%itmax)
l_cont = l_cont.AND.((input%mindistance<=results%last_distance).OR.input%l_f)
......
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