15 subroutine xcifc(xctype,n,c_tb09,tempa,rho,rhoup,rhodn,grho,gup,gdn,g2rho,g2up,&
16 g2dn,g3rho,g3up,g3dn,grho2,gup2,gdn2,gupdn,tau,tauup,taudn,ex,ec,vx,vc,vxup, &
17 vxdn,vcup,vcdn,dxdgr2,dxdgu2,dxdgd2,dxdgud,dcdgr2,dcdgu2,dcdgd2,dcdgud,dxdg2r,&
18 dxdg2u,dxdg2d,dcdg2r,dcdg2u,dcdg2d,wx,wxup,wxdn,wc,wcup,wcdn,dtdr,dtdru,dtdrd,&
19 dtdgr2,dtdgu2,dtdgd2,dtdg2r,dtdg2u,dtdg2d)
101 integer,
intent(in) :: xctype(3),n
103 real(8),
optional,
intent(in) :: c_tb09,tempa
104 real(8),
optional,
intent(in) :: rho(n),rhoup(n),rhodn(n)
105 real(8),
optional,
intent(in) :: grho(n),gup(n),gdn(n)
106 real(8),
optional,
intent(in) :: g2rho(n),g2up(n),g2dn(n)
107 real(8),
optional,
intent(in) :: g3rho(n),g3up(n),g3dn(n)
108 real(8),
optional,
intent(in) :: grho2(n),gup2(n),gdn2(n),gupdn(n)
109 real(8),
optional,
intent(in) :: tau(n),tauup(n),taudn(n)
110 real(8),
optional,
intent(out) :: ex(n),ec(n),vx(n),vc(n)
111 real(8),
optional,
intent(out) :: vxup(n),vxdn(n),vcup(n),vcdn(n)
112 real(8),
optional,
intent(out) :: dxdgr2(n),dxdgu2(n),dxdgd2(n),dxdgud(n)
113 real(8),
optional,
intent(out) :: dxdg2r(n),dxdg2u(n),dxdg2d(n)
114 real(8),
optional,
intent(out) :: wx(n),wxup(n),wxdn(n)
115 real(8),
optional,
intent(out) :: dcdgr2(n),dcdgu2(n),dcdgd2(n),dcdgud(n)
116 real(8),
optional,
intent(out) :: dcdg2r(n),dcdg2u(n),dcdg2d(n)
117 real(8),
optional,
intent(out) :: wc(n),wcup(n),wcdn(n)
118 real(8),
optional,
intent(out) :: dtdr(n),dtdru(n),dtdrd(n)
119 real(8),
optional,
intent(out) :: dtdgr2(n),dtdgu2(n),dtdgd2(n)
120 real(8),
optional,
intent(out) :: dtdg2r(n),dtdg2u(n),dtdg2d(n)
122 real(8) kappa,mu,beta
124 real(8),
allocatable :: ra(:,:)
127 write(*,
'("Error(xcifc): n < 1 : ",I8)') n
131 select case(abs(xctype(1)))
134 if (
present(ex)) ex(1:n)=0.d0
135 if (
present(ec)) ec(1:n)=0.d0
136 if (
present(vx)) vx(1:n)=0.d0
137 if (
present(vc)) vc(1:n)=0.d0
138 if (
present(vxup)) vxup(1:n)=0.d0
139 if (
present(vxdn)) vxdn(1:n)=0.d0
140 if (
present(vcup)) vcup(1:n)=0.d0
141 if (
present(vcdn)) vcdn(1:n)=0.d0
146 if (
present(rho).and.
present(ex).and.
present(ec).and.
present(vx) &
147 .and.
present(vc))
then 148 call xc_pzca(n,rho,ex,ec,vx,vc)
156 if (
present(rhoup).and.
present(rhodn).and.
present(ex).and.
present(ec) &
157 .and.
present(vxup).and.
present(vxdn).and.
present(vcup) &
158 .and.
present(vcdn))
then 160 call xc_pwca(n,rhoup,rhodn,ex,ec,vxup,vxdn,vcup,vcdn)
161 else if (
present(rho).and.
present(ex).and.
present(ec).and.
present(vx) &
162 .and.
present(vc))
then 165 ra(1:n,1)=0.5d0*rho(1:n)
166 call xc_pwca(n,ra,ra,ex,ec,vx,ra(:,2),vc,ra(:,2))
174 if (
present(rho).and.
present(ex).and.
present(ec).and.
present(vx) &
175 .and.
present(vc))
then 186 if (
present(rhoup).and.
present(rhodn).and.
present(ex).and.
present(ec) &
187 .and.
present(vxup).and.
present(vxdn).and.
present(vcup) &
188 .and.
present(vcdn))
then 190 call xc_vbh(n,rhoup,rhodn,ex,ec,vxup,vxdn,vcup,vcdn)
191 else if (
present(rho).and.
present(ex).and.
present(ec).and.
present(vx) &
192 .and.
present(vc))
then 195 ra(1:n,1)=0.5d0*rho(1:n)
196 call xc_vbh(n,ra,ra,ex,ec,vx,ra(:,2),vc,ra(:,2))
204 if (xctype(1) == 21)
then 209 mu=0.2195149727645171d0
210 beta=0.06672455060314922d0
211 if (xctype(1) == 22)
then 219 if (
present(rhoup).and.
present(rhodn).and.
present(grho).and.
present(gup) &
220 .and.
present(gdn).and.
present(g2up).and.
present(g2dn).and.
present(g3rho) &
221 .and.
present(g3up).and.
present(g3dn).and.
present(ex).and.
present(ec) &
222 .and.
present(vxup).and.
present(vxdn).and.
present(vcup) &
223 .and.
present(vcdn))
then 224 call xc_pbe(n,kappa,mu,beta,rhoup,rhodn,grho,gup,gdn,g2up,g2dn,g3rho,g3up, &
225 g3dn,ex,ec,vxup,vxdn,vcup,vcdn)
226 else if (
present(rho).and.
present(grho).and.
present(g2rho) &
227 .and.
present(g3rho).and.
present(ex).and.
present(ec).and.
present(vx) &
228 .and.
present(vc))
then 230 ra(1:n,1)=0.5d0*rho(1:n)
231 ra(1:n,2)=0.5d0*grho(1:n)
232 ra(1:n,3)=0.5d0*g2rho(1:n)
233 ra(1:n,4)=0.25d0*g3rho(1:n)
234 call xc_pbe(n,kappa,mu,beta,ra,ra,grho,ra(:,2),ra(:,2),ra(:,3),ra(:,3), &
235 g3rho,ra(:,4),ra(:,4),ex,ec,vx,ra(:,5),vc,ra(:,5))
243 if (
present(rho).and.
present(grho).and.
present(g2rho).and.
present(g3rho) &
244 .and.
present(ex).and.
present(ec).and.
present(vx).and.
present(vc))
then 245 call xc_wc06(n,rho,grho,g2rho,g3rho,ex,ec,vx,vc)
252 if (
present(rho).and.
present(grho).and.
present(g2rho).and.
present(g3rho) &
253 .and.
present(ex).and.
present(ec).and.
present(vx).and.
present(vc))
then 254 call xc_am05(n,rho,grho,g2rho,g3rho,ex,ec,vx,vc)
260 if (
present(rhoup).and.
present(rhodn).and.
present(dtdru) &
261 .and.
present(dtdrd))
then 262 call k_tf_sp(n,rhoup,rhodn,dtdru,dtdrd)
263 if (
present(dtdgu2)) dtdgu2(1:n)=0.d0
264 if (
present(dtdgd2)) dtdgd2(1:n)=0.d0
265 else if (
present(rho).and.
present(dtdr))
then 266 call k_tf(n,rho,dtdr)
267 if (
present(dtdgr2)) dtdgr2(1:n)=0.d0
274 if (
present(rhoup).and.
present(rhodn).and.
present(tauup).and.
present(taudn) &
275 .and.
present(dtdru).and.
present(dtdrd))
then 276 call k_tfsc_sp(n,rhoup,rhodn,tauup,taudn,dtdru,dtdrd)
277 if (
present(dtdgu2)) dtdgu2(1:n)=0.d0
278 if (
present(dtdgd2)) dtdgd2(1:n)=0.d0
279 else if (
present(rho).and.
present(tau).and.
present(dtdr))
then 280 call k_tfsc(n,rho,tau,dtdr)
281 if (
present(dtdgr2)) dtdgr2(1:n)=0.d0
287 if (
present(rhoup).and.
present(rhodn).and.
present(gup2).and.
present(gdn2) &
288 .and.
present(dtdru).and.
present(dtdrd).and.
present(dtdgu2) &
289 .and.
present(dtdgd2))
then 290 call k_tfvw_sp(n,rhoup,rhodn,gup2,gdn2,dtdru,dtdrd,dtdgu2,dtdgd2)
291 else if (
present(rho).and.
present(grho2).and.
present(dtdr) &
292 .and.
present(dtdgr2))
then 293 call k_tfvw(n,rho,grho2,dtdr,dtdgr2)
299 if (
present(rhoup).and.
present(rhodn).and.
present(g2up).and.
present(g2dn) &
300 .and.
present(gup2).and.
present(gdn2).and.
present(gupdn).and.
present(tauup) &
301 .and.
present(taudn).and.
present(vxup).and.
present(vxdn).and.
present(vcup) &
302 .and.
present(vcdn).and.
present(dxdgu2).and.
present(dxdgd2) &
303 .and.
present(dxdgud).and.
present(dcdgu2).and.
present(dcdgd2) &
304 .and.
present(dcdgud).and.
present(dxdg2u).and.
present(dxdg2d) &
305 .and.
present(dcdg2u).and.
present(dcdg2d).and.
present(wxup).and.
present(wxdn)&
306 .and.
present(wcup).and.
present(wcdn))
then 308 if (
present(ex).and.
present(ec))
then 310 call xcifc_libxc(xctype,n,rhoup=rhoup,rhodn=rhodn,g2up=g2up,g2dn=g2dn, &
311 gup2=gup2,gdn2=gdn2,gupdn=gupdn,tauup=tauup,taudn=taudn,ex=ex,ec=ec, &
312 vxup=vxup,vxdn=vxdn,vcup=vcup,vcdn=vcdn,dxdgu2=dxdgu2,dxdgd2=dxdgd2, &
313 dxdgud=dxdgud,dcdgu2=dcdgu2,dcdgd2=dcdgd2,dcdgud=dcdgud,dxdg2u=dxdg2u, &
314 dxdg2d=dxdg2d,dcdg2u=dcdg2u,dcdg2d=dcdg2d,wxup=wxup,wxdn=wxdn,wcup=wcup,&
318 call xcifc_libxc(xctype,n,c_tb09=c_tb09,rhoup=rhoup,rhodn=rhodn, &
319 g2up=g2up,g2dn=g2dn,gup2=gup2,gdn2=gdn2,gupdn=gupdn,tauup=tauup, &
320 taudn=taudn,vxup=vxup,vxdn=vxdn,vcup=vcup,vcdn=vcdn,dxdgu2=dxdgu2, &
321 dxdgd2=dxdgd2,dxdgud=dxdgud,dcdgu2=dcdgu2,dcdgd2=dcdgd2,dcdgud=dcdgud, &
322 dxdg2u=dxdg2u,dxdg2d=dxdg2d,dcdg2u=dcdg2u,dcdg2d=dcdg2d,wxup=wxup, &
323 wxdn=wxdn,wcup=wcup,wcdn=wcdn)
325 else if (
present(rhoup).and.
present(rhodn).and.
present(gup2) &
326 .and.
present(gdn2).and.
present(gupdn).and.
present(ex).and.
present(ec) &
327 .and.
present(vxup).and.
present(vxdn).and.
present(vcup).and.
present(vcdn) &
328 .and.
present(dxdgu2).and.
present(dxdgd2).and.
present(dxdgud) &
329 .and.
present(dcdgu2).and.
present(dcdgd2).and.
present(dcdgud))
then 331 call xcifc_libxc(xctype,n,rhoup=rhoup,rhodn=rhodn,gup2=gup2,gdn2=gdn2, &
332 gupdn=gupdn,ex=ex,ec=ec,vxup=vxup,vxdn=vxdn,vcup=vcup,vcdn=vcdn, &
333 dxdgu2=dxdgu2,dxdgd2=dxdgd2,dxdgud=dxdgud,dcdgu2=dcdgu2,dcdgd2=dcdgd2, &
335 else if (
present(rhoup).and.
present(rhodn).and.
present(g2up) &
336 .and.
present(g2dn).and.
present(gup2).and.
present(gdn2).and.
present(tauup) &
337 .and.
present(taudn).and.
present(dtdru).and.
present(dtdrd) &
338 .and.
present(dtdg2u).and.
present(dtdg2d).and.
present(dtdgu2) &
339 .and.
present(dtdgd2).and.
present(wxup).and.
present(wxdn))
then 341 call xcifc_libxc(xctype,n,rhoup=rhoup,rhodn=rhodn,g2up=g2up,g2dn=g2dn, &
342 gup2=gup2,gdn2=gdn2,tauup=tauup,taudn=taudn,vxup=dtdru,vxdn=dtdrd, &
343 dxdg2u=dtdg2u,dxdg2d=dtdg2d,dxdgu2=dtdgu2,dxdgd2=dtdgd2,wxup=wxup, &
345 else if (
present(rhoup).and.
present(rhodn).and.
present(ex).and.
present(ec) &
346 .and.
present(vxup).and.
present(vxdn).and.
present(vcup) &
347 .and.
present(vcdn))
then 349 call xcifc_libxc(xctype,n,tempa=tempa,rhoup=rhoup,rhodn=rhodn,ex=ex,ec=ec, &
350 vxup=vxup,vxdn=vxdn,vcup=vcup,vcdn=vcdn)
351 else if (
present(rho).and.
present(g2rho).and.
present(grho2).and.
present(tau) &
352 .and.
present(vx).and.
present(vc).and.
present(dxdgr2).and.
present(dcdgr2) &
353 .and.
present(dxdg2r).and.
present(dcdg2r).and.
present(wx).and.
present(wc))
then 355 if (
present(ex).and.
present(ec))
then 357 call xcifc_libxc(xctype,n,rho=rho,g2rho=g2rho,grho2=grho2,tau=tau,ex=ex, &
358 ec=ec,vx=vx,vc=vc,dxdgr2=dxdgr2,dcdgr2=dcdgr2,dxdg2r=dxdg2r, &
359 dcdg2r=dcdg2r,wx=wx,wc=wc)
362 call xcifc_libxc(xctype,n,c_tb09=c_tb09,rho=rho,g2rho=g2rho,grho2=grho2, &
363 tau=tau,vx=vx,vc=vc,dxdgr2=dxdgr2,dcdgr2=dcdgr2,dxdg2r=dxdg2r, &
364 dcdg2r=dcdg2r,wx=wx,wc=wc)
366 else if (
present(rho).and.
present(grho2).and.
present(ex).and.
present(ec) &
367 .and.
present(vx).and.
present(vc).and.
present(dxdgr2) &
368 .and.
present(dcdgr2))
then 370 call xcifc_libxc(xctype,n,rho=rho,grho2=grho2,ex=ex,ec=ec,vx=vx,vc=vc, &
371 dxdgr2=dxdgr2,dcdgr2=dcdgr2)
372 else if (
present(rho).and.
present(g2rho).and.
present(grho2).and.
present(tau) &
373 .and.
present(dtdr).and.
present(dtdgr2).and.
present(dtdg2r) &
374 .and.
present(wx))
then 376 call xcifc_libxc(xctype,n,rho=rho,g2rho=g2rho,grho2=grho2,tau=tau,vx=dtdr, &
377 dxdgr2=dtdgr2,dxdg2r=dtdg2r,wx=wx)
378 else if (
present(rho).and.
present(ex).and.
present(ec).and.
present(vx) &
379 .and.
present(vc))
then 381 call xcifc_libxc(xctype,n,tempa=tempa,rho=rho,ex=ex,ec=ec,vx=vx,vc=vc)
387 write(*,
'("Error(xcifc): xctype not defined : ",I8)') xctype(1)
392 if (xctype(1) <= -2)
then 393 if (
present(vx)) vx(1:n)=0.d0
394 if (
present(vxup)) vxup(1:n)=0.d0
395 if (
present(vxdn)) vxdn(1:n)=0.d0
400 write(*,
'("Error(xcifc): missing arguments for exchange-correlation type ",& 410 subroutine getxcdata(xctype,xcdescr,xcspin,xcgrad,hybrid,hybridc)
432 integer,
intent(in) :: xctype(3)
433 character(264),
intent(out) :: xcdescr
434 integer,
intent(out) :: xcspin,xcgrad
435 logical,
intent(out) :: hybrid
436 real(8),
intent(out) :: hybridc
437 select case(abs(xctype(1)))
439 xcdescr=
'No density-derived exchange-correlation energy or potential' 444 xcdescr=
'Perdew-Zunger/Ceperley-Alder, Phys. Rev. B 23, 5048 (1981)' 448 xcdescr=
'Perdew-Wang/Ceperley-Alder, Phys. Rev. B 45, 13244 (1992)' 452 xcdescr=
'X-alpha approximation, J. C. Slater, Phys. Rev. 81, 385 (1951)' 456 xcdescr=
'von Barth-Hedin, J. Phys. C 5, 1629 (1972)' 460 xcdescr=
'Perdew-Burke-Ernzerhof, Phys. Rev. Lett. 77, 3865 (1996)' 464 xcdescr=
'Revised PBE, Zhang-Yang, Phys. Rev. Lett. 80, 890 (1998)' 468 xcdescr=
'PBEsol, Phys. Rev. Lett. 100, 136406 (2008)' 472 xcdescr=
'Wu-Cohen exchange + PBE correlation, Phys. Rev. B 73, 235116 (2006)' 476 xcdescr=
'Armiento-Mattsson functional, Phys. Rev. B 72, 85108 (2005)' 480 xcdescr=
'Thomas-Fermi kinetic energy functional' 484 xcdescr=
'Thomas-Fermi kinetic energy functional scaled by the ratio of the & 485 &exact τ to the TF τ' 489 xcdescr=
'Thomas-Fermi-von Weizsacker kinetic energy functional' 494 call xcdata_libxc(xctype,xcdescr,xcspin,xcgrad,hybrid,hybridc)
497 write(*,
'("Error(getxcdata): xctype not defined : ",I8)') xctype(1)
subroutine k_tf_sp(n, rhoup, rhodn, dtdru, dtdrd)
subroutine xc_pbe(n, kappa, mu, beta, rhoup, rhodn, grho, gup, gdn, g2up, g2dn, g3rho, g3up, g3dn, ex, ec, vxup, vxdn, vcup, vcdn)
subroutine xc_xalpha(n, rho, exc, vxc)
subroutine k_tfsc(n, rho, tau, dtdr)
subroutine k_tf(n, rho, dtdr)
subroutine xcifc_libxc(xctype, n, c_tb09, tempa, rho, rhoup, rhodn, g2rho, g2up, g2dn, grho2, gup2, gdn2, gupdn, tau, tauup, taudn, ex, ec, vx, vc, vxup, vxdn, vcup, vcdn, dxdgr2, dxdgu2, dxdgd2, dxdgud, dcdgr2, dcdgu2, dcdgd2, dcdgud, dxdg2r, dxdg2u, dxdg2d, dcdg2r, dcdg2u, dcdg2d, wx, wxup, wxdn, wc, wcup, wcdn)
subroutine xcdata_libxc(xctype, xcdescr, xcspin, xcgrad, hybrid, hybridc)
subroutine getxcdata(xctype, xcdescr, xcspin, xcgrad, hybrid, hybridc)
subroutine k_tfsc_sp(n, rhoup, rhodn, tauup, taudn, dtdru, dtdrd)
subroutine k_tfvw_sp(n, rhoup, rhodn, gup2, gdn2, dtdru, dtdrd, dtdgu2, dtdgd2)
subroutine xc_wc06(n, rho, grho, g2rho, g3rho, ex, ec, vx, vc)
subroutine xc_pwca(n, rhoup, rhodn, ex, ec, vxup, vxdn, vcup, vcdn)
subroutine xc_am05(n, rho, grho, g2rho, g3rho, ex, ec, vx, vc)
subroutine xc_vbh(n, rhoup, rhodn, ex, ec, vxup, vxdn, vcup, vcdn)
subroutine k_tfvw(n, rho, grho2, dtdr, dtdgr2)
subroutine xcifc(xctype, n, c_tb09, tempa, rho, rhoup, rhodn, grho, gup, gdn, g2rho, g2up, g2dn, g3rho, g3up, g3dn, grho2, gup2, gdn2, gupdn, tau, tauup, taudn, ex, ec, vx, vc, vxup, vxdn, vcup, vcdn, dxdgr2, dxdgu2, dxdgd2, dxdgud, dcdgr2, dcdgu2, dcdgd2, dcdgud, dxdg2r, dxdg2u, dxdg2d, dcdg2r, dcdg2u, dcdg2d, wx, wxup, wxdn, wc, wcup, wcdn, dtdr, dtdru, dtdrd, dtdgr2, dtdgu2, dtdgd2, dtdg2r, dtdg2u, dtdg2d)
subroutine xc_pzca(n, rho, ex, ec, vx, vc)