anchor.diff:          return
         end if
       end if
  -    elens_lFull(ielens(iElem))=elens_r1(ielens(iElem))==zero
  -    elens_lZeroThick(ielens(iElem))=elens_r1(ielens(iElem))==elens_r2(ielens(iElem))
  +    if( elens_type(ielens(iElem)) == 4 ) then
  +      ! the user declares the e-lens as a degenerate one to a WIRE
  +      ! R1 must be 0.0, whereas R2 must be != 0.0 
  +      elens_lFull(ielens(iElem))=.true.
  +      elens_lZeroThick(ielens(iElem))=.true.
  +      if( elens_r1(ielens(iElem)) /= zero ) then
  +        elens_r1(ielens(iElem))=zero
  +        write(lout,"(a)") "ELENS> WARNING: Elens '"//trim(bez(iElem))//"' is a wire."
  +        write(lout,"(a)") "ELENS>          Forcing R1 to 0 mm."
  +      end if
  +      if( elens_r2(ielens(iElem)) == zero ) then
  +        write(lerr,"(a)") "ELENS> ERROR R2==0 for a WIRE e-lens!"
  +        iErr = .true.
  +        return
  +      end if
  +    else
  +      elens_lFull(ielens(iElem))=elens_r1(ielens(iElem))==zero
  +      elens_lZeroThick(ielens(iElem))=elens_r1(ielens(iElem))==elens_r2(ielens(iElem))
  +      if ( elens_lFull(ielens(iElem)) .and. elens_lZeroThick(ielens(iElem)) ) then
  +        ! degenerate e-lens to a wire, where user decided not to set R2
  +        ! set it to 1mm
  +        elens_r2(ielens(iElem))=one
  +        write(lout,"(a)") "ELENS> WARNING: Elens '"//trim(bez(iElem))//"' is actually a wire (i.e. R1=R2=0.0)."
  +        write(lout,"(a)") "ELENS>          Forcing R2 to 1 mm, such that theta_R2 keeps a meaning."
  +        write(lout,"(a)") "ELENS>          If this is not what you want to do, please use the WIRE type."
  +      end if
  +    end if
       
       if(st_debug) then
         call sixin_echoVal("name",           bez(iElem),                   "ELENS",iLine)
  
positive.code:   !    frr  if R1 < r < R2
    !    1    if r >= R2
    if ( RRA > elens_r1(iLens)*lteps .or. elens_lFull(iLens) ) then ! rr<R1: no kick from elens
      if ( RRA < elens_r2(iLens)*lteps ) then ! R1<=rr<R2: type-dependent kick
         
        select case (elens_type(iLens))
          
  
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))
      
      ! r2: from mm to m (c1m3)
      ! theta: from rad to mrad (c1e3)
      elens_theta_r2(j) = gamma_lens_beam*((elens_len(j)*abs(elens_I(j)))/ &
           ((((two*pi)*((eps0*clight)*clight))*brho)*(elens_r2(j)*c1m3)))*c1e3
      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)))
  