The Elk Code
init3.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2010 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 init3
7 use modmain
8 use modgw
9 use modtddft
10 use modvars
11 use modmpi
12 implicit none
13 ! local variables
14 integer ig,iw
15 real(8) w1,w2,t1,t2
16 
17 !-------------------------------------------------------------!
18 ! response function and perturbation theory variables !
19 !-------------------------------------------------------------!
20 ! G-vectors for response functions
21 ngrf=1
22 do ig=2,ngvec
23  if (gc(ig) > gmaxrf) then
24  ngrf=ig-1
25  exit
26  end if
27 end do
28 ngrf=min(ngrf,ngvc)
29 ! write the G-vectors to file
30 if (mp_mpi) call writegvecrf
31 ! frequencies for reponse functions
32 nwrf=1
33 if (allocated(wrf)) deallocate(wrf)
34 if (any(task == [320,330,331])) then
35  nwrf=nwplot
36  allocate(wrf(nwrf))
37  w1=wplot(1)
38  w2=max(wplot(2),w1)
39  t1=(w2-w1)/dble(nwplot)
40  do iw=1,nwplot
41  t2=w1+t1*dble(iw-1)
42  wrf(iw)=cmplx(t2,swidth,8)
43  end do
44 ! set the first frequency to zero for the bootstrap functional
45  if ((fxctype(1) == 210).or.(fxctype(1) == 211)) then
46  wrf(1)=cmplx(0.d0,swidth,8)
47  end if
48 else if (any(task == [600,601,610,620,630,640]).or.ksgwrho) then
49 ! GW Matsubara frequencies
50  call genwgw
51 else
52  nwrf=1
53  allocate(wrf(nwrf))
54  wrf(1)=cmplx(0.d0,swidth,8)
55 end if
56 ! write to VARIABLES.OUT
57 if (wrtvars) then
58  call writevars('gmaxrf',rv=gmaxrf)
59  call writevars('ngrf',iv=ngrf)
60  call writevars('nwrf',iv=nwrf)
61  call writevars('wrf',nv=nwrf,zva=wrf)
62 end if
63 
64 end subroutine
65 
subroutine genwgw
Definition: genwgw.f90:7
integer nwrf
Definition: modmain.f90:1168
integer task
Definition: modmain.f90:1299
logical mp_mpi
Definition: modmpi.f90:17
real(8) swidth
Definition: modmain.f90:895
complex(8), dimension(:), allocatable wrf
Definition: modmain.f90:1170
integer ngrf
Definition: modmain.f90:1164
integer ngvc
Definition: modmain.f90:398
real(8), dimension(2) wplot
Definition: modmain.f90:1079
real(8) gmaxrf
Definition: modmain.f90:1160
subroutine init3
Definition: init3.f90:7
integer ngvec
Definition: modmain.f90:396
subroutine writegvecrf
Definition: writegvecrf.f90:7
Definition: modgw.f90:6
logical wrtvars
Definition: modvars.f90:9
Definition: modmpi.f90:6
real(8), dimension(:), allocatable gc
Definition: modmain.f90:422
logical ksgwrho
Definition: modgw.f90:38
integer nwplot
Definition: modmain.f90:1073
integer, dimension(3) fxctype
Definition: modtddft.f90:12
subroutine writevars(vname, n1, n2, n3, n4, n5, n6, nv, iv, iva, rv, rva, zv, zva, sv, sva)
Definition: modvars.f90:16