The Elk Code
 
Loading...
Searching...
No Matches
zpotclmt.f90
Go to the documentation of this file.
1
2! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6!BOP
7! !ROUTINE: zpotclmt
8! !INTERFACE:
9pure subroutine zpotclmt(nr,nri,ld,rl,wpr,zrhomt,zvclmt)
10! !USES:
11use modmain
12! !INPUT/OUTPUT PARAMETERS:
13! nr : number of radial mesh points (in,integer)
14! nri : number of points on inner part of muffin-tin (in,integer)
15! ld : leading dimension (in,integer)
16! rl : r^l on the radial mesh (in,real(ld,-lmaxo-1:lmaxo+2))
17! wpr : weights for partial integration on radial mesh (in,real(4,nr))
18! zrhomt : muffin-tin charge density (in,complex(*))
19! zvclmt : muffin-tin Coulomb potential (out,complex(*))
20! !DESCRIPTION:
21! Solves the Poisson equation for the charge density contained in an isolated
22! muffin-tin using the Green's function approach. In other words, the
23! spherical harmonic expansion of the Coulomb potential, $V_{lm}$, is obtained
24! from the density expansion, $\rho_{lm}$, by
25! $$ V_{lm}(r)=\frac{4\pi}{2l+1}\left(\frac{1}{r^{l+1}}\int_0^r\rho_{lm}(r')
26! {r'}^{l+2}dr'+r^l\int_r^R\frac{\rho_{lm}(r')}{{r'}^{l-1}}dr'\right) $$
27! where $R$ is the muffin-tin radius.
28!
29! !REVISION HISTORY:
30! Created April 2003 (JKD)
31!EOP
32!BOC
33implicit none
34! arguments
35integer, intent(in) :: nr,nri,ld
36real(8), intent(in) :: rl(ld,-lmaxo-1:lmaxo+2),wpr(4,nr)
37complex(8), intent(in) :: zrhomt(*)
38complex(8), intent(out) :: zvclmt(*)
39! local variables
40integer nro,iro,ir
41integer l,l1,l2,l3
42integer lm,npi,i0,i
43real(8) t0
44complex(8) z1
45! automatic arrays
46complex(8) f1(nr),f2(nr),f3(nr)
47nro=nr-nri
48iro=nri+1
49npi=lmmaxi*nri
50do l=0,lmaxi
51 l1=l+2
52 l2=-l+1
53 l3=-l-1
54 t0=fourpi/dble(2*l+1)
55 do lm=l**2+1,(l+1)**2
56 do ir=1,nri
57 i=lm+lmmaxi*(ir-1)
58 f1(ir)=rl(ir,l1)*zrhomt(i)
59 f2(ir)=rl(ir,l2)*zrhomt(i)
60 end do
61 i0=lm+npi
62 do ir=iro,nr
63 i=i0+lmmaxo*(ir-iro)
64 f1(ir)=rl(ir,l1)*zrhomt(i)
65 f2(ir)=rl(ir,l2)*zrhomt(i)
66 end do
67 call splintwp(nr,wpr,f1,f3)
68 call splintwp(nr,wpr,f2,f1)
69 z1=f1(nr)
70 do ir=1,nri
71 i=lm+lmmaxi*(ir-1)
72 zvclmt(i)=t0*(rl(ir,l3)*f3(ir)+rl(ir,l)*(z1-f1(ir)))
73 end do
74 do ir=iro,nr
75 i=i0+lmmaxo*(ir-iro)
76 zvclmt(i)=t0*(rl(ir,l3)*f3(ir)+rl(ir,l)*(z1-f1(ir)))
77 end do
78 end do
79end do
80do l=lmaxi+1,lmaxo
81 l1=l+2
82 l2=-l+1
83 l3=-l-1
84 t0=fourpi/dble(2*l+1)
85 do lm=l**2+1,(l+1)**2
86 i0=lm+npi
87 do ir=iro,nr
88 i=i0+lmmaxo*(ir-iro)
89 f1(ir)=rl(ir,l1)*zrhomt(i)
90 f2(ir)=rl(ir,l2)*zrhomt(i)
91 end do
92 call splintwp(nro,wpr(1,iro),f1(iro),f3(iro))
93 call splintwp(nro,wpr(1,iro),f2(iro),f1(iro))
94 z1=f1(nr)
95 do ir=iro,nr
96 i=i0+lmmaxo*(ir-iro)
97 zvclmt(i)=t0*(rl(ir,l3)*f3(ir)+rl(ir,l)*(z1-f1(ir)))
98 end do
99 end do
100end do
101return
102
103contains
104
105pure subroutine splintwp(n,wp,f,g)
106implicit none
107! arguments
108integer, intent(in) :: n
109real(8), intent(in) :: wp(*)
110complex(8), intent(in) :: f(n)
111complex(8), intent(out) :: g(n)
112! local variables
113integer i,j
114complex(8) zsm
115g(1)=0.d0
116zsm=wp(5)*f(1)+wp(6)*f(2)+wp(7)*f(3)+wp(8)*f(4)
117g(2)=zsm
118do i=2,n-2
119 j=i*4+1
120 zsm=zsm+wp(j)*f(i-1)+wp(j+1)*f(i)+wp(j+2)*f(i+1)+wp(j+3)*f(i+2)
121 g(i+1)=zsm
122end do
123j=(n-1)*4+1
124g(n)=zsm+wp(j)*f(n-3)+wp(j+1)*f(n-2)+wp(j+2)*f(n-1)+wp(j+3)*f(n)
125end subroutine
126
127end subroutine
128!EOC
129
pure subroutine splintwp(n, wp, f, g)
Definition atom.f90:184
integer lmmaxi
Definition modmain.f90:207
real(8), parameter fourpi
Definition modmain.f90:1231
integer lmaxo
Definition modmain.f90:201
integer lmaxi
Definition modmain.f90:205
integer lmmaxo
Definition modmain.f90:203
pure subroutine zpotclmt(nr, nri, ld, rl, wpr, zrhomt, zvclmt)
Definition zpotclmt.f90:10