Commit 969f97e4 authored by Gregor Michalicek's avatar Gregor Michalicek

Keep core exchange also for non l_calhf iterations

parent a98e5ee5
...@@ -239,7 +239,7 @@ CONTAINS ...@@ -239,7 +239,7 @@ CONTAINS
IF( input%jspins .EQ. 1 .AND. hybrid%l_hybrid ) THEN IF( input%jspins .EQ. 1 .AND. hybrid%l_hybrid ) THEN
results%te_hfex%valence = 2*results%te_hfex%valence results%te_hfex%valence = 2*results%te_hfex%valence
results%te_hfex%core = 2*results%te_hfex%core IF(hybrid%l_calhf) results%te_hfex%core = 2*results%te_hfex%core
END IF END IF
enpara%epara_min = MINVAL(enpara%el0) enpara%epara_min = MINVAL(enpara%el0)
enpara%epara_min = MIN(MINVAL(enpara%ello0),enpara%epara_min) enpara%epara_min = MIN(MINVAL(enpara%ello0),enpara%epara_min)
......
...@@ -72,6 +72,8 @@ CONTAINS ...@@ -72,6 +72,8 @@ CONTAINS
RETURN RETURN
ENDIF ENDIF
results%te_hfex%core = 0
!Check if we are converged well enough to calculate a new potential !Check if we are converged well enough to calculate a new potential
#if defined(CPP_MPI)&&defined(CPP_NEVER) #if defined(CPP_MPI)&&defined(CPP_NEVER)
CALL judft_error("Hybrid functionals do not work in parallel version yet") CALL judft_error("Hybrid functionals do not work in parallel version yet")
......
...@@ -255,12 +255,17 @@ CONTAINS ...@@ -255,12 +255,17 @@ CONTAINS
! add all contributions to total energy ! add all contributions to total energy
#ifdef CPP_MPI #ifdef CPP_MPI
! send all result of local total energies to the r ! send all result of local total energies to the r
IF (mpi%irank==0) THEN IF (hybrid%l_hybrid.AND.hybrid%l_calhf) THEN
CALL MPI_Reduce(MPI_IN_PLACE,results%te_hfex%valence,1,MPI_REAL8,MPI_SUM,0,mpi%mpi_comm,ierr(1)) IF (mpi%irank==0) THEN
CALL MPI_Reduce(MPI_IN_PLACE,results%te_hfex%core,1,MPI_REAL8,MPI_SUM,0,mpi%mpi_comm,ierr(1)) CALL MPI_Reduce(MPI_IN_PLACE,results%te_hfex%core,1,MPI_REAL8,MPI_SUM,0,mpi%mpi_comm,ierr(1))
ELSE ELSE
CALL MPI_Reduce(results%te_hfex%valence,MPI_IN_PLACE,1,MPI_REAL8,MPI_SUM,0, mpi%mpi_comm,ierr(1)) CALL MPI_Reduce(results%te_hfex%core,MPI_IN_PLACE,1,MPI_REAL8,MPI_SUM,0, mpi%mpi_comm,ierr(1))
CALL MPI_Reduce(results%te_hfex%core,MPI_IN_PLACE,1,MPI_REAL8,MPI_SUM,0, mpi%mpi_comm,ierr(1)) END IF
IF (mpi%irank==0) THEN
CALL MPI_Reduce(MPI_IN_PLACE,results%te_hfex%valence,1,MPI_REAL8,MPI_SUM,0,mpi%mpi_comm,ierr(1))
ELSE
CALL MPI_Reduce(results%te_hfex%valence,MPI_IN_PLACE,1,MPI_REAL8,MPI_SUM,0, mpi%mpi_comm,ierr(1))
END IF
END IF END IF
#endif #endif
...@@ -422,7 +427,6 @@ CONTAINS ...@@ -422,7 +427,6 @@ CONTAINS
l_cont = l_cont.AND.(iter < 50) ! Security stop for non-converging nested PBE calculations l_cont = l_cont.AND.(iter < 50) ! Security stop for non-converging nested PBE calculations
END IF END IF
IF (hybrid%l_subvxc) THEN IF (hybrid%l_subvxc) THEN
results%te_hfex%core = 0
results%te_hfex%valence = 0 results%te_hfex%valence = 0
END IF END IF
ELSE ELSE
......
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