9subroutine genspchi0(ik,lock,vqpl,jlgqr,ylmgq,sfacgq,chi0)
62integer,
intent(in) :: ik
63integer(omp_lock_kind),
intent(inout) :: lock(nwrf)
64real(8),
intent(in) :: vqpl(3),jlgqr(njcmax,nspecies,ngrf)
65complex(8),
intent(in) :: ylmgq(lmmaxo,ngrf),sfacgq(ngrf,natmtot)
66complex(8),
intent(inout) :: chi0(ngrf,4,ngrf,4,nwrf)
70integer nst,nstq,ist,jst,kst,lst
71integer ig,jg,a,b,i,j,nthd
72real(8) vkql(3),ei,ej,eij,t1
75integer idx(nstsv),idxq(nstsv)
76integer ngp(nspnfv),ngpq(nspnfv)
78integer,
allocatable :: igpig(:,:),igpqig(:,:)
79complex(4),
allocatable :: wfmt(:,:,:,:),wfir(:,:,:)
80complex(4),
allocatable :: wfmtq(:,:,:,:),wfirq(:,:,:)
81complex(4),
allocatable :: crhomt(:,:),crhoir(:)
82complex(8),
allocatable :: zrhoig(:,:),zw(:),c(:,:,:,:)
85 write(*,
'("Error(genspchi0): spin-unpolarised calculation")')
90vkql(1:3)=
vkl(1:3,ik)+vqpl(1:3)
108allocate(igpig(
ngkmax,nspnfv))
110call genwfsvp_sp(.false.,.false.,nst,idx,
ngdgc,
igfc,
vkl(:,ik),ngp,igpig,wfmt, &
113allocate(igpqig(
ngkmax,nspnfv))
115call genwfsvp_sp(.false.,.false.,nstq,idxq,
ngdgc,
igfc,vkql,ngpq,igpqig,wfmtq, &
125allocate(zrhoig(ngrf,4),zw(nwrf),c(ngrf,4,ngrf,4))
133 if (abs(t1) < 1.d-8) cycle
138 zw(iw)=t1/(eij+
wrf(iw))
148 if (((a == 1).and.(kst >
nstfv)).or. &
149 ((a == 2).and.(kst <=
nstfv)).or. &
150 ((b == 1).and.(lst >
nstfv)).or. &
151 ((b == 2).and.(lst <=
nstfv)))
then
156 call gencrho(.true.,.false.,
ngtc,wfmt(:,:,a,ist),wfir(:,a,ist), &
157 wfmtq(:,:,b,jst),wfirq(:,b,jst),crhomt,crhoir)
158 call zftcf(ngrf,jlgqr,ylmgq,ngrf,sfacgq,crhomt,crhoir,zrhoig(:,i))
165 z1=conjg(zrhoig(jg,j))
169 c(ig,i,jg,j)=zrhoig(ig,i)*z1
176 call omp_set_lock(lock(iw))
182 call zaxpy(ngrf,z1,c(:,i,jg,j),1,chi0(:,i,jg,j,iw),1)
186 call omp_unset_lock(lock(iw))
193deallocate(crhomt,crhoir,zrhoig,zw,c)
196deallocate(wfmt,wfmtq,wfir,wfirq)
subroutine genwfsvp_sp(tsh, tgp, nst, idx, ngridg_, igfft_, vpl, ngp, igpig, wfmt, ld, wfir)
integer, dimension(3) ngdgc
integer, dimension(:,:), allocatable ivk
integer, dimension(:), allocatable igfc
complex(8), dimension(:), allocatable wrf
real(8), dimension(:,:), allocatable vkl
integer, dimension(:,:,:), allocatable ivkik
real(8), dimension(:,:), allocatable occsv
real(8), dimension(:,:), allocatable evalsv