function fcrystal, olight

      eps=1.e-5
;c Initial guess
      crystal = olight
;c
      for it = 1,20 do begin

         if (crystal le 0.) then begin
            crystal=1.
            return, crystal
         endif

         g_c,crystal,g_func,g_der
         de = (olight-crystal*(g_func)(0))/((g_func)(0)+crystal*(g_der)(0))
         crystal = crystal+de
         if (abs(de) lt eps*crystal) then return, crystal

      endfor
;c
      print,format=format,olight,crystal,de
      format="('  Fcrystal did not converge within 20 iterations',//," + $
           " ' Light=',e10.5,' Energy=',e10.5,' Last correction=',e10.5)"
;c
      return, 0.0
      end