Commit b9a768e5 authored by Daniel Wortmann's avatar Daniel Wortmann

Merge branch 'develop' of iffgit.fz-juelich.de:fleur/fleur into develop

parents 498f21a8 6a78188d
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_calc_hybrid
USE m_judft
CONTAINS
SUBROUTINE calc_hybrid(hybrid,kpts,atoms,input,DIMENSION,mpi,noco,cell,oneD,results,sym,xcpot,v,it )
SUBROUTINE calc_hybrid(hybrid,kpts,atoms,input,DIMENSION,mpi,noco,cell,oneD,results,sym,xcpot,v,it)
USE m_types
USE m_mixedbasis
USE m_coulombmatrix
......@@ -10,80 +20,82 @@ CONTAINS
USE m_hsfock
USE m_eig66_io
USE m_io_hybrid
IMPLICIT NONE
TYPE(t_xcpot_inbuild),INTENT(IN) :: xcpot
TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_dimension),INTENT(IN) :: DIMENSION
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_hybrid),INTENT(INOUT) :: hybrid
TYPE(t_input),INTENT(IN) :: input
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_results),INTENT(INOUT):: results
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_kpts),INTENT(IN) :: kpts
TYPE(t_atoms),INTENT(IN) :: atoms!in u_setup n_u might be modified
TYPE(t_potden),INTENT(IN) :: v
INTEGER,INTENT(IN) :: it
!Local variables
INTEGER :: eig_id,jsp,nk,nred
TYPE(t_hybdat) :: hybdat
type(t_lapw) :: lapw
LOGICAL :: init_vex=.TRUE. !In first call we have to init v_nonlocal
INTEGER,SAVE :: nohf_it=99 !Do not rely on a converged density
INTEGER :: comm(kpts%nkpt),irank2(kpts%nkpt),isize2(kpts%nkpt)
LOGICAL :: l_restart=.FALSE.,l_zref
REAL, ALLOCATABLE :: eig_irr(:,:)
real :: bkpt(3)
TYPE(t_xcpot_inbuild), INTENT(IN) :: xcpot
TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_dimension), INTENT(IN) :: DIMENSION
TYPE(t_oneD), INTENT(IN) :: oneD
TYPE(t_hybrid), INTENT(INOUT) :: hybrid
TYPE(t_input), INTENT(IN) :: input
TYPE(t_noco), INTENT(IN) :: noco
TYPE(t_results), INTENT(INOUT) :: results
TYPE(t_sym), INTENT(IN) :: sym
TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_potden), INTENT(IN) :: v
INTEGER, INTENT(IN) :: it
! local variables
INTEGER :: eig_id,jsp,nk,nred
TYPE(t_hybdat) :: hybdat
type(t_lapw) :: lapw
LOGICAL :: init_vex=.TRUE. !In first call we have to init v_nonlocal
INTEGER,SAVE :: nohf_it=99 !Do not rely on a converged density
LOGICAL :: l_restart=.FALSE.
LOGICAL :: l_zref
INTEGER :: comm(kpts%nkpt),irank2(kpts%nkpt),isize2(kpts%nkpt)
REAL :: bkpt(3)
REAL, ALLOCATABLE :: eig_irr(:,:)
INQUIRE(file="v_x.mat",exist=hybrid%l_addhf)
CALL open_hybrid_io1(DIMENSION,sym%invs)
IF (kpts%nkptf==0) CALL judft_error("kpoint-set of full BZ not available",hint="to generate kpts in the full BZ you should specify a k-mesh in inp.xml")
IF (kpts%nkptf==0) THEN
CALL judft_error("kpoint-set of full BZ not available",&
hint="to generate kpts in the full BZ you should specify a k-mesh in inp.xml")
END IF
!Check if new non-local potential shall be generated
hybrid%l_subvxc = ( hybrid%l_hybrid.AND..not.xcpot%is_name("exx") )
!If this is the first iteration loop we can not calculate a new
!non-local potential
IF (it<2) THEN
hybrid%l_calhf=.FALSE.
if (hybrid%l_addhf) INQUIRE(file="cdnc",exist=hybrid%l_addhf)
hybrid%l_subvxc = ( hybrid%l_subvxc .AND. hybrid%l_addhf)
hybrid%l_subvxc = hybrid%l_hybrid.AND.(.NOT.xcpot%is_name("exx"))
!If this is the first iteration loop we can not calculate a new non-local potential
IF (it < 2) THEN
hybrid%l_calhf = .FALSE.
IF (hybrid%l_addhf) INQUIRE(file="cdnc",exist=hybrid%l_addhf)
hybrid%l_subvxc = hybrid%l_subvxc.AND.hybrid%l_addhf
RETURN
ENDIF
!Check if we are converged well enough to calculate a new potential
#if defined(CPP_MPI)&&defined(CPP_NEVER)
CALL judft_error("Hybrid functionals do not work in parallel version yet")
CALL MPI_BCAST(results%last_distance ....
#endif
hybrid%l_calhf=results%last_distance<1E-5
IF (nohf_it>50) THEN
hybrid%l_calhf=.TRUE.
nohf_it=0
hybrid%l_calhf = results%last_distance < input%minDistance
IF (nohf_it > 50) THEN
hybrid%l_calhf = .TRUE.
nohf_it = 0
ELSE
IF (hybrid%l_calhf) THEN
nohf_it=0
ELSE
nohf_it=nohf_it+1
END IF
nohf_it = nohf_it+1
IF (hybrid%l_calhf) nohf_it=0
ENDIF
hybrid%l_addhf=.true.
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))
ALLOCATE( hybrid%nbasm(kpts%nkptf))
ALLOCATE(hybrid%nbasm(kpts%nkptf))
ALLOCATE(hybrid%div_vv(DIMENSION%neigd,kpts%nkpt,input%jspins))
init_vex=.false.
ENDIF
hybrid%l_subvxc = ( hybrid%l_subvxc .AND. hybrid%l_addhf)
IF( .NOT. ALLOCATED(results%w_iks) )&
ALLOCATE ( results%w_iks(DIMENSION%neigd2,kpts%nkpt,DIMENSION%jspd) )
init_vex=.FALSE.
END IF
hybrid%l_subvxc = (hybrid%l_subvxc.AND.hybrid%l_addhf)
IF(.NOT.ALLOCATED(results%w_iks)) ALLOCATE (results%w_iks(DIMENSION%neigd2,kpts%nkpt,DIMENSION%jspd))
IF (.NOT.hybrid%l_calhf) RETURN !use existing non-local potential
!Delete broyd files
......@@ -91,46 +103,43 @@ CONTAINS
!check if z-reflection trick can be used
l_zref=(sym%zrfs.AND.(SUM(ABS(kpts%bk(3,:kpts%nkpt))).LT.1e-9).AND..NOT.noco%l_noco)
l_zref = (sym%zrfs.AND.(SUM(ABS(kpts%bk(3,:kpts%nkpt))).LT.1e-9).AND..NOT.noco%l_noco)
CALL timestart("generation of non-local HF potential")
CALL timestart("Preparation for Hybrid functionals")
CALL juDFT_WARN ("Hybrid functionals not working in this version")
CALL juDFT_WARN ("Hybrid functionals not working in this version")
eig_id=open_eig(mpi%mpi_comm,dimension%nbasfcn,dimension%neigd,kpts%nkpt,dimension%jspd,&
noco%l_noco,.FALSE.,sym%invs.AND..NOT.noco%l_noco,noco%l_soc,.FALSE.,mpi%n_size)
eig_id = open_eig(mpi%mpi_comm,dimension%nbasfcn,dimension%neigd,kpts%nkpt,dimension%jspd,&
noco%l_noco,.FALSE.,sym%invs.AND..NOT.noco%l_noco,noco%l_soc,.FALSE.,mpi%n_size)
!construct the mixed-basis
CALL timestart("generation of mixed basis")
CALL mixedbasis(atoms,kpts, dimension,input,cell,sym,xcpot,hybrid, eig_id,mpi,v,l_restart)
CALL mixedbasis(atoms,kpts,dimension,input,cell,sym,xcpot,hybrid,eig_id,mpi,v,l_restart)
CALL timestop("generation of mixed basis")
CALL open_hybrid_io2(hybrid,DIMENSION,atoms,sym%invs)
CALL timestart("generation of coulomb matrix")
CALL coulombmatrix(mpi,atoms,kpts,cell,sym,hybrid,xcpot,l_restart)
CALL timestop("generation of coulomb matrix")
CALL hf_init(hybrid,kpts,atoms,input,DIMENSION,hybdat,irank2,isize2,sym%invs)
CALL timestop("Preparation for Hybrid functionals")
CALL timestart("Calculation of non-local potential")
DO jsp = 1,input%jspins
CALL HF_setup(hybrid,input,sym,kpts,dimension,atoms,mpi,noco,cell,oneD,results,jsp,eig_id,&
hybdat,irank2,it,sym%invs,v%mt(:,0,:,:),eig_irr)
DO nk = mpi%n_start,kpts%nkpt,mpi%n_stride
hybdat,irank2,it,sym%invs,v%mt(:,0,:,:),eig_irr)
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,it,MAXVAL(hybrid%nobd),xcpot,&
mpi,irank2(nk),isize2(nk),comm(nk))
CALL hsfock(nk,atoms,hybrid,lapw,DIMENSION,kpts,jsp,input,hybdat,eig_irr,sym,cell,&
noco,results,it,MAXVAL(hybrid%nobd),xcpot,mpi,irank2(nk),isize2(nk),comm(nk))
END DO
END DO
CALL timestop("Calculation of non-local potential")
CALL timestop("generation of non-local HF potential")
CALL close_eig(eig_id)
end subroutine calc_hybrid
END SUBROUTINE calc_hybrid
END MODULE m_calc_hybrid
......@@ -317,6 +317,7 @@
IF(juDFT_was_argument("-old")) THEN
CALL juDFT_error('No hybrid functionals input for old input file implemented', calledby='set_inp')
END IF
input%minDistance = 1.0e-5
ELSE
input%gw_neigd = 0
END IF
......
This source diff could not be displayed because it is too large. You can view the blob instead.
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
......@@ -72,60 +71,59 @@ CONTAINS
USE m_chase_diag
IMPLICIT NONE
INTEGER,INTENT(IN) :: mpi_comm
! Types, these variables contain a lot of data!
TYPE(t_input) :: input
TYPE(t_field) :: field, field2
TYPE(t_dimension):: DIMENSION
TYPE(t_atoms) :: atoms
TYPE(t_sphhar) :: sphhar
TYPE(t_cell) :: cell
TYPE(t_stars) :: stars
TYPE(t_sym) :: sym
TYPE(t_noco) :: noco
TYPE(t_vacuum) :: vacuum
TYPE(t_sliceplot):: sliceplot
TYPE(t_banddos) :: banddos
TYPE(t_obsolete) :: obsolete
TYPE(t_enpara) :: enpara
TYPE(t_results) :: results
TYPE(t_kpts) :: kpts
TYPE(t_hybrid) :: hybrid
TYPE(t_oneD) :: oneD
TYPE(t_mpi) :: mpi
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: vTot,vx,vCoul,vTemp
TYPE(t_potden) :: inDen, outDen
CLASS(t_xcpot),ALLOCATABLE :: xcpot
CLASS(t_forcetheo),ALLOCATABLE:: forcetheo
! .. Local Scalars ..
INTEGER:: eig_id, archiveType
INTEGER:: n,it,ithf
LOGICAL:: l_opti,l_cont,l_qfix, l_wann_inp, l_real
REAL :: fermiEnergyTemp, fix
INTEGER, INTENT(IN) :: mpi_comm
TYPE(t_input) :: input
TYPE(t_field) :: field, field2
TYPE(t_dimension) :: DIMENSION
TYPE(t_atoms) :: atoms
TYPE(t_sphhar) :: sphhar
TYPE(t_cell) :: cell
TYPE(t_stars) :: stars
TYPE(t_sym) :: sym
TYPE(t_noco) :: noco
TYPE(t_vacuum) :: vacuum
TYPE(t_sliceplot) :: sliceplot
TYPE(t_banddos) :: banddos
TYPE(t_obsolete) :: obsolete
TYPE(t_enpara) :: enpara
TYPE(t_results) :: results
TYPE(t_kpts) :: kpts
TYPE(t_hybrid) :: hybrid
TYPE(t_oneD) :: oneD
TYPE(t_mpi) :: mpi
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: vTot, vx, vCoul, vTemp
TYPE(t_potden) :: inDen, outDen
CLASS(t_xcpot), ALLOCATABLE :: xcpot
CLASS(t_forcetheo), ALLOCATABLE :: forcetheo
! local scalars
INTEGER :: eig_id,archiveType
INTEGER :: n,iter,iterHF
LOGICAL :: l_opti,l_cont,l_qfix,l_wann_inp,l_real
REAL :: fermiEnergyTemp,fix
#ifdef CPP_MPI
INCLUDE 'mpif.h'
INTEGER:: ierr(2)
INTEGER :: ierr(2)
#endif
mpi%mpi_comm = mpi_comm
CALL timestart("Initialization")
CALL fleur_init(mpi,input,field,DIMENSION,atoms,sphhar,cell,stars,sym,noco,vacuum,forcetheo,&
sliceplot,banddos,obsolete,enpara,xcpot,results,kpts,hybrid,&
oneD,coreSpecInput,wann,l_opti)
CALL fleur_init(mpi,input,field,DIMENSION,atoms,sphhar,cell,stars,sym,noco,vacuum,forcetheo,sliceplot,&
banddos,obsolete,enpara,xcpot,results,kpts,hybrid,oneD,coreSpecInput,wann,l_opti)
CALL timestop("Initialization")
if( input%preconditioning_param /= 0 .and. input%film ) call juDFT_error('Currently no preconditioner for films', calledby = 'fleur' )
IF((input%preconditioning_param /= 0).AND.input%film) THEN
CALL juDFT_error('Currently no preconditioner for films', calledby = 'fleur')
END IF
IF (l_opti) CALL optional(mpi,atoms,sphhar,vacuum,dimension,&
stars,input,sym,cell,sliceplot,obsolete,xcpot,noco,oneD)
!+Wannier
!+Wannier (start)
INQUIRE (file='wann_inp',exist=l_wann_inp)
input%l_wann = input%l_wann.OR.l_wann_inp
IF (input%l_wann.AND.(mpi%irank==0).AND.(.NOT.wann%l_bs_comf)) THEN
......@@ -133,29 +131,26 @@ CONTAINS
CALL wann_optional(input,kpts,atoms,sym,cell,oneD,noco,wann)
END IF
IF (wann%l_gwf) input%itmax = 1
!-Wannier (end)
!-Wannier
it = 0
ithf = 0
l_cont = ( it < input%itmax )
iter = 0
iterHF = 0
l_cont = (iter < input%itmax)
IF (mpi%irank.EQ.0) CALL openXMLElementNoAttributes('scfLoop')
! Initialize and load inDen density (start)
CALL inDen%init(stars,atoms,sphhar,vacuum,input%jspins,noco%l_noco,POTDEN_TYPE_DEN)
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
IF (noco%l_noco) archiveType = CDN_ARCHIVE_TYPE_NOCO_const
IF(mpi%irank.EQ.0) THEN
CALL readDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
0,fermiEnergyTemp,l_qfix,inDen)
0,fermiEnergyTemp,l_qfix,inDen)
CALL timestart("Qfix")
CALL qfix(stars,atoms,sym,vacuum, sphhar,input,cell,oneD,inDen,noco%l_noco,.FALSE.,.false.,fix)
CALL timestop("Qfix")
CALL writeDensity(stars,vacuum,atoms,cell,sphhar,input,sym,oneD,archiveType,CDN_INPUT_DEN_const,&
0,-1.0,0.0,.FALSE.,inDen)
0,-1.0,0.0,.FALSE.,inDen)
END IF
! Initialize and load inDen density (end)
......@@ -166,6 +161,7 @@ CONTAINS
CALL vTemp%init(stars,atoms,sphhar,vacuum,DIMENSION%jspd,noco%l_noco,POTDEN_TYPE_POTTOT)
! Initialize potentials (end)
! Open/allocate eigenvector storage (start)
l_real=sym%invs.AND..NOT.noco%l_noco
eig_id=open_eig(mpi%mpi_comm,DIMENSION%nbasfcn,DIMENSION%neigd,kpts%nkpt,DIMENSION%jspd,&
noco%l_noco,.TRUE.,l_real,noco%l_soc,.FALSE.,mpi%n_size)
......@@ -173,57 +169,45 @@ CONTAINS
#ifdef CPP_CHASE
CALL init_chase(mpi,dimension,atoms,kpts,noco,sym%invs.AND..NOT.noco%l_noco)
#endif
! Open/allocate eigenvector storage (end)
scfloop:DO WHILE (l_cont)
CALL reset_eig(eig_id,noco%l_soc)
it = it + 1
IF (mpi%irank.EQ.0) CALL openXMLElementFormPoly('iteration',(/'numberForCurrentRun','overallNumber '/)&
,(/it,inden%iter/), RESHAPE((/19,13,5,5/),(/2,2/)))
iter = iter + 1
IF (mpi%irank.EQ.0) CALL openXMLElementFormPoly('iteration',(/'numberForCurrentRun','overallNumber '/),&
(/iter,inden%iter/), RESHAPE((/19,13,5,5/),(/2,2/)))
!!$ !+t3e
!!$ IF (input%alpha.LT.10.0) THEN
!!$
!!$ IF (it.GT.1) THEN
!!$ IF (iter.GT.1) THEN
!!$ input%alpha = input%alpha - NINT(input%alpha)
!!$ END IF
CALL resetIterationDependentTimers()
CALL timestart("Iteration")
IF (mpi%irank.EQ.0) THEN
!-t3e
WRITE (6,FMT=8100) it
WRITE (16,FMT=8100) it
8100 FORMAT (/,10x,' it= ',i5)
! ----> potential generator
!
input%total = .TRUE.
WRITE (6,FMT=8100) iter
WRITE (16,FMT=8100) iter
8100 FORMAT (/,10x,' iter= ',i5)
ENDIF !mpi%irank.eq.0
#ifdef CPP_MPI
CALL MPI_BCAST(input%total,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr)
#endif
input%total = .TRUE.
#ifdef CPP_MPI
CALL mpi_bc_potden(mpi,stars,sphhar,atoms,input,vacuum,oneD,noco,inDen)
#endif
IF ( noco%l_soc ) THEN
dimension%neigd2 = dimension%neigd*2
ELSE
dimension%neigd2 = dimension%neigd
END IF
dimension%neigd2 = dimension%neigd
IF (noco%l_soc) dimension%neigd2 = dimension%neigd*2
!HF
IF (hybrid%l_hybrid) THEN
SELECT TYPE(xcpot)
TYPE IS(t_xcpot_inbuild)
CALL calc_hybrid(hybrid,kpts,atoms,input,DIMENSION,mpi,noco,&
cell,oneD,results,sym,xcpot,vTot,it)
cell,oneD,results,sym,xcpot,vTot,iter)
END SELECT
ENDIF
!#endif
......@@ -240,82 +224,65 @@ CONTAINS
!---< gwf
CALL timestart("generation of potential")
CALL vgen( hybrid, field, input, xcpot, DIMENSION, atoms, sphhar, stars, vacuum, &
sym, obsolete, cell, oneD, sliceplot, mpi, results, noco, inDen, vTot, vx, &
vCoul )
CALL vgen(hybrid,field,input,xcpot,DIMENSION,atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi,results,noco,inDen,vTot,vx,vCoul)
CALL timestop("generation of potential")
#ifdef CPP_MPI
CALL MPI_BARRIER(mpi%mpi_comm,ierr)
#endif
CALL forcetheo%start()
forcetheoloop:DO WHILE(forcetheo%next_job(it==input%itmax,noco))
forcetheoloop:DO WHILE(forcetheo%next_job(iter==input%itmax,noco))
CALL timestart("generation of hamiltonian and diagonalization (total)")
CALL timestart("eigen")
vTemp = vTot
CALL enpara%update(mpi,atoms,vacuum,input,vToT)
CALL eigen(mpi,stars,sphhar,atoms,obsolete,xcpot,&
sym,kpts,DIMENSION,vacuum,input,cell,enpara,banddos,noco,oneD,hybrid,&
it,eig_id,results,inDen,vTemp,vx)
CALL eigen(mpi,stars,sphhar,atoms,obsolete,xcpot,sym,kpts,DIMENSION,vacuum,input,&
cell,enpara,banddos,noco,oneD,hybrid,iter,eig_id,results,inDen,vTemp,vx)
vTot%mmpMat = vTemp%mmpMat
!!$ eig_idList(pc) = eig_id
CALL timestop("eigen")
!
! add all contributions to total energy
!
! add all contributions to total energy
#ifdef CPP_MPI
! send all result of local total energies to the r
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))
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%valence,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
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))
ENDIF
! END IF
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))
END IF
#endif
! WRITE(6,fmt='(A)') 'Starting 2nd variation ...'
IF (noco%l_soc.AND..NOT.noco%l_noco) &
CALL eigenso(eig_id,mpi,DIMENSION,stars,vacuum,atoms,sphhar,&
obsolete,sym,cell,noco,input,kpts, oneD,vTot,enpara,results)
CALL eigenso(eig_id,mpi,DIMENSION,stars,vacuum,atoms,sphhar,&
obsolete,sym,cell,noco,input,kpts, oneD,vTot,enpara,results)
CALL timestop("generation of hamiltonian and diagonalization (total)")
#ifdef CPP_MPI
CALL MPI_BARRIER(mpi%mpi_comm,ierr)
#endif
!
! ----> fermi level and occupancies
IF ( noco%l_soc .AND. (.NOT. noco%l_noco) ) DIMENSION%neigd = 2*DIMENSION%neigd
IF ( (mpi%irank.EQ.0)) THEN
! fermi level and occupancies
IF (noco%l_soc.AND.(.NOT.noco%l_noco)) DIMENSION%neigd = 2*DIMENSION%neigd
IF ((mpi%irank.EQ.0)) THEN
CALL timestart("determination of fermi energy")
IF ( noco%l_soc .AND. (.NOT. noco%l_noco) ) THEN
IF (noco%l_soc.AND.(.NOT.noco%l_noco)) THEN
input%zelec = input%zelec*2
CALL fermie(eig_id,mpi,kpts,obsolete,&
input,noco,enpara%epara_min,cell,results)
CALL fermie(eig_id,mpi,kpts,obsolete,input,noco,enpara%epara_min,cell,results)
results%seigscv = results%seigscv/2
results%ts = results%ts/2
input%zelec = input%zelec/2
ELSE
CALL fermie(eig_id,mpi,kpts,obsolete,&
input,noco,enpara%epara_min,cell,results)
CALL fermie(eig_id,mpi,kpts,obsolete,input,noco,enpara%epara_min,cell,results)
ENDIF
CALL timestop("determination of fermi energy")
!!$
!!$ !+Wannier
!!$ IF(wann%l_bs_comf)THEN
!!$ IF(pc.EQ.1) THEN
......@@ -335,22 +302,19 @@ CONTAINS
!!$ END IF
!!$ END IF
!!$ !-Wannier
ENDIF
#ifdef CPP_MPI
CALL MPI_BCAST(results%ef,1,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(results%w_iks,SIZE(results%w_iks),MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
#endif
IF (forcetheo%eval(eig_id,DIMENSION,atoms,kpts,sym,&
cell,noco, input,mpi, oneD,enpara,vToT,results)) THEN
IF ( noco%l_soc .AND. (.NOT. noco%l_noco) ) DIMENSION%neigd=DIMENSION%neigd/2
IF (forcetheo%eval(eig_id,DIMENSION,atoms,kpts,sym,cell,noco,input,mpi,oneD,enpara,vToT,results)) THEN
IF (noco%l_soc.AND.(.NOT.noco%l_noco)) DIMENSION%neigd=DIMENSION%neigd/2
CYCLE forcetheoloop
ENDIF
CALL force_0(results)! ----> initialise force_old
! ----> charge density
CALL force_0(results)! ----> initialise force_old
!!$ !+Wannier functions
!!$ IF ((input%l_wann).AND.(.NOT.wann%l_bs_comf)) THEN
......@@ -361,19 +325,18 @@ CONTAINS
!!$ IF (wann%l_gwf) CALL juDFT_error("provide wann_inp if l_gwf=T", calledby = "fleur")
!!$ !-Wannier
! charge density generation
CALL timestart("generation of new charge density (total)")
CALL outDen%init(stars,atoms,sphhar,vacuum,input%jspins,noco%l_noco,POTDEN_TYPE_DEN)
outDen%iter = inDen%iter
CALL cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,&
DIMENSION,kpts,atoms,sphhar,stars,sym,&
enpara,cell,noco,vTot,results,oneD,coreSpecInput,&
archiveType,outDen)
CALL cdngen(eig_id,mpi,input,banddos,sliceplot,vacuum,DIMENSION,kpts,atoms,sphhar,stars,sym,&
enpara,cell,noco,vTot,results,oneD,coreSpecInput,archiveType,outDen)
IF (.FALSE.) CALL rdmft(eig_id,mpi,input,kpts,banddos,cell,atoms,enpara,stars,vacuum,dimension,&
sphhar,sym,field,vTot,oneD,noco,results)
IF ( noco%l_soc .AND. (.NOT. noco%l_noco) ) DIMENSION%neigd=DIMENSION%neigd/2
!+t3e
IF (noco%l_soc.AND.(.NOT.noco%l_noco)) DIMENSION%neigd=DIMENSION%neigd/2
#ifdef CPP_MPI
CALL MPI_BCAST(enpara%evac0,SIZE(enpara%evac0),MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
CALL MPI_BCAST(enpara%el0,SIZE(enpara%el0),MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr)
......@@ -392,8 +355,8 @@ CONTAINS
ENDIF
#endif
CALL timestop("generation of new charge density (total)")
IF (mpi%irank.EQ.0) THEN
!-t3e
!!$ !----> output potential and potential difference
!!$ IF (obsolete%disp) THEN
......@@ -407,14 +370,13 @@ CONTAINS
!!$ CALL potdis(stars,vacuum,atoms,sphhar, input,cell,sym)
!!$ END IF