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