The Elk Code
 
Loading...
Searching...
No Matches
genephmat.f90
Go to the documentation of this file.
1
2! Copyright (C) 2008 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6subroutine genephmat(iq,ik,de,a,dvmt,dvir,ephmat)
7use modmain
8use modphonon
9implicit none
10! arguments
11integer, intent(in) :: iq,ik
12real(8), intent(in) :: de
13complex(8), intent(in) :: a(nbph,nbph)
14complex(8), intent(in) :: dvmt(npcmtmax,natmtot,nbph),dvir(ngtc,nbph)
15complex(8), intent(out) :: ephmat(nstsv,nstsv,nbph)
16! local variables
17integer jk,jkq,isym,ld
18integer nst,nstq,ist,jst
19integer ispn,jspn,is,ias
20integer npc,nq,igp,i,j,l
21real(8) vpql(3)
22! automatic arrays
23integer idx(nstsv),idxq(nstsv)
24integer ngp(nspnfv),ngpq(nspnfv)
25complex(4) cfmt1(npcmtmax),cfmt2(npcmtmax),c(ngkmax)
26complex(8) x(nbph)
27! allocatable arrays
28integer, allocatable :: igpig(:,:),igpqig(:,:)
29complex(4), allocatable :: wfmt(:,:,:,:),wfgp(:,:,:)
30complex(4), allocatable :: wfmtq(:,:,:,:),wfgpq(:,:,:)
31complex(4), allocatable :: wfir1(:),wfir2(:)
32! equivalent reduced k-point
33jk=ivkik(ivk(1,ik),ivk(2,ik),ivk(3,ik))
34! k+q-vector in lattice coordinates
35vpql(1:3)=vkl(1:3,ik)+vql(1:3,iq)
36! find reduced k-point index corresponding to k+q
37call findkpt(vpql,isym,jkq)
38! index to states in energy window around Fermi energy
39nst=0
40do ist=1,nstsv
41 if (abs(evalsv(ist,jk)-efermi) > de) cycle
42 nst=nst+1
43 idx(nst)=ist
44end do
45nstq=0
46do ist=1,nstsv
47 if (abs(evalsv(ist,jkq)-efermi) > de) cycle
48 nstq=nstq+1
49 idxq(nstq)=ist
50end do
51! generate the second-variational wavefunctions for all states at k and k+q
52allocate(igpig(ngkmax,nspnfv))
53allocate(wfmt(npcmtmax,natmtot,nspinor,nst),wfgp(ngkmax,nspinor,nst))
54call genwfsvp_sp(.false.,.true.,nst,idx,ngridg,igfft,vkl(:,ik),ngp,igpig,wfmt, &
55 ngkmax,wfgp)
56allocate(igpqig(ngkmax,nspnfv))
57allocate(wfmtq(npcmtmax,natmtot,nspinor,nstq),wfgpq(ngkmax,nspinor,nstq))
58call genwfsvp_sp(.false.,.true.,nstq,idxq,ngridg,igfft,vpql,ngpq,igpqig,wfmtq, &
59 ngkmax,wfgpq)
60! zero the electron-phonon coupling matrix elements
61ephmat(1:nstsv,1:nstsv,1:nbph)=0.d0
62!-------------------------!
63! muffin-tin part !
64!-------------------------!
65do j=1,nst
66 jst=idx(j)
67 do i=1,nstq
68 ist=idxq(i)
69 do ias=1,natmtot
70 is=idxis(ias)
71 npc=npcmt(is)
72 if (spinpol) then
73 cfmt1(1:npc)=wfmtq(1:npc,ias,1,i)*conjg(wfmt(1:npc,ias,1,j)) &
74 +wfmtq(1:npc,ias,2,i)*conjg(wfmt(1:npc,ias,2,j))
75 else
76 cfmt1(1:npc)=wfmtq(1:npc,ias,1,i)*conjg(wfmt(1:npc,ias,1,j))
77 end if
78 call cfsht(nrcmt(is),nrcmti(is),cfmt1,cfmt2)
79 do l=1,nbph
80 ephmat(ist,jst,l)=ephmat(ist,jst,l) &
81 +dot_product(cfmt2(1:npc),dvmt(1:npc,ias,l))
82 end do
83 end do
84 end do
85end do
86deallocate(wfmt,wfmtq)
87!---------------------------!
88! interstitial part !
89!---------------------------!
90allocate(wfir1(ngtc),wfir2(ngtc))
91do j=1,nst
92 jst=idx(j)
93 do ispn=1,nspinor
94 jspn=jspnfv(ispn)
95 nq=ngpq(jspn)
96! Fourier transform wavefunction to real-space
97 wfir1(1:ngtc)=0.e0
98 do igp=1,ngp(jspn)
99 wfir1(igfc(igpig(igp,jspn)))=wfgp(igp,ispn,j)
100 end do
101 call cfftifc(3,ngdgc,1,wfir1)
102 do l=1,nbph
103! apply potential derivative to wavefunction
104 wfir2(1:ngtc)=dvir(1:ngtc,l)*wfir1(1:ngtc)
105! Fourier transform to G+p+q-space
106 call cfftifc(3,ngdgc,-1,wfir2)
107 do igp=1,nq
108 c(igp)=wfir2(igfc(igpqig(igp,jspn)))
109 end do
110 do i=1,nstq
111 ist=idxq(i)
112! compute inner product
113 ephmat(ist,jst,l)=ephmat(ist,jst,l) &
114 +dot_product(wfgpq(1:nq,ispn,i),c(1:nq))
115 end do
116 end do
117 end do
118end do
119deallocate(wfir1,wfir2)
120! convert to phonon coordinates
121ld=nstsv**2
122do i=1,nstq
123 ist=idxq(i)
124 do j=1,nst
125 jst=idx(j)
126 x(1:nbph)=ephmat(ist,jst,1:nbph)
127 call zgemv('T',nbph,nbph,zone,a,nbph,x,1,zzero,ephmat(ist,jst,1),ld)
128 end do
129end do
130deallocate(igpig,igpqig,wfgp,wfgpq)
131end subroutine
132
subroutine cfftifc(nd, n, sgn, c)
subroutine cfsht(nr, nri, cfmt1, cfmt2)
Definition cfsht.f90:7
subroutine findkpt(vpl, isym, ik)
Definition findkpt.f90:7
subroutine genephmat(iq, ik, de, a, dvmt, dvir, ephmat)
Definition genephmat.f90:7
subroutine genwfsvp_sp(tsh, tgp, nst, idx, ngridg_, igfft_, vpl, ngp, igpig, wfmt, ld, wfir)
complex(8), parameter zzero
Definition modmain.f90:1238
integer, dimension(3) ngridg
Definition modmain.f90:386
real(8) efermi
Definition modmain.f90:904
integer nspinor
Definition modmain.f90:267
integer, dimension(3) ngdgc
Definition modmain.f90:388
logical spinpol
Definition modmain.f90:228
integer, dimension(maxspecies) nrcmt
Definition modmain.f90:173
integer, dimension(:,:), allocatable ivk
Definition modmain.f90:465
complex(8), parameter zone
Definition modmain.f90:1238
integer, dimension(:), allocatable igfc
Definition modmain.f90:410
integer, dimension(maxatoms *maxspecies) idxis
Definition modmain.f90:44
real(8), dimension(:,:), allocatable vql
Definition modmain.f90:545
integer, dimension(maxspecies) npcmt
Definition modmain.f90:214
integer, dimension(:), allocatable igfft
Definition modmain.f90:406
integer, dimension(2) jspnfv
Definition modmain.f90:291
real(8), dimension(:,:), allocatable vkl
Definition modmain.f90:471
integer, dimension(:,:,:), allocatable ivkik
Definition modmain.f90:467
integer, dimension(maxspecies) nrcmti
Definition modmain.f90:211
real(8), dimension(:,:), allocatable evalsv
Definition modmain.f90:918