Commit 26e25508 authored by Samuel Poncé's avatar Samuel Poncé

Courtesy of R. Margine

1) Beautification
2) Added super for "exclude band" feature of Wannier90 inside EPW
3) Computation of the velocity beyond the local approximation.
parent a0e50a5b
This diff is collapsed.
......@@ -55,6 +55,7 @@
!
REAL(DP), PARAMETER :: eps2 = 1.0E-2_DP
REAL(DP), PARAMETER :: eps4 = 1.0E-4_DP
REAL(DP), PARAMETER :: eps5 = 1.0E-5_DP
REAL(DP), PARAMETER :: eps6 = 1.0E-6_DP
REAL(DP), PARAMETER :: eps8 = 1.0E-8_DP
REAL(DP), PARAMETER :: eps12 = 1.0E-12_DP
......
......@@ -110,6 +110,7 @@
LOGICAL, allocatable :: &
lwin(:,:), &! identify bands within outer energy windows (when disentanglement is used)
lwinq(:,:), &!
exband(:), &! k-point independent list of bands excluded from the calculation of overlap and projection matrices in W90
done_elph(:)
LOGICAL :: &
elph
......
......@@ -144,8 +144,8 @@
CALL zgemv ('n', nmodes, nmodes, cone, u , nmodes, &
el_ph_mat (ibnd,jbnd,ik,:), 1, czero, epmatq (ibnd,jbnd,ik,:,iq), 1)
ELSE
CALL zgemv ('n', nmodes, nmodes, cone, CONJG ( u ), nmodes, &
el_ph_mat (ibnd,jbnd,ik,:), 1, czero, epmatq (ibnd,jbnd,ik,:,iq), 1 )
CALL zgemv ('n', nmodes, nmodes, cone, CONJG( u ), nmodes, &
el_ph_mat (ibnd,jbnd,ik,:), 1, czero, epmatq (ibnd,jbnd,ik,:,iq), 1 )
ENDIF
!
ENDDO
......
......@@ -19,12 +19,13 @@
!!
!-----------------------------------------------------------------------
!
USE kinds, ONLY : DP
USE mp_global, ONLY : my_pool_id, inter_pool_comm, &
npool, inter_image_comm,&
world_comm
npool, inter_image_comm, world_comm
USE mp_images, ONLY : my_image_id, nimage
USE mp_world, ONLY : mpime
USE mp, ONLY : mp_barrier, mp_bcast
USE io_global, ONLY : meta_ionode, meta_ionode_id
USE io_global, ONLY : stdout, meta_ionode, meta_ionode_id
USE us, ONLY : nqxq, dq, qrad
USE gvect, ONLY : gcutm, ngm
USE cellmd, ONLY : cell_factor
......@@ -33,9 +34,7 @@
USE wavefunctions_module, ONLY: evc
USE ions_base, ONLY : nat, nsp, tau, ityp
USE control_flags, ONLY : iverbosity
USE io_global, ONLY : stdout
USE io_epw, ONLY : iuepb, QPeig_read
USE kinds, ONLY : DP
USE pwcom, ONLY : et, xk, nks, nbnd, nkstot
USE cell_base, ONLY : at, bg
USE symm_base, ONLY : irt, s, nsym, ftau, sname, invs, s_axis_to_cart,&
......@@ -43,15 +42,14 @@
remove_sym, allfrac
USE start_k, ONLY : nk1, nk2, nk3
USE phcom, ONLY : dpsi, dvpsi, evq, nq1, nq3, nq2
USE qpoint, ONLY : igkq
USE qpoint, ONLY : xq
USE qpoint, ONLY : igkq, xq
USE modes, ONLY : nmodes
USE lr_symm_base, ONLY : minus_q, rtau, gi, gimq, irotmq, nsymq, invsymq
USE epwcom, ONLY : epbread, epbwrite, epwread, lifc, etf_mem, &
USE epwcom, ONLY : epbread, epbwrite, epwread, lifc, etf_mem, vme, &
nbndsub, iswitch, kmaps, eig_read, dvscf_dir, lpolar
USE elph2, ONLY : epmatq, dynq, sumr, et_all, xk_all, et_mb, et_ks, &
zstar, epsi, cu, cuq, lwin, lwinq, bmat, igk_k_all, &
ngk_all
ngk_all, exband
USE constants_epw, ONLY : ryd2ev
USE fft_base, ONLY : dfftp
USE control_ph, ONLY : u_from_file
......@@ -99,10 +97,16 @@
!! Temporary integer for max value
integer :: nqxq_tmp
!! Maximum G+q length ?
integer :: ibnd
!! Band index
integer :: ik
!! Total k-point index
integer :: ios
!! Contains the state of the opened file
integer :: dummy1
!! Dummy variable
integer :: dummy2
!! Dummy variable
integer :: ik_start
!! Lower bound for the k-point of the coarse grid in parallel
integer :: ik_stop
......@@ -221,23 +225,23 @@
IF ( .not. ALLOCATED(et_mb) ) ALLOCATE(et_mb(nbnd,nks))
et_ks(:,:) = 0.d0
et_mb(:,:) = 0.d0
IF (eig_read) then
IF (meta_ionode) THEN
WRITE (stdout,'(5x,a,i5,a,i5,a)') "Reading external electronic eigenvalues (", &
nbnd, ",", nkstot,")"
tempfile=trim(prefix)//'.eig'
OPEN(QPeig_read, file=tempfile, form='formatted', action='read', iostat=ios)
IF (ios /= 0) CALL errore ('elphon_shuffle_wrap','error opening' // tempfile, 1)
READ (QPeig_read,'(a)') line
DO ik = 1, nkstot
! We do not save the k-point for the moment ==> should be read and
! tested against the current one
IF (eig_read) THEN
IF (meta_ionode) THEN
WRITE (stdout,'(5x,a,i5,a,i5,a)') "Reading external electronic eigenvalues (", &
nbnd, ",", nkstot,")"
tempfile=trim(prefix)//'.eig'
OPEN(QPeig_read, file=tempfile, form='formatted', action='read', iostat=ios)
IF (ios /= 0) CALL errore ('elphon_shuffle_wrap','error opening' // tempfile, 1)
READ (QPeig_read,'(a)') line
READ (QPeig_read,*) et_tmp (:,ik)
ENDDO
CLOSE(QPeig_read)
! from eV to Ryd
et_tmp = et_tmp / ryd2ev
DO ik = 1, nkstot
! We do not save the k-point for the moment ==> should be read and
! tested against the current one
READ (QPeig_read,'(a)') line
READ (QPeig_read,*) et_tmp (:,ik)
ENDDO
CLOSE(QPeig_read)
! from eV to Ryd
et_tmp = et_tmp / ryd2ev
ENDIF
CALL mp_bcast (et_tmp, meta_ionode_id, world_comm)
!
......@@ -248,11 +252,11 @@
ENDIF
!
! Do not recompute dipole matrix elements
IF ( epwread .and. .not. epbread ) then
IF ( epwread .and. .not. epbread ) THEN
continue
ELSE
! compute coarse grid dipole matrix elements. Very fast
CALL compute_pmn_para
! compute coarse grid dipole matrix elements. Very fast
IF (.not. vme) CALL compute_pmn_para
ENDIF
!
! gather electronic eigenvalues for subsequent shuffle
......@@ -281,7 +285,7 @@
CALL mp_barrier(inter_image_comm)
!
! Do not do symmetry stuff
IF ( epwread .and. .not. epbread ) then
IF ( epwread .and. .not. epbread ) THEN
CONTINUE
ELSE
!
......@@ -291,7 +295,7 @@
epmatq (nbnd, nbnd, nks, nmodes, nq1*nq2*nq3), &
epsi(3,3), zstar(3,3,nat), bmat(nbnd, nbnd, nks, nq1*nq2*nq3), &
cu ( nbnd, nbndsub, nks), cuq ( nbnd, nbndsub, nks), &
lwin ( nbnd, nks ), lwinq ( nbnd, nks ) )
lwin ( nbnd, nks ), lwinq ( nbnd, nks ) , exband (nbnd ) )
!
epsi=0.d0
zstar=0.d0
......@@ -583,7 +587,7 @@
!END
!
!
CALL loadumat ( nbnd, nbndsub, nks, nkstot, xq, cu, cuq, lwin, lwinq )
CALL loadumat ( nbnd, nbndsub, nks, nkstot, xq, cu, cuq, lwin, lwinq, exband )
!
! Calculate overlap U_k+q U_k^\dagger
IF (lpolar) CALL compute_umn_c ( nbnd, nbndsub, nks, cu, cuq, bmat(:,:,:,nqc) )
......@@ -601,10 +605,9 @@
! bring epmatq in the mode representation of iq_first,
! and then in the cartesian representation of iq
!
CALL rotate_eigenm ( iq_first, nqc, isym, s, invs, irt, &
rtau, xq, cz1, cz2 )
CALL rotate_eigenm ( iq_first, nqc, isym, s, invs, irt, rtau, xq, cz1, cz2 )
!
CALL rotate_epmat ( cz1, cz2, xq, nqc, lwin, lwinq )
CALL rotate_epmat ( cz1, cz2, xq, nqc, lwin, lwinq, exband )
!DBSP
! write(*,*)'epmatq(:,:,2,:,nqc)',SUM(epmatq(:,:,2,:,nqc))
! write(*,*)'epmatq(:,:,2,:,nqc)**2',SUM((REAL(REAL(epmatq(:,:,2,:,nqc))))**2)+&
......@@ -636,7 +639,7 @@
!
xq0 = -xq0
!
CALL loadumat ( nbnd, nbndsub, nks, nkstot, xq, cu, cuq, lwin, lwinq )
CALL loadumat ( nbnd, nbndsub, nks, nkstot, xq, cu, cuq, lwin, lwinq, exband )
!
! Calculate overlap U_k+q U_k^\dagger
IF (lpolar) CALL compute_umn_c ( nbnd, nbndsub, nks, cu, cuq, bmat(:,:,:,nqc) )
......@@ -646,10 +649,9 @@
! bring epmatq in the mode representation of iq_first,
! and then in the cartesian representation of iq
!
CALL rotate_eigenm ( iq_first, nqc, isym, s, invs, irt, &
rtau, xq, cz1, cz2 )
CALL rotate_eigenm ( iq_first, nqc, isym, s, invs, irt, rtau, xq, cz1, cz2 )
!
CALL rotate_epmat ( cz1, cz2, xq, nqc, lwin, lwinq )
CALL rotate_epmat ( cz1, cz2, xq, nqc, lwin, lwinq, exband )
!
!DBSP
! write(*,*)'epmatq(:,:,2,:,nqc)',SUM(epmatq(:,:,2,:,nqc))
......@@ -730,19 +732,20 @@
!
! free up some memory
!
IF ( ASSOCIATED (evq) ) NULLIFY (evq)
IF ( ALLOCATED (evc) ) DEALLOCATE (evc)
IF ( ASSOCIATED (igkq) ) NULLIFY (igkq)
IF ( ALLOCATED (dvpsi)) DEALLOCATE (dvpsi)
IF ( ALLOCATED (dpsi) ) DEALLOCATE (dpsi)
IF ( ALLOCATED (sumr) ) DEALLOCATE (sumr)
IF ( ALLOCATED (cu) ) DEALLOCATE (cu)
IF ( ALLOCATED (cuq) ) DEALLOCATE (cuq)
IF ( ALLOCATED (lwin) ) DEALLOCATE (lwin)
IF ( ALLOCATED (lwinq) ) DEALLOCATE (lwinq)
IF ( ALLOCATED (bmat) ) DEALLOCATE (bmat)
IF ( ALLOCATED (igk_k_all) ) DEALLOCATE(igk_k_all)
IF ( ALLOCATED (ngk_all) ) DEALLOCATE(ngk_all)
IF ( ASSOCIATED (evq) ) NULLIFY (evq)
IF ( ALLOCATED (evc) ) DEALLOCATE (evc)
IF ( ASSOCIATED (igkq) ) NULLIFY (igkq)
IF ( ALLOCATED (dvpsi)) DEALLOCATE (dvpsi)
IF ( ALLOCATED (dpsi) ) DEALLOCATE (dpsi)
IF ( ALLOCATED (sumr) ) DEALLOCATE (sumr)
IF ( ALLOCATED (cu) ) DEALLOCATE (cu)
IF ( ALLOCATED (cuq) ) DEALLOCATE (cuq)
IF ( ALLOCATED (lwin) ) DEALLOCATE (lwin)
IF ( ALLOCATED (lwinq) ) DEALLOCATE (lwinq)
IF ( ALLOCATED (bmat) ) DEALLOCATE (bmat)
IF ( ALLOCATED (igk_k_all) ) DEALLOCATE (igk_k_all)
IF ( ALLOCATED (ngk_all) ) DEALLOCATE (ngk_all)
IF ( ALLOCATED (exband) ) DEALLOCATE (exband)
!
CALL stop_clock ( 'elphon_wrap' )
!DBSP
......
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,7 @@
USE disp, ONLY : nq1, nq2, nq3
USE output, ONLY : fildvscf, fildrho
USE epwcom, ONLY : delta_smear, nsmear, dis_win_min, dis_win_max, wannierize, &
ngaussw, dvscf_dir, eptemp, wdata, &
ngaussw, dvscf_dir, eptemp, bands_skipped, wdata, &
num_iter, dis_froz_max, fsthick, dis_froz_min, &
vme, degaussw, epexst, eig_read, kmaps, &
epwwrite, epbread, phonselfen, elecselfen, &
......@@ -105,8 +105,8 @@
degaussw, fsthick, eptemp, nsmear, delta_smear, &
dvscf_dir, ngaussw, &
wannierize, dis_win_max, dis_win_min, dis_froz_min, dis_froz_max, &
num_iter, proj, wdata, iprint, write_wfn, wmin, wmax, nw, &
eps_acustic, a2f, nest_fn, plselfen, &
num_iter, proj, bands_skipped, wdata, iprint, write_wfn, &
wmin, wmax, nw, eps_acustic, a2f, nest_fn, plselfen, &
elecselfen, phonselfen, parallel_k, parallel_q, &
rand_q, rand_nq, rand_k, rand_nk, specfun_pl, &
nqf1, nqf2, nqf3, nkf1, nkf2, nkf3, &
......@@ -171,6 +171,7 @@
! dis_froz_max : upper bound on frozen wannier90 disentanglement window
! num_iter : number of iterations used in the wannier90 minimisation
! proj : initial projections (states) of the wannier functions before minimization
! bands_skipped: k-point independent list of bands excluded from the calculation of overlap and projection matrices in W90
! wdata : Empty array that can be used to pass extra info to prefix.win file, for things not explicitly declared here
! iprint : verbosity of the wannier90 code
! write_wfn : writes out UNK files from pwscf run for plotting of XSF files
......@@ -349,6 +350,7 @@
dis_froz_min = -1d3
num_iter = 200
proj(:) = ''
bands_skipped= ''
wdata(:) = ''
iprint = 2
wmin = 0.d0
......
......@@ -299,8 +299,13 @@
!! directory for .dvscf and .dyn files (wannier interpolation)
CHARACTER(len=80) :: fileig
!! output file for the electron-phonon coefficients
CHARACTER(len=256), dimension(200) :: proj, wdata
!! projections and any extra info for W90
CHARACTER(len=256), dimension(200) :: proj
!! projections for W90
CHARACTER(len=256) :: bands_skipped
!! k-point independent list of bands excluded from the calculation
!! of overlap and projection matrices in W90
CHARACTER(len=256), dimension(200) :: wdata
!! any extra info for W90
CHARACTER(LEN=75) :: title
!! ... title of the simulation
CHARACTER(LEN=10) :: asr_typ
......
......@@ -23,9 +23,19 @@
USE pwcom, ONLY : ef
USE mp, ONLY : mp_max, mp_min
USE mp_global, ONLY : inter_pool_comm
!
implicit none
integer :: ik, ibnd
real(kind=DP) :: ebnd, ebndmin, ebndmax
!
integer :: ik
!! Counter on k-points in the pool
integer :: ibnd
!! Counter on bands
real(kind=DP) :: ebnd
!! Eigenvalue at etf(ibnd,ik)
real(kind=DP) :: ebndmin
!! Minimum eigenvalue
real(kind=DP) :: ebndmax
!! Maximum eigenvalue
real(kind=DP) :: tmp
!
!
......
......@@ -16,26 +16,21 @@
!!
!-----------------------------------------------------------------------
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE io_global, ONLY : stdout, ionode_id
USE io_epw, ONLY : iuindabs
USE phcom, ONLY : nmodes
USE epwcom, ONLY : nbndsub, lrepmatf, shortrange, &
fsthick, eptemp, ngaussw, degaussw, &
eps_acustic, efermi_read, fermi_energy,&
restart, restart_freq, &
omegamin, omegamax, omegastep, n_r, scissor
USE pwcom, ONLY : ef !, nelec, isk
vme, omegamin, omegamax, omegastep, n_r, scissor
USE elph2, ONLY : etf, ibndmin, ibndmax, nkqf, xqf, &
nkf, epf17, wkf, nqtotf, wf, wqf, xkf, nkqtotf, &
sigmar_all, sigmai_all, sigmai_mode, zi_all, efnew, &
sigmar_all, sigmai_all, sigmai_mode, efnew, &
dmef, omegap, alpha_abs, vmef, etf_ks
USE transportcom, ONLY : lower_bnd, upper_bnd
USE control_flags, ONLY : iverbosity
USE constants_epw, ONLY : ryd2mev, one, ryd2ev, two, zero, pi, ci, eps6, czero
USE mp, ONLY : mp_barrier, mp_sum
USE mp_global, ONLY : inter_pool_comm
USE mp_world, ONLY : mpime
USE io_global, ONLY : ionode_id
USE cell_base, ONLY : omega
!
implicit none
......@@ -217,21 +212,45 @@
END IF
END DO
!
DO ibnd = 1, ibndmax-ibndmin+1
DO jbnd = 1, ibndmax-ibndmin+1
IF (ABS(scissor) > 0.000001 .AND. &
ABS( etf_ks(ibndmin-1+ibnd,ikk)-etf_ks(ibndmin-1+jbnd,ikk)) > 0.000001 .AND. &
ABS( etf_ks(ibndmin-1+ibnd,ikq)-etf_ks(ibndmin-1+jbnd,ikq)) > 0.000001 ) THEN
vkk(:,ibnd,jbnd) = 2.0 * dmef (:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikk) &
*( etf(ibndmin-1+ibnd,ikk)-etf(ibndmin-1+jbnd,ikk))/( etf_ks(ibndmin-1+ibnd,ikk)-etf_ks(ibndmin-1+jbnd,ikk))
vkq(:,ibnd,jbnd) = 2.0 * dmef (:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikq) &
*( etf(ibndmin-1+ibnd,ikq)-etf(ibndmin-1+jbnd,ikq))/( etf_ks(ibndmin-1+ibnd,ikq)-etf_ks(ibndmin-1+jbnd,ikq))
ELSE
vkk(:,ibnd,jbnd) = 2.0 * dmef (:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikk)
vkq(:,ibnd,jbnd) = 2.0 * dmef (:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikq)
END IF
! RM - vme version should be checked
IF ( vme ) THEN
DO ibnd = 1, ibndmax-ibndmin+1
DO jbnd = 1, ibndmax-ibndmin+1
! vmef is in units of Ryd * bohr
IF (ABS(scissor) > eps6 .AND. &
ABS( etf_ks(ibndmin-1+ibnd,ikk)-etf_ks(ibndmin-1+jbnd,ikk)) > eps6 .AND. &
ABS( etf_ks(ibndmin-1+ibnd,ikq)-etf_ks(ibndmin-1+jbnd,ikq)) > eps6 ) THEN
vkk(:,ibnd,jbnd) = vmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikk) &
* ( etf(ibndmin-1+ibnd,ikk) - etf(ibndmin-1+jbnd,ikk) ) &
/ ( etf_ks(ibndmin-1+ibnd,ikk) - etf_ks(ibndmin-1+jbnd,ikk) )
vkq(:,ibnd,jbnd) = vmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd,ikq) &
* ( etf(ibndmin-1+ibnd,ikq) - etf(ibndmin-1+jbnd,ikq) ) &
/ ( etf_ks(ibndmin-1+ibnd,ikq) - etf_ks(ibndmin-1+jbnd,ikq) )
ELSE
vkk(:,ibnd,jbnd) = vmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikk)
vkq(:,ibnd,jbnd) = vmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikq)
END IF
END DO
END DO
END DO
ELSE
DO ibnd = 1, ibndmax-ibndmin+1
DO jbnd = 1, ibndmax-ibndmin+1
IF (ABS(scissor) > eps6 .AND. &
ABS( etf_ks(ibndmin-1+ibnd,ikk)-etf_ks(ibndmin-1+jbnd,ikk)) > eps6 .AND. &
ABS( etf_ks(ibndmin-1+ibnd,ikq)-etf_ks(ibndmin-1+jbnd,ikq)) > eps6 ) THEN
vkk(:,ibnd,jbnd) = 2.0 * dmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikk) &
* ( etf(ibndmin-1+ibnd,ikk) - etf(ibndmin-1+jbnd,ikk) ) &
/ ( etf_ks(ibndmin-1+ibnd,ikk) - etf_ks(ibndmin-1+jbnd,ikk) )
vkq(:,ibnd,jbnd) = 2.0 * dmef (:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikq) &
* ( etf(ibndmin-1+ibnd,ikq) - etf(ibndmin-1+jbnd,ikq) ) &
/ ( etf_ks(ibndmin-1+ibnd,ikq) - etf_ks(ibndmin-1+jbnd,ikq) )
ELSE
vkk(:,ibnd,jbnd) = 2.0 * dmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikk)
vkq(:,ibnd,jbnd) = 2.0 * dmef(:, ibndmin-1+ibnd, ibndmin-1+jbnd, ikq)
END IF
END DO
END DO
ENDIF
!
DO ibnd = 1, ibndmax-ibndmin+1
! the energy of the electron at k (relative to Ef)
......
......@@ -29,7 +29,8 @@
iufilfreq, iufilegnv, iufileph, iufilkqmap, &
iufilikmap, iueig, iunepmatwp, iunepmatwe, iunkf, iunqf, &
iufileig, iukmap, crystal, iunifc, iunimem, iunepmatwp2
PUBLIC :: iuwinfil, iun_plot, iuukk, iuprojfil !, iummn
PUBLIC :: iuwinfil, iun_plot, iuukk, iuprojfil, iudecayH, iudecayP, &
iudecaydyn, iudecayv, iummn, iubvec
PUBLIC :: iufilsigma, iufilseebeck, iufilkappael, iufilkappa, iufilscatt_rate,&
iufilFi_all, iufilsigma_all, iufiltau_all, iuindabs
!
......@@ -105,12 +106,17 @@
!
INTEGER :: iuwinfil = 201 ! Wannier projectors and other quantities
! SP : Not used for now but could be in the future. Would require the amn as well.
! INTEGER :: iummn = 202 ! Overlap of the cell periodic part of the Bloch
INTEGER :: iummn = 202 ! Overlap of the cell periodic part of the Bloch
! states <u_nmk|u_nk+b>
INTEGER :: iun_plot = 203 ! UNK file (needed by Wannier90 for plotting the
! real space Wannier functions)
INTEGER :: iuukk = 204 ! Final ukk rotation matrix (the big U!)
INTEGER :: iuprojfil = 205 ! Unit for projector [.projw90]
INTEGER :: iudecayH = 206 ! Hamiltonian decay in real space
INTEGER :: iudecayP = 207 ! Dipole decay in real space
INTEGER :: iudecaydyn = 208 ! Dynamical matrix decay in real space
INTEGER :: iudecayv = 209 ! Velocity matrix decay in real space
INTEGER :: iubvec = 206 ! b-vectors and their weight wb
!
! Output quantites related to transport (251-300)
INTEGER :: iufilsigma = 251 ! Electrical conductivity
......
......@@ -13,12 +13,11 @@ SUBROUTINE loadkmesh_para
!! load fine k mesh and distribute among pools
!!
!-----------------------------------------------------------------------
USE io_global, ONLY : ionode_id
USE io_global, ONLY : ionode_id, stdout
USE mp_global, ONLY : inter_pool_comm, my_pool_id, npool
USE mp, ONLY : mp_bcast, mp_sum
USE mp_world, ONLY : mpime
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE epwcom, ONLY : filkf, nkf1, nkf2, nkf3, &
rand_k, rand_nk, mp_mesh_k, system_2d
USE elph2, ONLY : nkqtotf, nkqf, xkf, wkf, nkf
......@@ -28,20 +27,34 @@ SUBROUTINE loadkmesh_para
USE noncollin_module, ONLY : noncolin
!
implicit none
!
real(kind=DP), ALLOCATABLE :: xkf_(:,:), wkf_(:), xkf_tmp(:,:)
REAL(kind=DP), ALLOCATABLE :: wkf_tmp(:)
REAL(kind=DP), ALLOCATABLE :: xkfval(:,:)
integer :: ik, ikk, ikq, lower_bnd, upper_bnd, i, j, k, ios
IMPLICIT NONE
!
INTEGER :: ios
!! integer variable for I/O control
INTEGER :: ik
!! Counter on the k-point index
INTEGER :: ikk
!! k-point index
INTEGER :: ikq
!! q-point index
INTEGER :: lower_bnd
!! Lower bounds index after k paral
INTEGER :: upper_bnd
!! Upper bounds index after k paral
INTEGER :: i, j, k
!! Counter on the k-point index along nkf1, nkf2, nkf3
INTEGER :: rest
!! rest from the division of nr of q-points over pools
!
integer :: rest
REAL(kind=DP), ALLOCATABLE :: xkf_(:,:), xkf_tmp(:,:), xkfval(:,:)
!! coordinates k-points
REAL(kind=DP), ALLOCATABLE :: wkf_(:), wkf_tmp(:)
!! weights k-points
!
IF (mpime .eq. ionode_id) THEN
IF (filkf .ne. '') THEN ! load from file (crystal coordinates)
!
WRITE(stdout, *) ' Using k-mesh file: ', trim(filkf)
WRITE(stdout, *) ' Using k-mesh file: ', trim(filkf)
OPEN( unit = iunkf, file = filkf, status = 'old', form = 'formatted',err=100, iostat=ios)
100 CALL errore('loadkmesh_para','opening file '//filkf,abs(ios))
READ(iunkf, *) nkqtotf
......@@ -84,7 +97,7 @@ SUBROUTINE loadkmesh_para
0,0,0, nkf1,nkf2,nkf3, nkqtotf, xkf_, wkf_)
DEALLOCATE (xkf_, wkf_)
ALLOCATE ( xkf_ (3, 2*nkqtotf), wkf_(2*nkqtotf))
ALLOCATE (xkf_tmp (3,nkqtotf), wkf_tmp(nkqtotf))
ALLOCATE ( xkf_tmp (3,nkqtotf), wkf_tmp(nkqtotf))
ALLOCATE ( xkfval (3, 2*nkqtotf))
xkf_(:,:) = 0.0d0
xkfval(:,:) = 0.0d0
......@@ -251,22 +264,35 @@ SUBROUTINE loadkmesh_serial
!! Load fine k mesh
!!
!-----------------------------------------------------------------------
USE io_global, ONLY : ionode_id
USE io_global, ONLY : ionode_id, stdout
USE mp_global, ONLY : inter_pool_comm
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : mpime
USE kinds, ONLY : DP
USE io_global, ONLY : stdout
USE epwcom, ONLY : filkf, nkf1, nkf2, nkf3, &
rand_k, rand_nk, mp_mesh_k, system_2d
USE elph2, ONLY : xkf, wkf, nkqtotf, nkf, nkqf
USE cell_base, ONLY : at, bg
USE symm_base, ONLY : s, t_rev, time_reversal, set_sym_bl, nrot
USE io_epw, ONLY : iunkf
implicit none
!
integer :: ik, i, j, k, ios, ikk, ikq
real(kind=DP), ALLOCATABLE :: xkf_tmp(:,:), wkf_tmp(:)
IMPLICIT NONE
!
INTEGER :: ios
!! integer variable for I/O control
INTEGER :: ik
!! Counter on the k-point index
INTEGER :: ikk
!! k-point index
INTEGER :: ikq
!! q-point index
INTEGER :: i, j, k
!! Counter on the k-point index along nkf1, nkf2, nkf3
!
REAL(kind=DP), ALLOCATABLE :: xkf_tmp(:,:)
!! coordinates k-points
REAL(kind=DP), ALLOCATABLE :: wkf_tmp(:)
!! weights k-points
!
IF (mpime .eq. ionode_id) THEN
IF (filkf .ne. '') THEN ! load from file (crystal coordinates)
......
......@@ -7,7 +7,7 @@
! present distribution, or http://www.gnu.org/copyleft.gpl.txt .
!
!----------------------------------------------------------------------------
subroutine loadumat ( nbnd, nbndsub, nks, nkstot, xxq, cu, cuq, lwin, lwinq )
subroutine loadumat ( nbnd, nbndsub, nks, nkstot, xxq, cu, cuq, lwin, lwinq, exband )
!----------------------------------------------------------------------------
!!
!! wannier interpolation of e-p vertex:
......@@ -27,8 +27,16 @@
USE io_global, ONLY : ionode_id, meta_ionode
USE mp_global, ONLY : inter_pool_comm
USE mp, ONLY : mp_sum, mp_barrier, mp_bcast
implicit none
!
IMPLICIT NONE
!
LOGICAL, INTENT (out) :: lwin( nbnd, nks )
!! Band windows at k
LOGICAL, INTENT (out) :: lwinq( nbnd, nks )
!! Band windows at k+q
LOGICAL, INTENT (out) :: exband( nbnd )
!! Band excluded
!
INTEGER, INTENT (in) :: nbnd
!! Number of bands
INTEGER, INTENT (in) :: nbndsub
......@@ -38,34 +46,47 @@
INTEGER, INTENT (in) :: nkstot
!! total number of kpoints across pools
!
LOGICAL, INTENT (out) :: lwin( nbnd, nks )
!! Band windows at k
LOGICAL, INTENT (out) :: lwinq( nbnd, nks )
!! Band windows at k+q
!
REAL(kind=DP), INTENT (in) :: xxq(3)
!! the qpoint for folding of U
!
COMPLEX(kind=DP), INTENT (out) :: cu ( nbnd, nbndsub, nks)
!! U matrix
COMPLEX(kind=DP), INTENT (out) :: cuq ( nbnd, nbndsub, nks)
!! U(k+q) matrix
COMPLEX(kind=DP), INTENT (out) :: cu( nbnd, nbndsub, nks )
!! U(k) matrix for k-points in the pool
COMPLEX(kind=DP), INTENT (out) :: cuq( nbnd, nbndsub, nks )
!! U(k+q) matrix for k+q-points in the pool
!
! work variables
!
integer :: ik, ibnd, jbnd, ios, ik_start, ik_stop
complex(kind=DP) :: cu_big ( nbnd, nbndsub, nkstot), cuq_big ( nbnd, nbndsub, nkstot)
logical :: lwin_big( nbnd, nkstot ), lwinq_big( nbnd, nkstot )
INTEGER :: ik
!! Counter of k-point index
INTEGER :: ibnd
!! Counter on band index
INTEGER :: jbnd
!! Counter on wannierized bands
INTEGER :: ios
!! integer variable for I/O control
INTEGER :: ik_start
!! Index of first k-point in the pool
INTEGER :: ik_stop
!! Index of last k-point in the pool
!
COMPLEX(kind=DP) :: cu_big ( nbnd, nbndsub, nkstot)
!! U(k) matrix for all k-points
COMPLEX(kind=DP) :: cuq_big ( nbnd, nbndsub, nkstot)
!! U(k+q) matrix for all k+q-points
!
LOGICAL :: lwin_big( nbnd, nkstot )
!! .true. if the band ibnd lies within the outer window at k-point ik
LOGICAL :: lwinq_big( nbnd, nkstot )
!! .true. if the band ibnd lies within the outer window at k+qpoint ikq
!
cu_big = czero
cuq_big = czero
IF (meta_ionode) then
IF (meta_ionode) THEN
!
! first proc read rotation matrix (coarse mesh) from file
!
open ( unit = iunukk, file = filukk, status = 'old', form = 'formatted',iostat=ios)
OPEN ( unit = iunukk, file = filukk, status = 'old', form = 'formatted',iostat=ios)
IF (ios /=0) call errore ('loadumat', 'error opening ukk file',iunukk)
!
DO ik = 1, nkstot
DO ibnd = 1, nbnd
......@@ -74,13 +95,16 @@
ENDDO
ENDDO
ENDDO
DO ik = 1,nkstot
DO ibnd = 1,nbnd
DO ik = 1, nkstot
DO ibnd = 1, nbnd
READ (iunukk,*) lwin_big(ibnd,ik)
ENDDO
ENDDO
DO ibnd = 1, nbnd
READ (iunukk,*) exband(ibnd)
ENDDO
!
close ( iunukk )
CLOSE ( iunukk )
!
! generate U(k+q) through the map
!
...