The Elk Code
 
Loading...
Searching...
No Matches
hmlephde.f90
Go to the documentation of this file.
1
2! Copyright (C) 2020 Chung-Yu Wang, J. K. Dewhurst, S. Sharma and
3! E. K. U. Gross. This file is distributed under the terms of the GNU General
4! Public License. See the file COPYING for license details.
5
6subroutine hmlephde(iq,d,e)
7use modmain
8use modphonon
9use modbog
10use modomp
11implicit none
12! arguments
13integer, intent(in) :: iq
14complex(8), intent(out) :: d(nbph,nbph),e(nbph,nbph)
15! local variables
16integer ik,jk,ikq,isym,nthd
17integer i1,i2,j1,j2,l1,l2
18real(8) vl(3),t0
19complex(8) z1
20! automatic arrays
21complex(4) ephmat(nstsv,nstsv,nbph)
22complex(8) x(nstsv,nstsv),y(nstsv,nstsv)
23! prefactor
24t0=-occmax*wkptnr*ephscf(1)**2/dengy
25e(:,:)=0.d0
26! parallel loop over non-reduced k-points
27call holdthd(nkptnr,nthd)
28!$OMP PARALLEL DO DEFAULT(SHARED) &
29!$OMP PRIVATE(ephmat,x,y,jk,vl,isym,ikq) &
30!$OMP PRIVATE(l1,l2,j1,j2,i1,i2,z1) &
31!$OMP REDUCTION(+:e) &
32!$OMP SCHEDULE(DYNAMIC) &
33!$OMP NUM_THREADS(nthd)
34do ik=1,nkptnr
35! equivalent reduced k-point
36 jk=ivkik(ivk(1,ik),ivk(2,ik),ivk(3,ik))
37! k+q-vector in lattice coordinates
38 vl(:)=vkl(:,ik)+vql(:,iq)
39! index to reduced k+q-vector
40 call findkpt(vl,isym,ikq)
41! read in the electron-phonon matrix elements from file
42 call getephmkq(iq,ik,ephmat)
43! perform the contraction
44 if (anomalous) then
45 do l2=1,nbph
46 do j1=1,nstsv
47 do i2=1,nstsv
48 z1=0.d0
49 do j2=1,nstsv
50 z1=z1+ephmat(j2,i2,l2)*duv(j1,j2,ikq)
51 end do
52 x(i2,j1)=z1
53 end do
54 end do
55 do i1=1,nstsv
56 do j1=1,nstsv
57 z1=0.d0
58 do i2=1,nstsv
59 z1=z1-conjg(duv(i1,i2,jk))*x(i2,j1)
60 end do
61 y(j1,i1)=z1
62 end do
63 end do
64 do l1=1,nbph
65 if (ediag.and.(l1 /= l2)) cycle
66 z1=0.d0
67 do i1=1,nstsv
68 do j1=1,nstsv
69 z1=z1+conjg(ephmat(j1,i1,l1))*y(j1,i1)
70 end do
71 end do
72 e(l1,l2)=e(l1,l2)+t0*z1
73 end do
74 end do
75 else
76 do l2=1,nbph
77 do j2=1,nstsv
78 do i2=1,nstsv
79 z1=0.d0
80 do j1=1,nstsv
81! swap indices of VV† to get the density matrix at k+q
82 z1=z1+ephmat(j1,i2,l2)*dvv(j2,j1,ikq)
83 end do
84 x(i2,j2)=z1
85 end do
86 end do
87 do j2=1,nstsv
88 do i1=1,nstsv
89 z1=0.d0
90 do i2=1,nstsv
91! swap indices of VV† to get density matrix at k
92 z1=z1+dvv(i2,i1,jk)*x(i2,j2)
93 end do
94 y(i1,j2)=z1
95 end do
96 end do
97 do l1=1,nbph
98 if (ediag.and.(l1 /= l2)) cycle
99 z1=0.d0
100 do j2=1,nstsv
101 do i1=1,nstsv
102 z1=z1+conjg(ephmat(j2,i1,l1))*y(i1,j2)
103 end do
104 end do
105 e(l1,l2)=e(l1,l2)+t0*z1
106 end do
107 end do
108 end if
109end do
110!$OMP END PARALLEL DO
111call freethd(nthd)
112! determine the matrix D = D0 or D = D0 + E
113if (tephde) then
114 d(:,:)=e(:,:)
115else
116 d(:,:)=0.d0
117end if
118do l1=1,nbph
119 d(l1,l1)=d(l1,l1)+wphq(l1,iq)
120end do
121end subroutine
122
subroutine findkpt(vpl, isym, ik)
Definition findkpt.f90:7
subroutine getephmkq(iqp, ikp, ephmat)
Definition getephmkq.f90:7
subroutine hmlephde(iq, d, e)
Definition hmlephde.f90:7
complex(8), dimension(:,:,:), pointer, contiguous duv
Definition modbog.f90:25
complex(8), dimension(:,:,:), pointer, contiguous dvv
Definition modbog.f90:25
logical ediag
Definition modbog.f90:45
integer nkptnr
Definition modmain.f90:463
integer, dimension(:,:), allocatable ivk
Definition modmain.f90:465
real(8), dimension(:,:), allocatable vql
Definition modmain.f90:545
real(8), dimension(:,:), allocatable vkl
Definition modmain.f90:471
real(8) occmax
Definition modmain.f90:898
integer, dimension(:,:,:), allocatable ivkik
Definition modmain.f90:467
real(8) wkptnr
Definition modmain.f90:477
subroutine holdthd(nloop, nthd)
Definition modomp.f90:78
subroutine freethd(nthd)
Definition modomp.f90:106
logical anomalous
real(8), dimension(2) ephscf
logical tephde
real(8) dengy
real(8), dimension(:,:), allocatable wphq
Definition modphonon.f90:31