The Elk Code
 
Loading...
Searching...
No Matches
cpotclmt.f90
Go to the documentation of this file.
1
2! Copyright (C) 2023 J. K. Dewhurst and S. Sharma.
3! This file is distributed under the terms of the GNU General Public License.
4! See the file COPYING for license details.
5
6pure subroutine cpotclmt(nr,nri,ld,rl,wpr,crhomt,cvclmt)
7use modmain
8integer, intent(in) :: nr,nri,ld
9real(8), intent(in) :: rl(ld,-lmaxo-1:lmaxo+2),wpr(4,nr)
10complex(4), intent(in) :: crhomt(*)
11complex(4), intent(out) :: cvclmt(*)
12! local variables
13integer nro,iro,ir
14integer l,l1,l2,l3
15integer lm,npi,i0,i
16real(8) t0
17complex(4) c1
18! automatic arrays
19complex(4) f1(nr),f2(nr),f3(nr)
20nro=nr-nri
21iro=nri+1
22npi=lmmaxi*nri
23do l=0,lmaxi
24 l1=l+2
25 l2=-l+1
26 l3=-l-1
27 t0=fourpi/dble(2*l+1)
28 do lm=l**2+1,(l+1)**2
29 do ir=1,nri
30 i=lm+lmmaxi*(ir-1)
31 f1(ir)=rl(ir,l1)*crhomt(i)
32 f2(ir)=rl(ir,l2)*crhomt(i)
33 end do
34 i0=lm+npi
35 do ir=iro,nr
36 i=i0+lmmaxo*(ir-iro)
37 f1(ir)=rl(ir,l1)*crhomt(i)
38 f2(ir)=rl(ir,l2)*crhomt(i)
39 end do
40 call splintwp(nr,wpr,f1,f3)
41 call splintwp(nr,wpr,f2,f1)
42 c1=f1(nr)
43 do ir=1,nri
44 i=lm+lmmaxi*(ir-1)
45 cvclmt(i)=t0*(rl(ir,l3)*f3(ir)+rl(ir,l)*(c1-f1(ir)))
46 end do
47 do ir=iro,nr
48 i=i0+lmmaxo*(ir-iro)
49 cvclmt(i)=t0*(rl(ir,l3)*f3(ir)+rl(ir,l)*(c1-f1(ir)))
50 end do
51 end do
52end do
53do l=lmaxi+1,lmaxo
54 l1=l+2
55 l2=-l+1
56 l3=-l-1
57 t0=fourpi/dble(2*l+1)
58 do lm=l**2+1,(l+1)**2
59 i0=lm+npi
60 do ir=iro,nr
61 i=i0+lmmaxo*(ir-iro)
62 f1(ir)=rl(ir,l1)*crhomt(i)
63 f2(ir)=rl(ir,l2)*crhomt(i)
64 end do
65 call splintwp(nro,wpr(1,iro),f1(iro),f3(iro))
66 call splintwp(nro,wpr(1,iro),f2(iro),f1(iro))
67 c1=f1(nr)
68 do ir=iro,nr
69 i=i0+lmmaxo*(ir-iro)
70 cvclmt(i)=t0*(rl(ir,l3)*f3(ir)+rl(ir,l)*(c1-f1(ir)))
71 end do
72 end do
73end do
74return
75
76contains
77
78pure subroutine splintwp(n,wp,f,g)
79implicit none
80! arguments
81integer, intent(in) :: n
82real(8), intent(in) :: wp(*)
83complex(4), intent(in) :: f(n)
84complex(4), intent(out) :: g(n)
85! local variables
86integer i,j
87complex(8) zsm
88g(1)=0.e0
89zsm=wp(5)*f(1)+wp(6)*f(2)+wp(7)*f(3)+wp(8)*f(4)
90g(2)=zsm
91do i=2,n-2
92 j=i*4+1
93 zsm=zsm+wp(j)*f(i-1)+wp(j+1)*f(i)+wp(j+2)*f(i+1)+wp(j+3)*f(i+2)
94 g(i+1)=zsm
95end do
96j=(n-1)*4+1
97g(n)=zsm+wp(j)*f(n-3)+wp(j+1)*f(n-2)+wp(j+2)*f(n-1)+wp(j+3)*f(n)
98end subroutine
99
100end subroutine
101
pure subroutine splintwp(n, wp, f, g)
Definition atom.f90:184
pure subroutine cpotclmt(nr, nri, ld, rl, wpr, crhomt, cvclmt)
Definition cpotclmt.f90:7
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