The Elk Code
jtotk.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2020 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 jtotk(ik,pmat,evecsv,evecsvt)
7 use modmain
8 implicit none
9 ! arguments
10 integer, intent(in) :: ik
11 complex(8), intent(in) :: pmat(nstsv,nstsv,3)
12 complex(8), intent(in) :: evecsv(nstsv,nstsv),evecsvt(nstsv,nstsv)
13 ! local variables
14 integer ist,l
15 real(8) wo,t1
16 ! allocatable arrays
17 complex(8), allocatable :: a(:,:),b(:,:)
18 ! external functions
19 real(8), external :: ddot
20 allocate(a(nstsv,nstsv),b(nstsv,nstsv))
21 do l=1,3
22 ! form the momentum operator matrix elements in the first-variational basis
23  call zgemm('N','C',nstsv,nstsv,nstsv,zone,pmat(:,:,l),nstsv,evecsv,nstsv, &
24  zzero,a,nstsv)
25  call zgemm('N','N',nstsv,nstsv,nstsv,zone,evecsv,nstsv,a,nstsv,zzero,b,nstsv)
26 ! add to the total current
27  call zgemm('N','N',nstsv,nstsv,nstsv,zone,b,nstsv,evecsvt,nstsv,zzero,a,nstsv)
28  do ist=1,nstsv
29  wo=occsv(ist,ik)
30  if (abs(wo) < epsocc) cycle
31  wo=wo*wkpt(ik)
32  t1=ddot(2*nstsv,evecsvt(:,ist),1,a(:,ist),1)
33 !$OMP ATOMIC
34  jtot(l)=jtot(l)+wo*t1
35  end do
36 end do
37 deallocate(a,b)
38 end subroutine
39 
real(8), dimension(3) jtot
Definition: modmain.f90:748
real(8) epsocc
Definition: modmain.f90:903
complex(8), parameter zone
Definition: modmain.f90:1240
subroutine jtotk(ik, pmat, evecsv, evecsvt)
Definition: jtotk.f90:7
real(8), dimension(:), allocatable wkpt
Definition: modmain.f90:475
real(8), dimension(:,:), allocatable occsv
Definition: modmain.f90:905
complex(8), parameter zzero
Definition: modmain.f90:1240