Commit 32e0fc4c authored by Lorenzo Paulatto's avatar Lorenzo Paulatto

Merge branch 'develop' of gitlab.com:QEF/q-e into develop

parents 36cac41c 3484fbfc
This diff is collapsed.
......@@ -99,6 +99,8 @@
!! Check wheter this is the first cycle after a restart.
LOGICAL :: first_time
!! Check wheter this is the first timeafter a restart.
LOGICAL :: homogeneous
!! Check if the k and q grids are homogenous and commensurate.
!
CHARACTER (len=256) :: filint
!! Name of the file to write/read
......@@ -840,12 +842,19 @@
! Determines which q-points falls within the fsthick windows
! Store the result in the selecq.fmt file
! If the file exists, automatically restart from the file
! This is only done in the case of homogeneous grids.
! -----------------------------------------------------------------------
totq = 0
!
IF ( (nkf1 /= 0) .AND. (nkf2 /= 0) .AND. (nkf3 /= 0) .AND. (nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0) ) THEN
! Check if the grids are homogeneous and commensurate
homogeneous = .FALSE.
IF ( (nkf1 /= 0) .AND. (nkf2 /= 0) .AND. (nkf3 /= 0) .AND. &
(nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0) .AND. &
(MOD(nkf1,nqf1) == 0) .AND. (MOD(nkf2,nqf2) == 0) .AND. (MOD(nkf3,nqf3) == 0) ) THEN
homogeneous = .TRUE.
ELSE
homogeneous = .FALSE.
ENDIF
!
totq = 0
! Check if the file has been pre-computed
IF (mpime == ionode_id) THEN
INQUIRE(FILE='selecq.fmt',EXIST=exst)
......@@ -856,30 +865,22 @@
IF (selecqread) THEN
WRITE(stdout,'(5x,a)')' '
WRITE(stdout,'(5x,a)')'Reading selecq.fmt file. '
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq, homogeneous)
ELSE
WRITE(stdout,'(5x,a)')' '
WRITE(stdout,'(5x,a)')'A selecq.fmt file was found but re-created because selecqread == .false. '
CALL qwindow(.FALSE., nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
CALL qwindow(.FALSE., nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq, homogeneous)
ENDIF
ELSE ! exst
IF (selecqread) THEN
CALL errore( 'ephwann_shuffle', 'Variable selecqread == .true. but file selecq.fmt not found.',1 )
ELSE
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq, homogeneous)
ENDIF
ENDIF
!
WRITE(stdout,'(5x,a,i8,a)')'We only need to compute ',totq, ' q-points'
WRITE(stdout,'(5x,a)')' '
ELSE
! If Random points or points read from files, then take all.
totq = nqf
ALLOCATE(selecq(totq))
DO iq = 1, totq
selecq(iq) = iq
ENDDO
ENDIF ! homogeneous grids
!
! -----------------------------------------------------------------------
! Possible restart during step 1)
......
......@@ -100,6 +100,8 @@
!! Check wheter this is the first cycle after a restart.
LOGICAL :: first_time
!! Check wheter this is the first timeafter a restart.
LOGICAL :: homogeneous
!! Check if the k and q grids are homogenous and commensurate.
!
CHARACTER (len=256) :: filint
!! Name of the file to write/read
......@@ -809,11 +811,19 @@
! Determines which q-points falls within the fsthick windows
! Store the result in the selecq.fmt file
! If the file exists, automatically restart from the file
! This is only done in the case of homogeneous grids.
! -----------------------------------------------------------------------
totq = 0
!
IF ( (nkf1 /= 0) .AND. (nkf2 /= 0) .AND. (nkf3 /= 0) .AND. (nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0) ) THEN
! Check if the grids are homogeneous and commensurate
homogeneous = .FALSE.
IF ( (nkf1 /= 0) .AND. (nkf2 /= 0) .AND. (nkf3 /= 0) .AND. &
(nqf1 /= 0) .AND. (nqf2 /= 0) .AND. (nqf3 /= 0) .AND. &
(MOD(nkf1,nqf1) == 0) .AND. (MOD(nkf2,nqf2) == 0) .AND. (MOD(nkf3,nqf3) == 0) ) THEN
homogeneous = .TRUE.
ELSE
homogeneous = .FALSE.
ENDIF
!
totq = 0
!
! Check if the file has been pre-computed
IF (mpime == ionode_id) THEN
......@@ -825,29 +835,22 @@
IF (selecqread) THEN
WRITE(stdout,'(5x,a)')' '
WRITE(stdout,'(5x,a)')'Reading selecq.fmt file. '
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq, homogeneous)
ELSE
WRITE(stdout,'(5x,a)')' '
WRITE(stdout,'(5x,a)')'A selecq.fmt file was found but re-created because selecqread == .false. '
CALL qwindow(.FALSE., nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
CALL qwindow(.FALSE., nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq, homogeneous)
ENDIF
ELSE ! exst
IF (selecqread) THEN
CALL errore( 'ephwann_shuffle', 'Variable selecqread == .true. but file selecq.fmt not found.',1 )
ELSE
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
CALL qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq, homogeneous)
ENDIF
ENDIF
!
WRITE(stdout,'(5x,a,i8,a)')'We only need to compute ',totq, ' q-points'
WRITE(stdout,'(5x,a)')' '
ELSE
totq = nqf
ALLOCATE(selecq(totq))
DO iq = 1, totq
selecq(iq) = iq
ENDDO
ENDIF ! homogeneous grids
!
! -----------------------------------------------------------------------
! Possible restart during step 1)
......
......@@ -17,7 +17,8 @@
CONTAINS
!
!-----------------------------------------------------------------------
SUBROUTINE qwindow(exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, cufkk, cufkq)
SUBROUTINE qwindow( exst, nrr_k, dims, totq, selecq, irvec_r, ndegen_k, &
cufkk, cufkq, homogeneous )
!-----------------------------------------------------------------------
!!
!! This subroutine pre-computes the q-points that falls within the fstichk
......@@ -33,7 +34,7 @@
USE mp, ONLY : mp_sum, mp_bcast
USE constants_epw, ONLY : twopi, ci, zero
USE epwcom, ONLY : nbndsub, fsthick, use_ws, mp_mesh_k, nkf1, nkf2, &
nkf3, iterative_bte
nkf3, iterative_bte, restart_freq
USE pwcom, ONLY : ef
USE cell_base, ONLY : bg
USE symm_base, ONLY : s, t_rev, time_reversal, set_sym_bl, nrot
......@@ -44,6 +45,8 @@
!
LOGICAL, INTENT(in) :: exst
!! If the file exist
LOGICAL, INTENT(in) :: homogeneous
!! Check if the grids are homogeneous and commensurate
INTEGER, INTENT(IN) :: nrr_k
!! Number of WS points for electrons
INTEGER, INTENT(IN) :: dims
......@@ -66,7 +69,7 @@
!! integer variable for I/O control
INTEGER :: iq
!! Counter on coarse q-point grid
INTEGER :: ik, ikk, ikq
INTEGER :: ik, ikk, ikq, ikl
!! Counter on coarse k-point grid
INTEGER :: found(npool)
!! Indicate if a q-point was found within the window
......@@ -92,6 +95,10 @@
!! BZ to IBZ mapping
INTEGER :: s_BZtoIBZ(3,3,nkf1*nkf2*nkf3)
!! symmetry
INTEGER :: nkloc
!! number of k-point selected on that cpu
INTEGER :: kmap(nkf)
!! k-point that are selected for that cpu
!
REAL(kind=DP) :: xxq(3)
!! Current q-point
......@@ -105,8 +112,12 @@
!! $r\cdot k$
REAL(kind=DP) :: etf_loc(nbndsub, nkf)
!! Eigen-energies all full k-grid.
REAL(kind=DP) :: etf_locq(nbndsub, nkf)
!! Eigen-energies all full k-grid.
REAL(kind=DP) :: etf_all(nbndsub, nkqtotf/2)
!! Eigen-energies all full k-grid.
REAL(kind=DP) :: etf_tmp(nbndsub)
!! Temporary Eigen-energies at a give k-point
REAL(kind=DP) :: xkf_tmp (3, nkqtotf)
!! Temporary k-point coordinate (dummy variable)
REAL(kind=DP) :: wkf_tmp(nkqtotf)
......@@ -138,15 +149,17 @@
CALL mp_bcast(selecq, ionode_id, world_comm )
IF (nqtot /= nqtotf) THEN
CALL errore( 'qwindow', 'Cannot read from selecq.fmt, the q-point grid or &
fsthick window are different from read one. Remove the selecq.fmt file and restart. ',1 )
& fsthick window are different from read one. Remove the selecq.fmt file and restart.',1 )
ENDIF
!
ELSE
ALLOCATE(selecq(nqf))
selecq(:) = 0
etf_loc(:,:) = zero
etf_locq(:,:) = zero
etf_all(:,:) = zero
!
IF (homogeneous) THEN
! First store eigen energies on full grid.
DO ik = 1, nkf
ikk = 2 * ik - 1
......@@ -230,12 +243,112 @@
totq = totq + 1
selecq(totq) = iq
!
IF (MOD(totq,500) == 0) THEN
IF (MOD(totq,restart_freq) == 0) THEN
WRITE(stdout,'(5x,a,i8,i8)')'Number selected, total',totq,iq
ENDIF
ENDIF
ENDDO ! iq
ELSE ! homogeneous
! First compute the k-points eigenenergies for efficiency reasons
nkloc = 0
kmap(:) = 0
DO ik = 1, nkf
ikk = 2 * ik - 1
xkk = xkf(:, ikk)
CALL dgemv('t', 3, nrr_k, twopi, irvec_r, 3, xkk, 1, 0.0_DP, rdotk, 1 )
IF (use_ws) THEN
DO iw=1, dims
DO iw2=1, dims
DO ir = 1, nrr_k
IF (ndegen_k(ir,iw2,iw) > 0) THEN
cfac(ir,iw2,iw) = exp( ci*rdotk(ir) ) / ndegen_k(ir,iw2,iw)
ENDIF
ENDDO
ENDDO
ENDDO
ELSE
cfac(:,1,1) = exp( ci*rdotk(:) ) / ndegen_k(:,1,1)
ENDIF
CALL hamwan2bloch ( nbndsub, nrr_k, cufkk, etf_tmp(:), chw, cfac, dims)
!
! Check for the k-points in this pool
IF ( minval ( abs(etf_tmp(:) - ef) ) < fsthick ) THEN
nkloc = nkloc + 1
kmap(nkloc) = ik
ENDIF
ENDDO ! k-points
!
! Now compute the q-loop doing WS separately for efficiency
IF (use_ws) THEN
DO iq=1, nqf
xxq = xqf (:, iq)
etf_tmp(:) = zero
found(:) = 0
DO ikl = 1, nkloc
ik = kmap(ikl)
ikk = 2 * ik - 1
xkk = xkf(:, ikk)
xkq = xkk + xxq
CALL dgemv('t', 3, nrr_k, twopi, irvec_r, 3, xkq, 1, 0.0_DP, rdotk, 1 )
DO iw=1, dims
DO iw2=1, dims
DO ir = 1, nrr_k
IF (ndegen_k(ir,iw2,iw) > 0) THEN
cfacq(ir,iw2,iw) = exp( ci*rdotk(ir) ) / ndegen_k(ir,iw2,iw)
ENDIF
ENDDO
ENDDO
ENDDO
CALL hamwan2bloch ( nbndsub, nrr_k, cufkq, etf_tmp(:), chw, cfacq, dims)
!
IF ( minval ( abs(etf_tmp(:) - ef) ) < fsthick ) THEN
found(my_pool_id+1) = 1
EXIT ! exit the loop
ENDIF
ENDDO ! ik
! If found on any k-point from the pools
CALL mp_sum(found, world_comm)
IF (SUM(found(:) ) > 0) THEN
totq = totq +1
selecq(totq) = iq
IF (MOD(totq,restart_freq) == 0) THEN
WRITE(stdout,'(5x,a,i8,i8)')'Number selected, total',totq,iq
ENDIF
ENDIF
ENDDO ! iq
ELSE ! use_ws
DO iq=1, nqf
xxq = xqf (:, iq)
etf_tmp(:) = zero
found(:) = 0
DO ikl = 1, nkloc
ik = kmap(ikl)
ikk = 2 * ik - 1
xkk = xkf(:, ikk)
xkq = xkk + xxq
CALL dgemv('t', 3, nrr_k, twopi, irvec_r, 3, xkq, 1, 0.0_DP, rdotk, 1 )
cfacq(:,1,1) = exp( ci*rdotk(:) ) / ndegen_k(:,1,1)
CALL hamwan2bloch ( nbndsub, nrr_k, cufkq, etf_tmp(:), chw, cfacq, dims)
!
IF ( minval ( abs(etf_tmp(:) - ef) ) < fsthick ) THEN
found(my_pool_id+1) = 1
EXIT ! exit the loop
ENDIF
ENDDO ! ik
! If found on any k-point from the pools
CALL mp_sum(found, world_comm)
IF (SUM(found(:) ) > 0) THEN
totq = totq +1
selecq(totq) = iq
IF (MOD(totq,restart_freq) == 0) THEN
WRITE(stdout,'(5x,a,i8,i8)')'Number selected, total',totq,iq
ENDIF
ENDIF
ENDDO ! iq
!
ENDIF ! use_ws
ENDIF ! homogeneous
!
IF (mpime == ionode_id) THEN
OPEN(unit=iunselecq, file='selecq.fmt', action='write')
WRITE (iunselecq,*) totq ! Selected number of q-points
......
......@@ -525,7 +525,7 @@ SUBROUTINE punch_plottable_bands ( filband, nks1tot, nks2tot, nkstot, nbnd, &
IMPLICIT NONE
CHARACTER(LEN=*), INTENT(IN) :: filband
INTEGER, INTENT(IN) :: nks1tot, nks2tot, nkstot, nbnd
REAL(dp), INTENT(IN) :: xk(3,nkstot), et(nbnd,nks1tot)
REAL(dp), INTENT(IN) :: xk(3,nkstot), et(nbnd,nkstot)
!
INTEGER, PARAMETER :: max_lines = 100, stdout=6, iunpun0=18
INTEGER:: ios, i, n, nlines, npoints(max_lines), point(max_lines)
......
......@@ -60,7 +60,7 @@
phonselfen = .false.
a2f = .false.
fsthick = 1.2 ! eV
fsthick = 2.0 ! eV
eptemp = 1 ! K
degaussw = 0.05 ! eV
......
......@@ -60,7 +60,7 @@
phonselfen = .false.
a2f = .false.
fsthick = 1.2 ! eV
fsthick = 2.0 ! eV
eptemp = 1 ! K
degaussw = 0.05 ! eV
......
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