1! 2! Copyright (C) 2004 PWSCF group 3! This file is distributed under the terms of the 4! GNU General Public License. See the file `License' 5! in the root directory of the present distribution, 6! or http://www.gnu.org/copyleft/gpl.txt . 7! 8subroutine seriesbes(fun,r,r2,npt,xc) 9 ! 10 ! assume that the input function has the form xc(1) 11 ! +xc(2)*r(n)+xc(3)*r(n)**2 12 ! and finds the two coefficients. works with KKR3 beta functions 13 ! 14 use kinds, only : DP 15 implicit none 16 integer :: & 17 npt, & ! the number of points 18 npt2 ! intermediate point 19 20 real(DP) :: & 21 fun(npt), & ! the function 22 r(npt), & ! the mesh 23 r2(npt), & ! the mesh 24 xc(4) ! the coefficients 25 26 if (npt.lt.3) call errore('seriesbes','at least 3 points',1) 27 npt2=npt/2+1 28 29 ! xc(1)=0.5_dp*(fun(1)-xc(3)*r2(1)+fun(npt)-xc(3)*r2(npt)) 30 31 xc(3)=((fun(1)-fun(npt2))/(r(1)-r(npt2)) & 32 -(fun(npt)-fun(npt2))/(r(npt)-r(npt2)) )/ ( r(1)-r(npt) ) 33 xc(1)=fun(1) 34 xc(2)=( fun(npt)-fun(npt2) ) / (r(npt)-r(npt2)) -xc(3)*(r(npt)+ & 35 r(npt2) ) 36 xc(4)=0.0_dp 37 return 38end subroutine seriesbes 39