anchor.diff:  
       if ( f_max * f_min > 0.) then
   
  -      secante = 0
  +      secant = 0.
   
       else
   
  -      do while (dabs(Smax - Smin) >= eps .and. j < max_it)
  -
  -         if (j == 0) then
  -            Smin = S_min
  -
  -         else
  -            call variables(k, T, Smin, f_min, optical_depth, tau_eff)
  -            write(*,*)Smin
  -
  -            Smin = Smin - (Smax - Smin)/(f_max - f_min) * f_min
  -         end if
  -
  -        j = j + 1
  +      do while (f_max * f_min <= 0.)
  +
  +         Smax = (Smin + Smax)/2._x_precision
  +         call variables(k, T, Smin, f_min, optical_depth, tau_eff)
  +         call variables(k, T, Smax, f_max, optical_depth, tau_eff)
  +
  +         Smax = Smax - (f_max * (Smax - Smin)/(f_max - f_min))                     
  +
  +         j = j + 1
   
         end do
   
  -     secante  = (Smin + Smax)/2._x_precision
  +     secant  = (Smin + Smax)/2._x_precision
   
       endif
   
  -  end function secante
  +  end function secant
   
   
   end module mod_s_curve
  
positive.code: 
     case default
  
        write(*,*)"Optical depth is not 0 or 1"
        Fz = 0
  
      end select
  
  
negative.code: 
          ! S found with the dichotomy approach
          sigma_t_thick(i) = dichotomy(k, i, optical_depth)
          ! sigma_t_thick(i) = secant(k, i, optical_depth)
  
          ! Optical thin case (tau < 1)
          optical_depth = 0
  
          ! S found with the dichotomy approach
          sigma_t_thin(i)  = dichotomy(k, i, optical_depth)
          ! sigma_t_thin(i) = secant(k, i, optical_depth)
  
        enddo
  
        ! For the first critical point (the one at the right of the S shape)
  