The Elk Code
genvfxcg.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2012 S. Sharma, J. K. Dewhurst and E. K. U. Gross.
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 genvfxcg(gclgq,nm,vfxc)
7 use modmain
8 implicit none
9 ! arguments
10 real(8), intent(in) :: gclgq(ngrf)
11 integer, intent(in) :: nm
12 complex(8), intent(out) :: vfxc(nm,nm,nwrf)
13 ! local variables
14 integer ig,jg,kg,i1,i2,i3,j1,j2,j3
15 complex(8) z1
16 ! allocatable arrays
17 real(8), allocatable :: fxcmt(:,:),fxcir(:)
18 complex(8), allocatable :: fxcg(:)
19 allocate(fxcmt(npmtmax,natmtot),fxcir(ngtot),fxcg(ngvec))
20 ! generate the kernel f_xc in real-space
21 call genfxcr(.true.,fxcmt,fxcir)
22 ! Fourier transform the kernel to G-space
23 call zftrf(ngvec,ivg,vgc,fxcmt,fxcir,fxcg)
24 do jg=1,ngrf
25  j1=ivg(1,jg); j2=ivg(2,jg); j3=ivg(3,jg)
26  do ig=1,ngrf
27  i1=ivg(1,ig)-j1; i2=ivg(2,ig)-j2; i3=ivg(3,ig)-j3
28  if ((i1 < intgv(1,1)).or.(i1 > intgv(2,1)).or. &
29  (i2 < intgv(1,2)).or.(i2 > intgv(2,2)).or. &
30  (i3 < intgv(1,3)).or.(i3 > intgv(2,3))) cycle
31  kg=ivgig(i1,i2,i3)
32  if (kg <= ngvec) then
33  z1=fxcg(kg)/(gclgq(ig)*gclgq(jg))
34  vfxc(ig,jg,1:nwrf)=z1
35  else
36  vfxc(ig,jg,1:nwrf)=0.d0
37  end if
38  end do
39 end do
40 deallocate(fxcmt,fxcir,fxcg)
41 end subroutine
42 
integer ngtot
Definition: modmain.f90:393
subroutine genfxcr(tsh, fxcmt, fxcir)
Definition: genfxcr.f90:7
integer, dimension(:,:,:), allocatable ivgig
Definition: modmain.f90:405
subroutine genvfxcg(gclgq, nm, vfxc)
Definition: genvfxcg.f90:7
real(8), dimension(:,:), allocatable vgc
Definition: modmain.f90:423
integer ngvec
Definition: modmain.f90:399
subroutine zftrf(npv, ivp, vpc, rfmt, rfir, zfp)
Definition: zftrf.f90:10
integer, dimension(:,:), allocatable ivg
Definition: modmain.f90:403
integer, dimension(2, 3) intgv
Definition: modmain.f90:397
integer npmtmax
Definition: modmain.f90:218
integer natmtot
Definition: modmain.f90:40