ephwan2bloch.f90 3.41 KB
Newer Older
sponce's avatar
sponce committed
1 2 3 4 5 6 7 8 9 10 11 12 13
  !                                                                            
  ! Copyright (C) 2010-2016 Samuel Ponce', Roxana Margine, Carla Verdi, Feliciano Giustino 
  ! Copyright (C) 2007-2009 Jesse Noffsinger, Brad Malone, Feliciano Giustino  
  !                                                                            
  ! This file is distributed under the terms of the GNU General Public         
  ! License. See the file `LICENSE' in the root directory of the               
  ! present distribution, or http://www.gnu.org/copyleft.gpl.txt .             
  !                                                                            
  ! 
  !---------------------------------------------------------------------------
  SUBROUTINE ephwan2bloch ( nbnd, nrr, irvec, ndegen, epmatw, &
         xk, cufkk, cufkq, epmatf, nmodes)
  !---------------------------------------------------------------------------
14 15 16 17
  !!
  !! Interpolation from Wannier to the fine Bloch grid of the electron-phonon 
  !! matrix elements
  !!
sponce's avatar
sponce committed
18 19 20 21
  USE kinds,         ONLY : DP
  USE constants_epw, ONLY : twopi, ci, czero, cone
  implicit none
  !
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
  INTEGER, INTENT (in) :: nbnd
  !! number of bands (possibly in the optimal subspace)
  INTEGER, INTENT (in) :: nrr
  !! Number of Wigner-Size points
  INTEGER, INTENT (in) :: irvec ( 3, nrr)
  !! Coordinates of WS points
  INTEGER, INTENT (in) :: ndegen (nrr)
  !! Degeneracy of WS points
  INTEGER, INTENT (in) :: nmodes
  !! number of phonon modes
  !
  REAL(kind=DP), INTENT (in) :: xk(3)
  !! kpoint for the interpolation (WARNING: this must be in crystal coord!)
  !
  COMPLEX(kind=DP), INTENT (in) :: epmatw ( nbnd, nbnd, nrr, nmodes)
  !! e-p matrix in Wannier representation
  COMPLEX(kind=DP), INTENT (in) :: cufkk (nbnd, nbnd)
  !! rotation matrix U(k)
  COMPLEX(kind=DP), INTENT (in) :: cufkq (nbnd, nbnd)
  !! rotation matrix U(k+q)
  COMPLEX(kind=DP), INTENT (out) :: epmatf (nbnd, nbnd, nmodes)
  !! e-p matrix in Bloch representation, fine grid
sponce's avatar
sponce committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  !
  ! work variables 
  integer :: ir, imode
  real(kind=DP) :: rdotk
  complex(kind=DP) :: cfac, eptmp( nbnd, nbnd)
  !
  !----------------------------------------------------------
  !  STEP 3: inverse Fourier transform of g to fine k mesh
  !----------------------------------------------------------
  !
  !  g~ (k') = sum_R 1/ndegen(R) e^{-ik'R} g (R)
  !
  !  g~(k') is epmatf (nbnd, nbnd, ik )
  !  every pool works with its own subset of k points on the fine grid
  !
  epmatf = czero
  !
  DO ir = 1, nrr
     !
     ! note xk is assumed to be already in cryst coord
     !
     rdotk = twopi * dot_product ( xk, dble(irvec(:, ir)) )
     cfac = exp( ci*rdotk ) / dble( ndegen(ir) )
     !
     DO imode = 1, nmodes
       epmatf (:, :, imode) = epmatf (:, :, imode) + cfac * epmatw ( :, :, ir, imode)
     ENDDO
     !
  ENDDO
  !
  !----------------------------------------------------------
  !  STEP 4: un-rotate to Bloch space, fine grid
  !----------------------------------------------------------
  !
  !  g (k') = U_q^\dagger (k') g~ (k') U_k (k')
  !
  ! the two zgemm calls perform the following ops:
  !  epmatf  = [ cufkq * epmatf ] * cufkk^\dagger
  !
  DO imode = 1, nmodes
    !
    CALL zgemm ('n', 'n', nbnd, nbnd, nbnd, cone, cufkq, &
         nbnd, epmatf (:,:,imode), nbnd, czero, eptmp, nbnd)
    CALL zgemm ('n', 'c', nbnd, nbnd, nbnd, cone, eptmp, &
         nbnd, cufkk, nbnd, czero, epmatf(:,:,imode), nbnd)
    !
  ENDDO
  !
  !
  END SUBROUTINE ephwan2bloch