anchor.diff:      end if
       if (cheby_r2(jj)>cheby_refR(cheby_itable(jj))) then
         write(lout,"(a)") "CHEBY> ERROR R2 cannot be larger than domain of Chebyshev polynomials!"
  -      write(lout,"(a,e22.15,a,e22.15)") "CHEBY>       R2 [mm]: ",cheby_r2(jj), &
  +      write(lout,"(a,1pe22.15,a,1pe22.15)") "CHEBY>       R2 [mm]: ",cheby_r2(jj), &
              " - reference radius [mm]:",cheby_refR(cheby_itable(jj))
         call prror(-1)
  -    end if
  -    if (cheby_L (jj)<=zero) then
  -      cheby_L (jj)=cheby_refL(cheby_itable(jj))
  -    else
  -      cheby_scalingFact(jj)=cheby_scalingFact(jj)*((cheby_L(jj))/(cheby_refL(cheby_itable(jj))))
       end if
       if (cheby_I (jj)<=zero) then
         cheby_I (jj)=cheby_refI(cheby_itable(jj))
  
positive.code: 
    if(st_quiet < 2) then
      ! Echo parsed data (unless told to be quiet!)
      write(lout,"(a)" ) ""
      write(lout,"(a,i0)") "CHEBY> Coefficients for Chebyshev polynomials as from file "//&
        trim(cheby_filename(ifile))//" - #",ifile
      write(lout,"(a,e22.15)") "CHEBY> * Reference current [A] : ",cheby_refI(ifile)
      if (lDefI) write(lout,"(a)") "         --> default value!"
      write(lout,"(a,e22.15)") "CHEBY> * reference length  [m] : ",cheby_refL(ifile)
      if (lDefL) write(lout,"(a)") "         --> default value!"
      write(lout,"(a,e22.15)") "CHEBY> * reference radius [mm] : ",cheby_refR(ifile)
      do ii=0,cheby_max_order
        do jj=0,cheby_max_order
          if(cheby_coeffs(ii,jj,ifile)/= zero) then
            write(lout,"(2(a,i4),a,e22.15)") "CHEBY> Order ",ii,",",jj," : ",cheby_coeffs(ii,jj,ifile)
          end if
        end do
      end do
    end if
    return
  
  30 continue
    write(lout,"(a)") "CHEBY> ERROR while parsing file "//trim(cheby_filename(ifile))
    call prror(-1)
  
  
negative.code:   fu=(one-uu)*(one+uu)
    fv=(one-vv)*(one+vv)
  
    ! - polynomials:
    Tx(0)=one
    Ty(0)=one
    Tx(1)=uu
    Ty(1)=vv
    ! - derivatives:
    Tpx(0)=zero
    Tpy(0)=zero
    Tpx(1)=one
    Tpy(1)=one
    do nn=2,cheby_maxOrder(iTable)
       Tx(nn)=two*(uu*Tx(nn-1))-Tx(nn-2)
       Ty(nn)=two*(vv*Ty(nn-1))-Ty(nn-2)
       Tpx(nn)=(real(nn,fPrec)*(Tx(nn-1)-uu*Tx(nn)))/fu
       Tpy(nn)=(real(nn,fPrec)*(Ty(nn-1)-vv*Ty(nn)))/fv
    end do
  
    ! get kicks
    dxp=zero
    dyp=zero
    do nn=0,cheby_maxOrder(iTable)
       do jj=0,nn
          dxp=dxp+(cheby_coeffs(jj,nn-jj,iTable)*Tpx(jj))*Ty (nn-jj)
          dyp=dyp+(cheby_coeffs(jj,nn-jj,iTable)*Tx (jj))*Tpy(nn-jj)
       end do
    end do
    dxp=-(dxp*c1e3)/(cheby_refR(iTable)*c1m3) ! ref radius in [mm], kick in [mrad]
    dyp=-(dyp*c1e3)/(cheby_refR(iTable)*c1m3) ! ref radius in [mm], kick in [mrad]
  
   end subroutine cheby_getKick
  
  