The Elk Code
alpha2f.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 
6 subroutine alpha2f
7 use modmain
8 use modphonon
9 use modtest
10 implicit none
11 ! local variables
12 integer iq,i,j,i1,i2,i3,iw
13 real(8) wmin,wmax,wd,dw
14 real(8) wlog,wrms,lambda,tc
15 real(8) v(3),t1
16 ! allocatable arrays
17 real(8), allocatable :: gq(:,:),wq(:),w(:)
18 real(8), allocatable :: a2fmr(:,:,:),a2fp(:),a2f(:)
19 complex(8), allocatable :: dq(:,:),ev(:,:),b(:,:)
20 complex(8), allocatable :: a2fmq(:,:,:),a2fmp(:,:)
21 ! initialise universal variables
22 call init0
23 call init1
24 call init2
25 call initph
26 ! allocate local arrays
27 allocate(gq(nbph,nqpt),wq(nbph),w(nwplot))
28 allocate(a2fmr(nbph,nbph,nqptnr),a2fp(nbph),a2f(nwplot))
29 allocate(dq(nbph,nbph),ev(nbph,nbph),b(nbph,nbph))
30 allocate(a2fmq(nbph,nbph,nqpt),a2fmp(nbph,nbph))
31 ! get the eigenvalues from file
32 call readevalsv
33 ! compute the density of states at the Fermi energy
34 call occupy
35 ! read in the phonon linewidths for each q-point
36 call readgamma(gq)
37 ! loop over phonon q-points
38 do iq=1,nqpt
39 ! find the eigenvalues and eigenvectors of the dynamical matrix
40  call dynev(dynq(:,:,iq),wphq(:,iq),ev)
41 ! construct a complex matrix from the phonon eigenvectors such that its
42 ! eigenvalues squared are the phonon linewidths divided by the frequency
43  do i=1,nbph
44  if (wphq(i,iq) > 1.d-8) then
45  t1=sqrt(abs(gq(i,iq)/wphq(i,iq)))
46  else
47  t1=0.d0
48  end if
49  do j=1,nbph
50  b(i,j)=t1*conjg(ev(j,i))
51  end do
52  end do
53  call zgemm('N','N',nbph,nbph,nbph,zone,ev,nbph,b,nbph,zzero,a2fmq(:,:,iq), &
54  nbph)
55 end do
56 ! Fourier transform the matrices to real-space
57 call dynqtor(a2fmq,a2fmr)
58 ! find the minimum and maximum phonon frequencies
59 wmin=minval(wphq(1,:))
60 wmax=maxval(wphq(nbph,:))
61 t1=(wmax-wmin)*0.1d0
62 wmin=wmin-t1
63 wmax=wmax+t1
64 wd=wmax-wmin
65 if (wd < 1.d-8) wd=1.d0
66 dw=wd/dble(nwplot)
67 ! generate energy grid
68 do iw=1,nwplot
69  w(iw)=dw*dble(iw-1)+wmin
70 end do
71 a2f(:)=0.d0
72 do i1=0,ngrkf-1
73  v(1)=dble(i1)/dble(ngrkf)
74  do i2=0,ngrkf-1
75  v(2)=dble(i2)/dble(ngrkf)
76  do i3=0,ngrkf-1
77  v(3)=dble(i3)/dble(ngrkf)
78 ! compute the dynamical matrix at this particular q-point
79  call dynrtoq(v,dynr,dq)
80 ! find the phonon eigenvalues and eigenvectors
81  call dynev(dq,wq,ev)
82 ! compute the α²F matrix at this particular q-point
83  call dynrtoq(v,a2fmr,a2fmp)
84 ! diagonalise the α²F matrix simultaneously with the dynamical matrix
85 ! (thanks to Matthieu Verstraete and Ryotaro Arita for correcting this)
86  call dynevs(ev,a2fmp,a2fp)
87 ! square the eigenvalues to recover the linewidths divided by the frequency
88  a2fp(:)=a2fp(:)**2
89  do i=1,nbph
90  t1=(wq(i)-wmin)/dw+1.d0
91  iw=nint(t1)
92  if ((iw >= 1).and.(iw <= nwplot)) then
93  a2f(iw)=a2f(iw)+a2fp(i)
94  end if
95  end do
96  end do
97  end do
98 end do
99 t1=twopi*(fermidos/2.d0)*dw*dble(ngrkf)**3
100 if (t1 > 1.d-8) then
101  t1=1.d0/t1
102 else
103  t1=0.d0
104 end if
105 a2f(:)=t1*a2f(:)
106 ! smooth Eliashberg function if required
107 if (nswplot > 0) call fsmooth(nswplot,nwplot,a2f)
108 ! write Eliashberg function to file
109 open(50,file='ALPHA2F.OUT',form='FORMATTED')
110 do iw=1,nwplot
111  write(50,'(2G18.10)') w(iw),a2f(iw)
112 end do
113 close(50)
114 write(*,*)
115 write(*,'("Info(alpha2f):")')
116 write(*,'(" Eliashberg function α²F written to ALPHA2F.OUT")')
117 ! compute lambda, logarithmic average frequency, RMS average frequency and
118 ! McMillan-Allen-Dynes superconducting critical temperature
119 call mcmillan(w,a2f,lambda,wlog,wrms,tc)
120 open(50,file='MCMILLAN.OUT',form='FORMATTED')
121 write(50,*)
122 write(50,'("Electron-phonon coupling constant, λ : ",G18.10)') lambda
123 write(50,*)
124 write(50,'("Logarithmic average frequency : ",G18.10)') wlog
125 write(50,*)
126 write(50,'("RMS average frequency : ",G18.10)') wrms
127 write(50,*)
128 write(50,'("Coulomb pseudopotential, μ* : ",G18.10)') mustar
129 write(50,*)
130 write(50,'("McMillan-Allen-Dynes superconducting critical temperature")')
131 write(50,'(" [Eq. 34, Phys. Rev. B 12, 905 (1975)] (kelvin) : ",G18.10)') tc
132 write(50,*)
133 close(50)
134 write(*,*)
135 write(*,'("Info(alpha2f):")')
136 write(*,'(" Electron-phonon coupling constant, λ,")')
137 write(*,'(" logarithmic and RMS average frequencies,")')
138 write(*,'(" and McMillan-Allen-Dynes superconducting critical temperature")')
139 write(*,'(" written to MCMILLAN.OUT")')
140 ! write lambda to test file
141 call writetest(251,'electron-phonon coupling constant, lambda',tol=5.d-2, &
142  rv=lambda)
143 deallocate(gq,wq,w,dq,ev,b)
144 deallocate(a2fmr,a2fp,a2f)
145 deallocate(a2fmq,a2fmp)
146 end subroutine
147 
integer ngrkf
Definition: modmain.f90:1075
real(8), dimension(:,:,:), allocatable dynr
Definition: modphonon.f90:29
subroutine writetest(id, descr, nv, iv, iva, tol, rv, rva, zv, zva)
Definition: modtest.f90:16
real(8), parameter twopi
Definition: modmain.f90:1233
subroutine mcmillan(w, a2f, lambda, wlog, wrms, tc)
Definition: mcmillan.f90:7
subroutine occupy
Definition: occupy.f90:10
integer nqpt
Definition: modmain.f90:525
subroutine readgamma(gq)
Definition: readgamma.f90:7
real(8) fermidos
Definition: modmain.f90:913
complex(8), parameter zone
Definition: modmain.f90:1240
pure subroutine fsmooth(m, n, f)
Definition: fsmooth.f90:10
subroutine dynrtoq(vpl, dr, dq)
Definition: dynrtoq.f90:7
real(8) mustar
Definition: modphonon.f90:23
subroutine dynev(dq, wq, ev)
Definition: dynev.f90:7
complex(8), dimension(:,:,:), allocatable dynq
Definition: modphonon.f90:27
integer nbph
Definition: modphonon.f90:13
subroutine init2
Definition: init2.f90:7
subroutine initph
Definition: initph.f90:7
integer nqptnr
Definition: modmain.f90:527
subroutine init1
Definition: init1.f90:10
complex(8), parameter zzero
Definition: modmain.f90:1240
integer nswplot
Definition: modmain.f90:1077
subroutine alpha2f
Definition: alpha2f.f90:7
subroutine dynqtor(dq, dr)
Definition: dynqtor.f90:7
subroutine init0
Definition: init0.f90:10
integer nwplot
Definition: modmain.f90:1073
subroutine readevalsv
Definition: readevalsv.f90:7
real(8), dimension(:,:), allocatable wphq
Definition: modphonon.f90:31
subroutine dynevs(ev, dq, wq)
Definition: dynevs.f90:7