subroutine interp_FOcollision_p(pchunk,Y_R,Y_PHI,Y_Z,ne,Te,Zeff,flag_cache)
INTEGER, INTENT(IN) :: pchunk
REAL(rp),DIMENSION(pchunk),INTENT(IN) :: Y_R,Y_PHI,Y_Z
REAL(rp),DIMENSION(pchunk),INTENT(OUT) :: ne,Te,Zeff
INTEGER(is),DIMENSION(pchunk),INTENT(INOUT) :: flag_cache
call check_if_in_profiles_domain_p(pchunk,Y_R,Y_PHI,Y_Z,flag_cache)
! write(output_unit_write,'("YR: ",E17.10)') Y_R(1)
! write(output_unit_write,'("YPHI: ",E17.10)') Y_PHI(1)
! write(output_unit_write,'("YZ: ",E17.10)') Y_Z(1)
! write(output_unit_write,'("Te_interp_R",E17.10)') profiles_2d%Te%x1
! write(output_unit_write,'("Te_interp_Z",E17.10)') profiles_2d%Te%x2
call EZspline_interp(profiles_2d%ne,profiles_2d%Te, &
profiles_2d%Zeff,pchunk,Y_R,Y_Z,ne,Te,Zeff,ezerr)
! this will call PSPLINE routine EZspline_interp2_bmag_cloud as there
! is the same number of entries
call EZspline_error(ezerr)
end subroutine interp_FOcollision_p