The Elk Code
genspfxcg.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2013 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 genspfxcg(fxc)
7 use modmain
8 implicit none
9 ! arguments
10 complex(8), intent(out) :: fxc(ngrf,4,ngrf,4)
11 ! local variables
12 integer ig,jg,kg
13 integer iv(3),i,j
14 complex(8) z1
15 ! allocatable arrays
16 real(8), allocatable :: fxcmt(:,:,:,:),fxcir(:,:,:)
17 complex(8), allocatable :: fxcg(:)
18 allocate(fxcmt(npmtmax,natmtot,4,4),fxcir(ngtot,4,4))
19 allocate(fxcg(ngvec))
20 ! generate the kernel f_xc in real-space
21 call genspfxcr(.true.,fxcmt,fxcir)
22 ! Fourier transform the kernel to G-space
23 do i=1,4
24  do j=i,4
25  call zftrf(ngvec,ivg,vgc,fxcmt(:,:,i,j),fxcir(:,i,j),fxcg)
26  do ig=1,ngrf
27  do jg=1,ngrf
28  iv(1:3)=ivg(1:3,ig)-ivg(1:3,jg)
29  if ((iv(1) >= intgv(1,1)).and.(iv(1) <= intgv(2,1)).and. &
30  (iv(2) >= intgv(1,2)).and.(iv(2) <= intgv(2,2)).and. &
31  (iv(3) >= intgv(1,3)).and.(iv(3) <= intgv(2,3))) then
32  kg=ivgig(iv(1),iv(2),iv(3))
33  if (kg > ngvec) cycle
34  z1=fxcg(kg)
35  fxc(ig,i,jg,j)=z1
36  fxc(jg,j,ig,i)=conjg(z1)
37  end if
38  end do
39  end do
40  end do
41 end do
42 deallocate(fxcmt,fxcir,fxcg)
43 end subroutine
44 
subroutine genspfxcr(tsh, fxcmt, fxcir)
Definition: genspfxcr.f90:7
integer ngtot
Definition: modmain.f90:390
integer, dimension(:,:,:), allocatable ivgig
Definition: modmain.f90:402
real(8), dimension(:,:), allocatable vgc
Definition: modmain.f90:420
integer ngvec
Definition: modmain.f90:396
subroutine zftrf(npv, ivp, vpc, rfmt, rfir, zfp)
Definition: zftrf.f90:10
integer, dimension(:,:), allocatable ivg
Definition: modmain.f90:400
integer, dimension(2, 3) intgv
Definition: modmain.f90:394
integer npmtmax
Definition: modmain.f90:216
integer natmtot
Definition: modmain.f90:40
subroutine genspfxcg(fxc)
Definition: genspfxcg.f90:7