anchor.diff:  !FOX    FRR=(FRR/ELENOR)*(ELE_R2/RR) ;
           
         case default
  -        write(lerr,"(a,i0,a)") "ELENS> ERROR in elens_kick_fox: elens_type=",elens_type(ielens(ix))," not recognized. "
  +        write(lerr,"(a,i0,a)") "ELENS> ERROR in elens_kick_fox: elens_type=",elens_type(iLens)," not recognized. "
           write(lerr,"(a)")      "ELENS>       Possible values for type are: 1, 2 and 3"
           call prror
           
         end select
   
       else ! rr>=R2
  -      if ( rr > elens_r2(ielens(ix))*gteps ) then
  +      if ( rr > elens_r2(iLens)*gteps ) then
           ! rr>R2: formula: r2/r
   !FOX    FRR=ELE_R2/RR ;
         else
  -        ! rr=R2: formula: 1
  -!FOX    FRR=ONE ;
  +        if ( elens_lFull(iLens) .and. elens_lZeroThick(iLens) ) then
  +          ! degenerate e-lens to a wire: rr=R2=0.0!!!
  +          write(lerr,"(a,i0,a)") "ELENS> ERROR E-lens # ",iLens," named '"//trim(bez(ix))// &
  +                "' degerate to a wire (R1=R2=0.0)"
  +          write(lerr,"(a)")      "ELENS>       Kick cannot be computed at wire position!"
  +          call prror
  +        else 
  +          ! rr=R2: formula: 1
  +!FOX      FRR=ONE ;
  +        end if
         end if
       endif
      
       ! 'radial kick'
   !FOX    FRR=(ELETR2*FRR)*(MTCDA/(ONE+DPDA)) ;
  -    if(elens_lThetaR2(ielens(ix))) then
  -      if(elens_I(ielens(ix))/elens_beam_chrg(ielens(ix)) < zero) then
  +    if(elens_lThetaR2(iLens)) then
  +      if(elens_I(iLens)/elens_beam_chrg(iLens) < zero) then
   !FOX    FRR=FRR*((RV+ELEBET*BETA0)/(ONE+ELEBET*BETA0)) ;
         else
   !FOX    FRR=FRR*((RV-ELEBET*BETA0)/(ONE-ELEBET*BETA0)) ;
  
positive.code:     !    0    if r < R1
      !    frr  if R1 < r < R2
      !    1    if r >= R2
      if ( rr > elens_r1(ielens(ix))*lteps ) then ! rr<R1: no kick from elens
        if ( rr < elens_r2(ielens(ix))*lteps ) then ! R1<=rr<R2: type-dependent kick
            
          select case (elens_type(ielens(ix)))
  
negative.code:     gamma_lens_beam  = ((elens_Ek(j)*c1m3)/elens_beam_mass(j))+one ! from kinetic energy
      elens_beta_lens_beam(j) = sqrt((one+one/gamma_lens_beam)*(one-one/gamma_lens_beam))
      
      elens_theta_r2(j) = gamma_lens_beam*((elens_len(j)*abs(elens_I(j)))/ &
           (((two*pi)*((eps0*clight)*clight))*brho))*c1e3 ! theta: from rad to mrad (c1e3)
      if ( .not.elens_lFull(j) .or. .not.elens_lZeroThick(j) ) then ! r2: only if not a wire
         elens_theta_r2(j) = elens_theta_r2(j)/(elens_r2(j)*c1m3) ! r2: from mm to m (c1m3)
      end if
      elens_theta_r2(j) = sign(elens_theta_r2(j),elens_beam_chrg(j))
      elens_theta_r2(j) = elens_theta_r2(j)*(one/(elens_beta_lens_beam(j)*beta0)- &
           sign(one,elens_I(j)/elens_beam_chrg(j)))
  
      ! take into account geometrical normalisation factor only in case lens is not a wire
      if ( elens_type(j)>=2 .and. (.not.elens_lFull(j) .or. .not.elens_lZeroThick(j)) ) then
        elens_theta_r2(j) = elens_theta_r2(j) * elens_geo_norm(j)
      end if
  
      if(st_quiet < 2) then
        ! find name of elens
  