Plot Wannier functions

This commit is contained in:
Hyungjun Lee 2020-04-06 05:38:40 -05:00
parent 056cc4502a
commit 4c158c26c9
8 changed files with 847 additions and 273 deletions

View File

@ -50,7 +50,8 @@
lphase, omegamin, omegamax, omegastep, n_r, &
mob_maxiter, use_ws, epmatkqread, selecqread, &
scdm_proj, scdm_entanglement, scdm_mu, scdm_sigma,&
assume_metal
assume_metal, wannier_plot_scale, reduce_unk, &
wannier_plot_supercell, wannier_plot_radius
! Added for polaron calculations. Originally by Danny Sio, modified by Chao Lian.
USE epwcom, ONLY : mob_maxiter, use_ws, epmatkqread, selecqread, &
wfcelec, model_vertex , polaron_wf, r01, r02, r03,&
@ -59,7 +60,7 @@
electron_dos, phonon_dos, diag_mode, &
restart_polaron_mode, polaron_type, &
emax_plrn, nDOS_plrn, emin_plrn
USE elph2, ONLY : elph
USE elph2, ONLY : elph, wanplotlist
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : world_comm
USE io_files, ONLY : prefix, tmp_dir
@ -146,6 +147,7 @@
CALL mp_bcast(selecqread , meta_ionode_id, world_comm)
CALL mp_bcast(scdm_proj , meta_ionode_id, world_comm)
CALL mp_bcast(assume_metal , meta_ionode_id, world_comm)
CALL mp_bcast(reduce_unk , meta_ionode_id, world_comm)
!
! integers
!
@ -184,6 +186,8 @@
CALL mp_bcast(scr_typ , meta_ionode_id, world_comm)
CALL mp_bcast(bnd_cum , meta_ionode_id, world_comm)
CALL mp_bcast(mob_maxiter , meta_ionode_id, world_comm)
CALL mp_bcast(wanplotlist , meta_ionode_id, world_comm)
CALL mp_bcast(wannier_plot_supercell, meta_ionode_id, world_comm)
!
! REAL*8
!
@ -225,6 +229,8 @@
CALL mp_bcast(nc , meta_ionode_id, world_comm)
CALL mp_bcast(scdm_mu , meta_ionode_id, world_comm)
CALL mp_bcast(scdm_sigma , meta_ionode_id, world_comm)
CALL mp_bcast(wannier_plot_radius, meta_ionode_id, world_comm)
CALL mp_bcast(wannier_plot_scale, meta_ionode_id, world_comm)
!
! characters
!

View File

@ -47,7 +47,8 @@
ngxx, &! Maximum number of G-vectors over all pools
ngxxf, &! Maximum number of G-vectors over all pools for k+q folding
ig_s, &! First G index within each core in case of G parallelization
ig_e ! Last G index within each core in case of G parallelization
ig_e, &! Last G index within each core in case of G parallelization
num_wannier_plot ! Number of Wannier functions to plot
INTEGER, ALLOCATABLE :: &!
igk(:), &! Index for k+G vector
igkq(:), &! Index for k+q+G vector
@ -59,7 +60,8 @@
gmap(:), &! the map G -> G-G_0 in the large (density) G vectors set, for every G_0
ixkqf_tr(:), &! Mapping matrix from k+q (where q is full BZ) to IBZ
s_bztoibz_full(:), &! Rotation that brink that k-point from BZ to IBZ
mapg(:,:,:) ! Map between FFT grid and G-vector index
mapg(:,:,:), &! Map between FFT grid and G-vector index
wanplotlist(:) ! List of Wannier functions to plot
REAL(KIND = DP) :: &!
efnew, &! Fermi level on the fine grid. Added globaly for efficiency reason
deltaq, &! Displacement of fine-mesh k-points for velocity corrections

View File

