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,820])) 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 (any(fxctype(1) == [210,211])) wrf(1)=cmplx(0.d0,swidth,8)
46 else if (any(task == [600,601,610,620,630,640]).or.ksgwrho) then
47 ! GW Matsubara frequencies
48  call genwgw
49 else
50  nwrf=1
51  allocate(wrf(nwrf))
52  wrf(1)=cmplx(0.d0,swidth,8)
53 end if
54 ! write to VARIABLES.OUT
55 if (wrtvars) then
56  call writevars('gmaxrf',rv=gmaxrf)
57  call writevars('ngrf',iv=ngrf)
58  call writevars('nwrf',iv=nwrf)
59  call writevars('wrf',nv=nwrf,zva=wrf)
60 end if
61 
62 end subroutine
63 
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:891
complex(8), dimension(:), allocatable wrf
Definition: modmain.f90:1170
integer ngrf
Definition: modmain.f90:1164
integer ngvc
Definition: modmain.f90:401
real(8), dimension(2) wplot
Definition: modmain.f90:1081
real(8) gmaxrf
Definition: modmain.f90:1160
subroutine init3
Definition: init3.f90:7
integer ngvec
Definition: modmain.f90:399
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:425
logical ksgwrho
Definition: modgw.f90:38
integer nwplot
Definition: modmain.f90:1075
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