The Elk Code
 
Loading...
Searching...
No Matches
xc_pbe.f90
Go to the documentation of this file.
1
2! This routine is based on code written by K. Burke.
3
4!BOP
5! !ROUTINE: xc_pbe
6! !INTERFACE:
7subroutine xc_pbe(n,kappa,mu,beta,rhoup,rhodn,grho,gup,gdn,g2up,g2dn,g3rho, &
8 g3up,g3dn,ex,ec,vxup,vxdn,vcup,vcdn)
9! !INPUT/OUTPUT PARAMETERS:
10! n : number of density points (in,integer)
11! kappa : parameter for large-gradient limit (in,real)
12! mu : gradient expansion coefficient (in,real)
13! beta : gradient expansion coefficient (in,real)
14! rhoup : spin-up charge density (in,real(n))
15! rhodn : spin-down charge density (in,real(n))
16! grho : |grad rho| (in,real(n))
17! gup : |grad rhoup| (in,real(n))
18! gdn : |grad rhodn| (in,real(n))
19! g2up : grad^2 rhoup (in,real(n))
20! g2dn : grad^2 rhodn (in,real(n))
21! g3rho : (grad rho).(grad |grad rho|) (in,real(n))
22! g3up : (grad rhoup).(grad |grad rhoup|) (in,real(n))
23! g3dn : (grad rhodn).(grad |grad rhodn|) (in,real(n))
24! ex : exchange energy density (out,real(n))
25! ec : correlation energy density (out,real(n))
26! vxup : spin-up exchange potential (out,real(n))
27! vxdn : spin-down exchange potential (out,real(n))
28! vcup : spin-up correlation potential (out,real(n))
29! vcdn : spin-down correlation potential (out,real(n))
30! !DESCRIPTION:
31! Spin-polarised exchange-correlation potential and energy of the generalised
32! gradient approximation functional of J. P. Perdew, K. Burke and M. Ernzerhof
33! {\it Phys. Rev. Lett.} {\bf 77}, 3865 (1996) and {\bf 78}, 1396(E) (1997).
34! The parameter $\kappa$, which controls the large-gradient limit, can be set
35! to $0.804$ or $1.245$ corresponding to the value in the original article or
36! the revised version of Y. Zhang and W. Yang, {\it Phys. Rev. Lett.}
37! {\bf 80}, 890 (1998).
38!
39! !REVISION HISTORY:
40! Modified routines written by K. Burke, October 2004 (JKD)
41!EOP
42!BOC
43implicit none
44! arguments
45integer, intent(in) :: n
46real(8), intent(in) :: kappa,mu,beta
47real(8), intent(in) :: rhoup(n),rhodn(n)
48real(8), intent(in) :: grho(n),gup(n),gdn(n)
49real(8), intent(in) :: g2up(n),g2dn(n)
50real(8), intent(in) :: g3rho(n),g3up(n),g3dn(n)
51real(8), intent(out) :: ex(n),ec(n)
52real(8), intent(out) :: vxup(n),vxdn(n)
53real(8), intent(out) :: vcup(n),vcdn(n)
54! local variables
55integer i
56real(8), parameter :: thrd=1.d0/3.d0
57real(8), parameter :: thrd2=2.d0/3.d0
58real(8), parameter :: pi=3.1415926535897932385d0
59real(8) rup,rdn,r,r2,kf,s,u,v
60real(8) rs,z,g,ks,ksg
61real(8) t,uu,vv,ww
62real(8) g2rho,exup,exdn
63do i=1,n
64 rup=rhoup(i); rdn=rhodn(i)
65! total density
66 r=rup+rdn
67 if ((rup >= 0.d0).and.(rdn >= 0.d0).and.(r > 1.d-12)) then
68! exchange energy density and potential
69! spin-up
70 r2=2.d0*rup
71 kf=(r2*3.d0*pi**2)**thrd
72 s=gup(i)/(2.d0*kf*rup)
73 u=g3up(i)/((rup**2)*(2.d0*kf)**3)
74 v=g2up(i)/(rup*(2.d0*kf)**2)
75 call x_pbe(kappa,mu,r2,s,u,v,exup,vxup(i))
76! spin-down
77 r2=2.d0*rdn
78 kf=(r2*3.d0*pi**2)**thrd
79 s=gdn(i)/(2.d0*kf*rdn)
80 u=g3dn(i)/((rdn**2)*(2.d0*kf)**3)
81 v=g2dn(i)/(rdn*(2.d0*kf)**2)
82 call x_pbe(kappa,mu,r2,s,u,v,exdn,vxdn(i))
83! average exchange energy density
84 ex(i)=(exup*rhoup(i)+exdn*rhodn(i))/r
85! correlation
86 rs=(3.d0/(4.d0*pi*r))**thrd
87 z=(rhoup(i)-rhodn(i))/r
88 g=((1.d0+z)**thrd2+(1.d0-z)**thrd2)/2.d0
89 kf=(r*3.d0*pi**2)**thrd
90 ks=sqrt(4.d0*kf/pi)
91 ksg=2.d0*ks*g
92 t=grho(i)/(ksg*r)
93 uu=g3rho(i)/((r**2)*ksg**3)
94 g2rho=g2up(i)+g2dn(i)
95 vv=g2rho/(r*ksg**2)
96 ww=(gup(i)**2-gdn(i)**2-z*grho(i)**2)/(r*r*ksg**2)
97 call c_pbe(beta,rs,z,t,uu,vv,ww,ec(i),vcup(i),vcdn(i))
98 else
99 ex(i)=0.d0
100 ec(i)=0.d0
101 vxup(i)=0.d0
102 vxdn(i)=0.d0
103 vcup(i)=0.d0
104 vcdn(i)=0.d0
105 end if
106end do
107end subroutine
108!EOC
109
subroutine c_pbe(beta, rs, z, t, uu, vv, ww, ec, vcup, vcdn)
Definition c_pbe.f90:5
elemental subroutine x_pbe(kappa, mu, rho, s, u, v, ex, vx)
Definition x_pbe.f90:5
subroutine xc_pbe(n, kappa, mu, beta, rhoup, rhodn, grho, gup, gdn, g2up, g2dn, g3rho, g3up, g3dn, ex, ec, vxup, vxdn, vcup, vcdn)
Definition xc_pbe.f90:9