FUNCTION fRE_pitch(g)
REAL(rp), INTENT(IN) :: g ! Relativistic gamma factor
REAL(rp) :: fRE_pitch
REAL(rp) :: D
REAL(rp) :: g0,g1,f0,f1,m
INTEGER :: index
index = MINLOC(ABS(h_params%g - g),1)
D = h_params%g(index) - g
if (D.GT.0) then
f0 = h_params%fRE_pitch(index-1)
g0 = h_params%g(index-1)
f1 = h_params%fRE_pitch(index)
g1 = h_params%g(index)
else
f0 = h_params%fRE_pitch(index)
g0 = h_params%g(index)
f1 = h_params%fRE_pitch(index+1)
g1 = h_params%g(index+1)
end if
m = (f1-f0)/(g1-g0)
fRE_pitch = f0 + m*(g - g0)
fRE_pitch = 180.0_rp - fRE_pitch
END FUNCTION fRE_pitch