anchor.diff:  
     else
   
  -    if(x < zero) then ! Crystal hit from below
  -!      write(*,*) 'Crystal potentially hit from below'
  -!      write(*,*) 'CHECK', x
  +    if(x < zero) then ! Crystal can be hit from below
         xp_tangent = sqrt((-(two*x)*c_rcurv + x**2)/(c_rcurv**2))
  -!      write(*,*) 'tangent', xp_tangent, xp
  -    else ! Crystal hit from above
  -!      write(*,*) 'Crystal potentially hit from above'
  -!      write(*,*) 'CHECK', x
  +    else              ! Crystal can be hit from above
         xp_tangent = asin_mb((c_rcurv*(one - c_cBend) - x)/sqrt(((two*c_rcurv)*(c_rcurv - x))*(one - c_cBend) + x**2))
  -!      write(*,*) 'tangent', xp_tangent, xp
       end if
   
       ! If the hit is below, the angle must be greater or equal than the tangent,
       ! or if the hit is above, the angle must be smaller or equal than the tangent
       if((x < zero .and. xp >= xp_tangent) .or. (x >= zero .and. xp <= xp_tangent)) then
  -
  -!      write(*,*) 'Crystal actually hit from above/below'
   
         ! If it hits the crystal, calculate in which point and apply the transformation and drift to that point
         a_eq  = one + xp**2
  
positive.code:           x = x + (half*xp)*(s_length - Srefl)
            y = y + (half*yp)*(s_length - Srefl)
          else
  !          write(*,*) 'TRAM'
            iProc = proc_TRAM
            x = x + xp*Srefl
            y = y + yp*Srefl
  
negative.code: 
      else
  
        s = c_rcurv*sin_mb(cry_length/c_rcurv)
        x = x + s*xp
        z = z + s*zp
  