The Elk Code
dynqnat.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2024 J. K. Dewhurst and S. Sharma.
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 dynqnat(sgn,vpl,dq)
7 use modmain
8 use modphonon
9 implicit none
10 ! arguments
11 integer, intent(in) :: sgn
12 real(8), intent(in) :: vpl(3)
13 complex(8), intent(inout) :: dq(nbph,nbph)
14 ! local variables
15 integer ias,jas,ip,jp,i,j
16 real(8) vpfl(3),vpc(3),v(3),t0,t1
17 ! automatic arrays
18 real(8) vbpc(3,natmtot)
19 ! map vpl to the first Brillouin zone
20 vpfl(:)=vpl(:)
21 call vecfbz(epslat,bvec,vpfl)
22 ! q-vector in Cartesian coordinates
23 call r3mv(bvec,vpfl,vpc)
24 ! multiply the q-vector with the Born effective charge tensor
25 do ias=1,natmtot
26  call r3mv(bec(:,:,ias),vpc,vbpc(:,ias))
27 end do
28 ! compute q⋅ϵ⋅q
29 call r3mv(epsw0,vpc,v)
30 t0=vpc(1)*v(1)+vpc(2)*v(2)+vpc(3)*v(3)
31 if (abs(t0) > 1.d-8) then
32  t0=fourpi/(omega*t0)
33  if (sgn < 0) t0=-t0
34 else
35  t0=0.d0
36 end if
37 ! ensure that the function tends to zero smoothly near the zone boundary
38 do i=1,3
39  t1=abs(vpfl(i))
40  if (t1 < 0.5d0) then
41  t0=t0*(1.d0-2.d0*t1)
42  else
43  t0=0.d0
44  end if
45 end do
46 j=0
47 do jas=1,natmtot
48  do jp=1,3
49  j=j+1
50  i=0
51  do ias=1,natmtot
52  do ip=1,3
53  i=i+1
54  t1=vbpc(ip,ias)*vbpc(jp,jas)
55  dq(i,j)=dq(i,j)+t0*t1
56  end do
57  end do
58  end do
59 end do
60 end subroutine
61 
subroutine vecfbz(eps, bvec, vpl)
Definition: vecfbz.f90:10
real(8) omega
Definition: modmain.f90:20
subroutine dynqnat(sgn, vpl, dq)
Definition: dynqnat.f90:7
real(8), dimension(:,:,:), allocatable bec
Definition: modphonon.f90:36
real(8), dimension(3, 3) bvec
Definition: modmain.f90:16
real(8) epslat
Definition: modmain.f90:24
real(8), parameter fourpi
Definition: modmain.f90:1234
pure subroutine r3mv(a, x, y)
Definition: r3mv.f90:10
real(8), dimension(3, 3) epsw0
Definition: modphonon.f90:38