14 use,
intrinsic :: iso_fortran_env
38 integer,
intent(in) :: l, mr, nr
39 real(real64),
intent(out) :: ylm(nr)
40 real(real64),
intent(in) :: rr(nr), xx(3, nr)
46 real(real64) :: cost, phi
48 real(real64) :: bs2, bs3, bs6, bs12
54 if (l > 3 .or. l < -5) stop
'ylm_wannier l out of range '
56 if (mr < 1 .or. mr > 2*l + 1) stop
'ylm_wannier mr out of range'
58 if (mr < 1 .or. mr > abs(l) + 1) stop
'ylm_wannier mr out of range'
72 cost = xx(3, ir) / rr(ir)
76 phi =
atan2(xx(2, ir), xx(1, ir))
82 if (mr == 1) ylm(ir) =
pz(cost)
83 if (mr == 2) ylm(ir) =
px(cost, phi)
84 if (mr == 3) ylm(ir) =
py(cost, phi)
86 if (mr == 1) ylm(ir) =
dz2(cost)
87 if (mr == 2) ylm(ir) =
dxz(cost, phi)
88 if (mr == 3) ylm(ir) =
dyz(cost, phi)
89 if (mr == 4) ylm(ir) =
dx2my2(cost, phi)
90 if (mr == 5) ylm(ir) =
dxy(cost, phi)
92 if (mr == 1) ylm(ir) =
fz3(cost)
93 if (mr == 2) ylm(ir) =
fxz2(cost, phi)
94 if (mr == 3) ylm(ir) =
fyz2(cost, phi)
95 if (mr == 4) ylm(ir) =
fzx2my2(cost, phi)
96 if (mr == 5) ylm(ir) =
fxyz(cost, phi)
97 if (mr == 6) ylm(ir) =
fxx2m3y2(cost, phi)
98 if (mr == 7) ylm(ir) =
fy3x2my2(cost, phi)
100 if (mr == 1) ylm(ir) = bs2 * (
s() +
px(cost, phi))
101 if (mr == 2) ylm(ir) = bs2 * (
s() -
px(cost, phi))
103 if (mr == 1) ylm(ir) = bs3 *
s() - bs6 *
px(cost, phi) + bs2 *
py(cost, phi)
104 if (mr == 2) ylm(ir) = bs3 *
s() - bs6 *
px(cost, phi) - bs2 *
py(cost, phi)
105 if (mr == 3) ylm(ir) = bs3 *
s() +
m_two * bs6 *
px(cost, phi)
107 if (mr == 1) ylm(ir) =
m_half*(
s() +
px(cost, phi) +
py(cost, phi) +
pz(cost))
108 if (mr == 2) ylm(ir) =
m_half*(
s() +
px(cost, phi) -
py(cost, phi) -
pz(cost))
109 if (mr == 3) ylm(ir) =
m_half*(
s() -
px(cost, phi) +
py(cost, phi) -
pz(cost))
110 if (mr == 4) ylm(ir) =
m_half*(
s() -
px(cost, phi) -
py(cost, phi) +
pz(cost))
112 if (mr == 1) ylm(ir) = bs3 *
s() - bs6 *
px(cost, phi) + bs2 *
py(cost, phi)
113 if (mr == 2) ylm(ir) = bs3 *
s() - bs6 *
px(cost, phi) - bs2 *
py(cost, phi)
114 if (mr == 3) ylm(ir) = bs3 *
s() +
m_two * bs6 *
px(cost, phi)
115 if (mr == 4) ylm(ir) = bs2 *
pz(cost) + bs2 *
dz2(cost)
116 if (mr == 5) ylm(ir) =-bs2 *
pz(cost) + bs2 *
dz2(cost)
118 if (mr == 1) ylm(ir) = bs6 *
s() - bs2 *
px(cost, phi) -bs12 *
dz2(cost) +
m_half *
dx2my2(cost, phi)
119 if (mr == 2) ylm(ir) = bs6 *
s() + bs2 *
px(cost, phi) -bs12 *
dz2(cost) +
m_half *
dx2my2(cost, phi)
120 if (mr == 3) ylm(ir) = bs6 *
s() - bs2 *
py(cost, phi) -bs12 *
dz2(cost) -
m_half *
dx2my2(cost, phi)
121 if (mr == 4) ylm(ir) = bs6 *
s() + bs2 *
py(cost, phi) -bs12 *
dz2(cost) -
m_half *
dx2my2(cost, phi)
122 if (mr == 5) ylm(ir) = bs6 *
s() - bs2 *
pz(cost) +bs3 *
dz2(cost)
123 if (mr == 6) ylm(ir) = bs6 *
s() + bs2 *
pz(cost) +bs3 *
dz2(cost)
137 real(real64) ::
pz, cost
141 function px(cost, phi)
142 real(real64) ::
px, cost, phi, sint
147 function py(cost, phi)
148 real(real64) ::
py, cost, phi, sint
155 real(real64) ::
dz2, cost
159 function dxz(cost, phi)
160 real(real64) ::
dxz, cost, phi, sint
165 function dyz(cost, phi)
166 real(real64) ::
dyz, cost, phi, sint
171 function dx2my2(cost, phi)
172 real(real64) ::
dx2my2, cost, phi, sint
177 function dxy(cost, phi)
178 real(real64) ::
dxy, cost, phi, sint
185 real(real64) ::
fz3, cost
186 fz3 = 0.25_real64 *
sqrt(7.0_real64 /
m_pi) * (5.0_real64 * cost * cost -
m_three) * cost
189 function fxz2(cost, phi)
190 real(real64) ::
fxz2, cost, phi, sint
192 fxz2 = 0.25_real64 *
sqrt(10.5_real64 /
m_pi) * (5.0_real64 * cost * cost -
m_one) * sint *
cos(phi)
195 function fyz2(cost, phi)
196 real(real64) ::
fyz2, cost, phi, sint
198 fyz2 = 0.25_real64 *
sqrt(10.5_real64 /
m_pi) * (5.0_real64 * cost * cost -
m_one) * sint *
sin(phi)
202 real(real64) ::
fzx2my2, cost, phi, sint
207 function fxyz(cost, phi)
208 real(real64) ::
fxyz, cost, phi, sint
214 real(real64) ::
fxx2m3y2, cost, phi, sint
220 real(real64) ::
fy3x2my2, cost, phi, sint
double sin(double __x) __attribute__((__nothrow__
double sqrt(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
double atan2(double __y, double __x) __attribute__((__nothrow__
real(real64), parameter, public m_two
real(real64), parameter, public r_small
real(real64), parameter, public m_zero
real(real64), parameter, public m_four
real(real64), parameter, public m_pi
some mathematical constants
real(real64), parameter, public m_half
real(real64), parameter, public m_one
real(real64), parameter, public m_three
real(real64) function fxx2m3y2(cost, phi)
real(real64) function fy3x2my2(cost, phi)
real(real64) function py(cost, phi)
real(real64) function fxz2(cost, phi)
real(real64) function fz3(cost)
real(real64) function dz2(cost)
real(real64) function dxz(cost, phi)
real(real64) function pz(cost)
real(real64) function fzx2my2(cost, phi)
real(real64) function dxy(cost, phi)
real(real64) function fxyz(cost, phi)
real(real64) function dyz(cost, phi)
real(real64) function dx2my2(cost, phi)
real(real64) function px(cost, phi)
subroutine, public ylm_wannier(ylm, l, mr, rr, xx, nr)
real(real64) function s()
real(real64) function fyz2(cost, phi)