subroutine interp_Hcollision_p(pchunk,Y_R,Y_PHI,Y_Z,ne,Te,Zeff, &
nAr0,nAr1,nAr2,nAr3,nD,nD1,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
REAL(rp),DIMENSION(pchunk),INTENT(OUT) :: nAr0,nAr1,nAr2,nAr3,nD,nD1
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, &
profiles_2d%nAr0,profiles_2d%nAr1,profiles_2d%nAr2,profiles_2d%nAr3, &
profiles_2d%nD,profiles_2d%nD1,pchunk,Y_R,Y_Z,ne,Te,Zeff, &
nAr0,nAr1,nAr2,nAr3,nD,nD1,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_Hcollision_p