123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129  ! Copyright (C) 2009 F. Bultmark, F. Cricchio and L. Nordstrom. ! This file is distributed under the terms of the GNU Lesser General Public ! License. See the file COPYING for license details. !BOP ! !ROUTINE: findlambdadu ! !INTERFACE: subroutine findlambdadu(is,l,ufix,lambda0,lambda) ! !INPUT/OUTPUT PARAMETERS: ! is : species type (in,integer) ! l : angular momentum (in,integer) ! ufix : fixed U (in,integer) ! lambda0 : starting value for screening length (inout,real) ! lambda : screening length corresponding to fixed U (out,real) ! !DESCRIPTION: ! Find the screening length corresponding to a fixed value of $U$ by using the ! half-interval method in the first few steps and then the more efficient ! secant method. For $U=0$ the code automatically sets the screening length to ! ${\rm lambdamax}=50$. This value is enough to get $F^{(k)}\sim 10^{-3}$ ! corresponding to $U\sim 0$ (that perfectly mimics a bare DFT calculation). ! However the code is stable up to ${\rm lambdamax}\sim 200$ thanks to ! improvement of {\tt spline}. ! ! !REVISION HISTORY: ! Created July 2009 (Francesco Cricchio) !EOP !BOC implicit none ! arguments integer, intent(in) :: is integer, intent(in) :: l real(8), intent(in) :: ufix real(8), intent(inout) :: lambda0 real(8), intent(out) :: lambda ! local variables ! max iterations in secant algorithm integer, parameter :: maxit=100 integer it,nit ! if ufix