anchor.diff:  
     else ! case 3-2: no good for channeling. check if the  can VR
   
  -    Lrefl = xp_rel*Rcurv ! Distance of refl. point [m]
  -    Srefl = sin_mb(xp_rel/two + miscut)*Lrefl
  +    Lrefl = xp_rel*c_rcurv ! Distance of refl. point [m]
  +    Srefl = sin_mb(xp_rel/two + c_miscut)*Lrefl
   
       if(Lrefl > zero .and. Lrefl < Length) then ! VR point inside
   
  
positive.code: 
        ! Case 3-3: move in amorphous substance (big input angles)
        ! Modified for transition vram daniele
        if(xp_rel > L_chan/Rcurv + two*xpcrit .or. xp_rel < -xpcrit) then
          iProc = proc_AM
          x     = x + (half*s_length)*xp
          y     = y + (half*s_length)*yp
  
negative.code:   else
  
      if(x < zero) then ! Crystal hit from below
        XP_tangent = sqrt((-(two*x)*c_rcurv + x**2)/(c_rcurv**2))
        if(xp >= XP_tangent) then
          ! if it hits the crystal, calculate in which point and apply the
          ! transformation and drift to that point
          a_eq  = (one + xp**2)
          b_eq  = (two*xp)*(x-c_rcurv)
          c_eq  = -(two*x)*c_rcurv + x**2
          Delta = b_eq**2 - four*(a_eq*c_eq)
          S_int = (-b_eq - sqrt(Delta))/(two*a_eq)
  
          if(S_int < c_rcurv*sin_mb(cry_bend)) then
            !  transform to a new ref system:shift and rotate
            x_int  = xp*s_int + x
            xp_int = xp
  