The Elk Code
rfmtinp.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2003-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl.
3 ! This file is distributed under the terms of the GNU Lesser General Public
4 ! License. See the file COPYING for license details.
5 
6 !BOP
7 ! !ROUTINE: rfmtinp
8 ! !INTERFACE:
9 pure real(8) function rfmtinp(nr,nri,wr,rfmt1,rfmt2)
10 ! !USES:
11 use modmain
12 ! !INPUT/OUTPUT PARAMETERS:
13 ! nr : number of radial mesh points (in,integer)
14 ! nri : number of radial mesh points on the inner part of the muffin-tin
15 ! (in,integer)
16 ! wr : weights for integration on radial mesh (in,real(nr))
17 ! rfmt1 : first real function inside muffin-tin (in,real(*))
18 ! rfmt2 : second real function inside muffin-tin (in,real(*))
19 ! !DESCRIPTION:
20 ! Calculates the inner product of two real functions in the muffin-tin. So
21 ! given two real functions of the form
22 ! $$ f({\bf r})=\sum_{l=0}^{l_{\rm max}}\sum_{m=-l}^{l}f_{lm}(r)R_{lm}
23 ! (\hat{\bf r}) $$
24 ! where $R_{lm}$ are the real spherical harmonics, the function returns
25 ! $$ I=\int\sum_{l=0}^{l_{\rm max}}\sum_{m=-l}^{l}f_{lm}^1(r)f_{lm}^2(r)r^2
26 ! dr\;. $$
27 !
28 ! !REVISION HISTORY:
29 ! Created November 2003 (Sharma)
30 !EOP
31 !BOC
32 implicit none
33 ! arguments
34 integer, intent(in) :: nr,nri
35 real(8), intent(in) :: wr(nr),rfmt1(*),rfmt2(*)
36 ! local variables
37 integer ir,i
38 ! compute the dot-products for each radial point and integrate over r
39 rfmtinp=0.d0
40 i=1
41 if (lmaxi == 1) then
42  do ir=1,nri
43  rfmtinp=rfmtinp+wr(ir) &
44  *(rfmt1(i)*rfmt2(i) &
45  +rfmt1(i+1)*rfmt2(i+1) &
46  +rfmt1(i+2)*rfmt2(i+2) &
47  +rfmt1(i+3)*rfmt2(i+3))
48  i=i+4
49  end do
50 else
51  do ir=1,nri
52  rfmtinp=rfmtinp+wr(ir)*dot_product(rfmt1(i:i+lmmaxi-1),rfmt2(i:i+lmmaxi-1))
53  i=i+lmmaxi
54  end do
55 end if
56 do ir=nri+1,nr
57  rfmtinp=rfmtinp+wr(ir)*dot_product(rfmt1(i:i+lmmaxo-1),rfmt2(i:i+lmmaxo-1))
58  i=i+lmmaxo
59 end do
60 end function
61 !EOC
62 
pure real(8) function rfmtinp(nr, nri, wr, rfmt1, rfmt2)
Definition: rfmtinp.f90:10
integer lmmaxo
Definition: modmain.f90:205
integer lmmaxi
Definition: modmain.f90:209
integer lmaxi
Definition: modmain.f90:207