@ -56,7 +56,9 @@
restart_filq, prtgkk, nel, meff, epsiheg, lphase, &
omegamin, omegamax, omegastep, n_r, lindabs, mob_maxiter, &
auto_projections, scdm_proj, scdm_entanglement, scdm_mu, &
scdm_sigma, assume_metal
scdm_sigma, assume_metal, wannier_plot, wannier_plot_list, &
wannier_plot_supercell, wannier_plot_scale, reduce_unk, &
wannier_plot_radius
! Added for polaron calculations. Originally by Danny Sio, modified by Chao Lian.
USE epwcom, ONLY : wfcelec, restart_polaron, spherical_cutoff, &
model_vertex, conv_thr_polaron, n_dop, &
@ -68,7 +70,7 @@
init_plrn_wf, niterPlrn, nDOS_plrn, emax_plrn, emin_plrn, &
sigma_edos_plrn, sigma_pdos_plrn, pmax_plrn, pmin_plrn
USE klist_epw, ONLY : xk_all, xk_loc, xk_cryst, isk_all, isk_loc, et_all, et_loc
USE elph2, ONLY : elph
USE elph2, ONLY : elph, num_wannier_plot, wanplotlist
USE constants_epw, ONLY : ryd2mev, ryd2ev, ev2cmm1, kelvin2eV, zero, eps20, ang2m
USE io_files, ONLY : tmp_dir, prefix
USE control_flags, ONLY : iverbosity, modenum, gamma_only
@ -77,11 +79,12 @@
USE partial, ONLY : atomo, nat_todo
USE constants, ONLY : AMU_RY, eps16
USE mp_global, ONLY : my_pool_id, me_pool
USE io_global, ONLY : meta_ionode, meta_ionode_id, ionode_id, stdout
USE io_global, ONLY : meta_ionode, meta_ionode_id, stdout
USE io_var, ONLY : iunkf, iunqf
USE noncollin_module, ONLY : npol, noncolin
USE wvfct, ONLY : npwx
USE paw_variables, ONLY : okpaw
USE io_epw, ONLY : param_get_range_vector
#if defined(__NAG)
USE F90_UNIX_ENV, ONLY : iargc, getarg
#endif
@ -144,7 +147,8 @@
scatread, restart, restart_step, restart_filq, prtgkk, nel, meff, &
epsiheg, lphase, omegamin, omegamax, omegastep, n_r, lindabs, &
mob_maxiter, auto_projections, scdm_proj, scdm_entanglement, scdm_mu, &
scdm_sigma, assume_metal, &
scdm_sigma, assume_metal, wannier_plot, wannier_plot_list, reduce_unk, &
wannier_plot_supercell, wannier_plot_scale, wannier_plot_radius, &
! Added for polaron calculations. Originally by Danny Sio, modified by Chao Lian.
wfcelec, restart_polaron, spherical_cutoff, model_vertex, start_mode, &
conv_thr_polaron, polaron_wf, r01, r02, r03, num_cbands, start_band, &
@ -185,7 +189,7 @@
! epbread : read epmatq array from .epb files
! epbwrite : write epmatq array to .epb files
! nbndskip : number of bands to be skipped from the original Hamitonian (nfirstwin-1 in Marzari's notation)
! nbndskip is not an input any more. It is now automatically calculated in Wannierization step.
! [HL 02/2020] nbndskip is not an input any more. It is now automatically calculated in Wannierization step.
! For backward compatibility, nbndskip still can be entered as an input, but ignored with warning message.
! epwread : read all quantities in Wannier representation from file epwdata.fmt
! epwwrite : write all quantities in Wannier representation to file epwdata.fmt
@ -330,6 +334,15 @@
!
! Added by Felix Goudreault
! assume_metal : If .TRUE. => we are dealing with a metal
!
! Added by HL
! wannier_plot : If .TRUE., plot Wannier functions
! wannier_plot_list : Field read for parsing Wannier function list
! wannier_plot_supercell : Size of supercell for plotting Wannier functions
! wannier_plot_scale : Scaling parameter for cube files
! wannier_plot_radius : Cut-off radius for plotting Wannier functions
! reduce_unk : If .TRUE., plot Wannier functions on reduced grids
!
nk1tmp = 0
nk2tmp = 0
nk3tmp = 0
@ -398,6 +411,12 @@
bands_skipped= ''
wdata(:) = ''
iprint = 2
wannier_plot = .FALSE.
wannier_plot_scale = 1.0d0
wannier_plot_radius = 3.5d0
wannier_plot_supercell = (/5,5,5/)
wannier_plot_list = ''
reduce_unk = .FALSE.
wmin = 0.d0
wmax = 0.3d0
eps_acustic = 5.d0 ! cm-1
@ -579,6 +598,33 @@
IF (meta_ionode) READ(5, inputepw, ERR = 200, IOSTAT = ios)
#endif
200 CALL errore('epw_readin', 'reading input_epw namelist', ABS(ios))
!
IF (wannier_plot) THEN
IF (wannier_plot_radius < 0.0d0) &
CALL errore('epw_readin', 'Error: wannier_plot_radius must be positive', 1)
IF (wannier_plot_scale < 0.0d0) &
CALL errore('epw_readin', 'Error: wannier_plot_scale must be positive', 1)
IF (ANY(wannier_plot_supercell <= 0)) &
CALL errore('epw_readin', &
'Error: Three positive integers must be explicitly provided &
for wannier_plot_supercell', 1)
CALL param_get_range_vector(wannier_plot_list, num_wannier_plot, .TRUE.)
IF (num_wannier_plot == 0) THEN
num_wannier_plot = nbndsub
ALLOCATE(wanplotlist(num_wannier_plot), STAT = ierr)
IF (ierr /= 0) CALL errore('epw_readin', 'Error allocating wanplotlist', 1)
DO i = 1, num_wannier_plot
wanplotlist(i) = i
ENDDO
ELSE
ALLOCATE(wanplotlist(num_wannier_plot), STAT = ierr)
IF (ierr /= 0) CALL errore('epw_readin', 'Error allocating wanplotlist', 1)
CALL param_get_range_vector(wannier_plot_list, num_wannier_plot, .FALSE., wanplotlist)
IF (ANY(wanplotlist < 1) .OR. ANY(wanplotlist > nbndsub)) &
CALL errore('epw_readin', &
'Error: wannier_plot_list asks for a non-valid wannier function to be plotted', 1)
ENDIF
ENDIF
!
nk1tmp = nk1
nk2tmp = nk2
@ -750,6 +796,14 @@
dvscf_dir = TRIM(dvscf_dir) // '/'
!
400 CONTINUE
!
CALL mp_bcast(wannier_plot, meta_ionode_id, world_comm)
CALL mp_bcast(num_wannier_plot, meta_ionode_id, world_comm)
IF ( (wannier_plot) .AND. (.NOT. meta_ionode) ) THEN
ALLOCATE(wanplotlist(num_wannier_plot), STAT = ierr)
IF (ierr /= 0) CALL errore('epw_readin', 'Error allocating wanplotlist', 1)
ENDIF
!
CALL bcast_epw_input()
!
! Here we finished the reading of the input file.
@ -786,10 +840,10 @@
! bring k-points from cartesian to crystal coordinates
CALL cryst_to_cart(nkstot, xk_cryst, at, -1)
! Only master has the correct full list of kpt. Therefore bcast to all cores
CALL mp_bcast(xk_all, ionode_id, world_comm)
CALL mp_bcast(et_all, ionode_id, world_comm)
CALL mp_bcast(isk_all, ionode_id, world_comm)
CALL mp_bcast(xk_cryst, ionode_id, world_comm)
CALL mp_bcast(xk_all, meta_ionode_id, world_comm)
CALL mp_bcast(et_all, meta_ionode_id, world_comm)
CALL mp_bcast(isk_all, meta_ionode_id, world_comm)
CALL mp_bcast(xk_cryst, meta_ionode_id, world_comm)
!
! We define the local list of kpt
ALLOCATE(xk_loc(3, nks), STAT = ierr)

View File

@ -247,6 +247,14 @@
!! change in energy for each additional smearing in the selfen_phon
!
! Wannierization
CHARACTER(LEN = 255) :: wannier_plot_list
!! Field read for parsing Wannier function list
LOGICAL :: wannier_plot
!! if .TRUE. plot Wannier functions
LOGICAL :: reduce_unk
!! if .TRUE. plot Wannier functions on reduced grids
INTEGER :: wannier_plot_supercell(3)
!! Size of supercell for plotting Wannier functions
REAL(KIND = DP) :: dis_win_min
!! min energy of the Wannier disentanglement window
REAL(KIND = DP) :: dis_win_max
@ -259,6 +267,10 @@
!! parameter for Wannier functions via SCDM algorithm
REAL(KIND = DP) :: scdm_sigma
!! parameter for Wannier functions via SCDM algorithm
REAL(KIND = DP) :: wannier_plot_scale
!! Scaling parameter for cube files
REAL(KIND = DP) :: wannier_plot_radius
!! Cut-off radius for plotting Wannier functions
!
! Superconductivity
REAL(KIND = DP) :: eps_acustic

View File

@ -2101,6 +2101,116 @@
!----------------------------------------------------------------------------
END SUBROUTINE openfilepw
!----------------------------------------------------------------------------
!
!----------------------------------------------------------------------------
SUBROUTINE param_get_range_vector(field, length, lcount, i_value)
!----------------------------------------------------------------------------
!!
!! Read a range vector eg. 1,2,3,4-10 or 1 3 400:100
!! if(lcount) we return the number of states in length
!!
!! HL - April 2020
!! Imported and adapted from Wannier90
!!
!----------------------------------------------------------------------------
!
IMPLICIT NONE
!
CHARACTER(*), INTENT(in) :: field
!! Field read for parsing
INTEGER, INTENT(inout) :: length
!! Number of states
LOGICAL, INTENT(in) :: lcount
!! If T only count states
INTEGER, OPTIONAL, INTENT(out) :: i_value(length)
!! States specified in range vector
!
INTEGER :: loop
!! Loop index
INTEGER :: num1
!! Integer number read
INTEGER :: num2
!! Integer number read
INTEGER :: i_punc
!! Position returned after scanning punctuation marks
INTEGER :: counter
!! Counter index
INTEGER :: i_digit
!! Position returned after scanning numbers
INTEGER :: loop_r
!! Loop index
INTEGER :: range_size
!! Size of range
CHARACTER(LEN = 255) :: dummy
!! Copy of field read for parsing
CHARACTER(LEN = 10), PARAMETER :: c_digit = "0123456789"
CHARACTER(LEN = 2), PARAMETER :: c_range = "-:"
CHARACTER(LEN = 3), PARAMETER :: c_sep = " ,;"
CHARACTER(LEN = 5), PARAMETER :: c_punc = " ,;-:"
CHARACTER(LEN = 5) :: c_num1
!! Number read
CHARACTER(LEN = 5) :: c_num2
!! Number read
!
IF (lcount .AND. PRESENT(i_value)) &
CALL errore('param_get_range_vector', 'incorrect call', 1)
!
dummy = field
dummy = ADJUSTL(dummy)
!
counter = 0
IF (LEN_TRIM(dummy) == 0) THEN
length = counter
RETURN
ENDIF
!
DO
i_punc = SCAN(dummy, c_punc)
IF (i_punc == 0) &
CALL errore('param_get_range_vector', 'Error parsing field', 1)
c_num1 = dummy(1:i_punc - 1)
READ(c_num1, *, ERR = 101, END = 101) num1
dummy = ADJUSTL(dummy(i_punc:))
!look for range
IF (SCAN(dummy, c_range) == 1) THEN
i_digit = SCAN(dummy, c_digit)
dummy = ADJUSTL(dummy(i_digit:))
i_punc = SCAN(dummy, c_punc)
c_num2 = dummy(1:i_punc - 1)
READ(c_num2, *, ERR = 101, END = 101) num2
dummy = ADJUSTL(dummy(i_punc:))
range_size = ABS(num2 - num1) + 1
DO loop_r = 1, range_size
counter = counter + 1
IF (.NOT. lcount) i_value(counter) = MIN(num1, num2) + loop_r - 1
ENDDO
ELSE
counter = counter + 1
IF (.NOT. lcount) i_value(counter) = num1
ENDIF
IF (SCAN(dummy, c_sep) == 1) dummy = ADJUSTL(dummy(2:))
IF (SCAN(dummy, c_range) == 1) &
CALL errore('param_get_range_vector', 'Error parsing field: incorrect range', 1)
IF (INDEX(dummy, ' ') == 1) EXIT
ENDDO
!
IF (lcount) length = counter
IF (.NOT. lcount) THEN
DO loop = 1, counter - 1
DO loop_r = loop + 1, counter
IF (i_value(loop) == i_value(loop_r)) &
CALL errore('param_get_range_vector', 'Error parsing field: duplicate values', 1)
ENDDO
ENDDO
ENDIF
!
RETURN
!
101 CALL errore('param_get_range_vector', 'Error parsing field', 1)
!
!----------------------------------------------------------------------------
END SUBROUTINE param_get_range_vector
!----------------------------------------------------------------------------
!------------------------------------------------------------------------------
END MODULE io_epw
!------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -27,9 +27,6 @@
!!
LOGICAL :: write_unk
!! Set to .TRUE. to write the periodic part of the Bloch functions. Default is .FALSE.
LOGICAL :: reduce_unk
!! Set to .TRUE. to reduce file-size (and resolution) of Bloch functions by a factor of 8.
!! Default is .FALSE. (only relevant if write_unk=.TRUE.)
LOGICAL :: wvfn_formatted
!! Set to .TRUE. to write formatted wavefunctions. Default is .FALSE. (only relevant if write_unk=.TRUE.)
LOGICAL :: write_amn

View File

@ -147,13 +147,6 @@
!
WRITE(iuwinfil, '("num_wann = ", i3)') nbndsub
WRITE(iuwinfil, '("iprint = ", i3)') iprint
!
! SP: You can have more bands in nscf.in than in
! nbndskip+nbndsub. In which case the dis_win_max can be larger than
! nbndskip+nbndsub. This is crucial for disantanglement.
IF (dis_froz_min < MINVAL(et_tmp)) dis_froz_min = MINVAL(et_tmp)
IF (dis_froz_max > MAXVAL(et_tmp)) dis_froz_max = MAXVAL(et_tmp)
!
WRITE(iuwinfil, '("dis_win_min = ", f18.12)') dis_win_min
WRITE(iuwinfil, '("dis_win_max = ", f18.12)') dis_win_max
WRITE(iuwinfil, '("dis_froz_min = ", f18.12)') dis_froz_min