42real(8),
allocatable :: w(:),e(:,:),f(:,:),d(:,:,:)
43complex(8),
allocatable :: r(:,:,:),zv(:)
44complex(8),
allocatable :: cc1(:,:),cc2(:,:)
45complex(8),
allocatable :: ce1(:,:),ce2(:,:),cs1(:,:)
46complex(8),
allocatable :: chi2w(:),eta2w(:),sigma2w(:)
91 write(*,
'("Info(nonlinopt): ",I6," of ",I6," k-points")') ik,
nkptnr
108 d(m,n,i)=dble(r(m,m,i))-dble(r(n,n,i))
117 if (abs(t1) >
swidth)
then
127 cc1(:,:)=0.d0; cc2(:,:)=0.d0
128 ce1(:,:)=0.d0; ce2(:,:)=0.d0
135 z1=0.5d0*r(n,m,a)*(r(m,l,b)*r(l,n,c)+r(m,l,c)*r(l,n,b))
138 if (abs(t1) >
swidth)
then
141 if (abs(f(n,m)) >
epsocc)
then
142 cc2(m,n)=cc2(m,n)+2.d0*f(n,m)*z2
144 if (abs(f(m,l)) >
epsocc)
then
145 cc1(m,l)=cc1(m,l)+f(m,l)*z2
147 if (abs(f(l,n)) >
epsocc)
then
148 cc1(l,n)=cc1(l,n)+f(l,n)*z2
154 if (abs(f(n,l)) >
epsocc)
then
156 if (abs(t1) >
swidth)
then
157 ce1(l,n)=ce1(l,n)+f(n,l)*z2/t1**2
160 if (abs(f(l,m)) >
epsocc)
then
162 if (abs(t1) >
swidth)
then
163 ce1(m,l)=ce1(m,l)-f(l,m)*z2/t1**2
166 if (abs(f(n,m)) >
epsocc)
then
169 if (abs(t1) >
swidth)
then
171 z1=2.d0*f(n,m)*(e(m,l)-e(l,n))*t1*z1
175 z1=e(n,l)*r(l,m,a)*(r(m,n,b)*r(n,l,c)+r(m,n,c)*r(n,l,b)) &
176 -e(l,m)*r(n,l,a)*(r(l,m,b)*r(m,n,c)+r(l,m,c)*r(m,n,b))
177 z1=0.25d0*f(n,m)*t1*z1
183 if (abs(f(n,m)) >
epsocc)
then
186 if (abs(t1) >
swidth)
then
188 z1=r(n,m,a)*(d(m,n,b)*r(m,n,c)+d(m,n,c)*r(m,n,b))
193 z1=r(n,m,a)*(r(m,n,b)*d(m,n,c)+r(m,n,c)*d(m,n,b))
195 z1=0.25d0*f(n,m)*t1*z1
203 zv(:)=1.d0/(e(m,n)-w(:)+eta)
204 chi2w(:)=chi2w(:)+cc1(m,n)*zv(:)
205 eta2w(:)=eta2w(:)+ce1(m,n)*zv(:)
206 sigma2w(:)=sigma2w(:)+cs1(m,n)*zv(:)
207 zv(:)=1.d0/(e(m,n)-2.d0*(w(:)-eta))
208 chi2w(:)=chi2w(:)+cc2(m,n)*zv(:)
209 eta2w(:)=eta2w(:)+ce2(m,n)*zv(:)
214 deallocate(e,f,d,r,zv)
215 deallocate(cc1,cc2,ce1,ce2,cs1)
221 sigma2w(:)=t0*sigma2w(:)
224 call mpi_allreduce(mpi_in_place,chi2w,
nwplot,mpi_double_complex,mpi_sum, &
226 call mpi_allreduce(mpi_in_place,eta2w,
nwplot,mpi_double_complex,mpi_sum, &
228 call mpi_allreduce(mpi_in_place,sigma2w,
nwplot,mpi_double_complex,mpi_sum, &
233 write(fname,
'("CHI_II_2WWW_",3I1,".OUT")') a,b,c
234 open(50,file=trim(fname),form=
'FORMATTED')
235 write(fname,
'("ETA_II_2WWW_",3I1,".OUT")') a,b,c
236 open(51,file=trim(fname),form=
'FORMATTED')
237 write(fname,
'("SIGMA_II_2WWW_",3I1,".OUT")') a,b,c
238 open(52,file=trim(fname),form=
'FORMATTED')
241 write(50,
'(2G18.10)') t1,dble(chi2w(iw))
242 write(51,
'(2G18.10)') t1,dble(eta2w(iw))
243 write(52,
'(2G18.10)') t1,dble(sigma2w(iw))
250 write(50,
'(2G18.10)') t1,aimag(chi2w(iw))
251 write(51,
'(2G18.10)') t1,aimag(eta2w(iw))
252 write(52,
'(2G18.10)') t1,aimag(sigma2w(iw))
258 chi2w(:)=chi2w(:)+eta2w(:)+sigma2w(:)
259 write(fname,
'("CHI_2WWW_",3I1,".OUT")') a,b,c
260 open(50,file=trim(fname),form=
'FORMATTED')
263 write(50,
'(2G18.10)') t1,dble(chi2w(iw))
268 write(50,
'(2G18.10)') t1,aimag(chi2w(iw))
276 write(*,
'("Info(nonlinopt):")')
277 write(*,
'(" Following the convention in Phys. Rev. B 48, 11705 (1993) and")')
278 write(*,
'(" Phys. Rev. B 53, 10751 (1996), the second-order response")')
279 write(*,χωωωηωωωωσωωω
'(" functions _II(-2;,), _II(-2;,) and i/2 _II(-2;,)")')
280 write(*,
'(" were written to the files CHI_II_2WWW_abc.OUT,")')
281 write(*,
'(" ETA_II_2WWW_abc.OUT and SIGMA_II_2WWW_abc.OUT, respectively")')
283 write(*,χωωω
'(" The total second-order response function (-2;,) was")')
284 write(*,
'(" written to the file CHI_2WWW_abc.OUT")')
286 write(*,
'(" This was done for Cartesian components :")')
288 write(*,
'(" a = ",I1,", b = ",I1,", c = ",I1)')
optcomp(1:3,ioc)
292call writetest(125,
'non-linear susceptibility',nv=
nwplot,tol=1.d-2,zva=chi2w)
293deallocate(w,chi2w,eta2w,sigma2w)
integer, dimension(3, 27) optcomp
integer, dimension(:,:), allocatable ivk
real(8), dimension(:,:), allocatable vkl
integer, dimension(:,:,:), allocatable ivkik
real(8), dimension(:,:), allocatable occsv
real(8), dimension(:,:), allocatable evalsv