subroutine get_fio_GCelectric_fields_p(params,F,Y_R,Y_PHI,Y_Z, &
E_R,E_PHI,E_Z,flag,hint)
TYPE(FIELDS), INTENT(IN) :: F
TYPE(KORC_PARAMS), INTENT(IN) :: params
REAL(rp), DIMENSION(params%pchunk), INTENT(IN) :: Y_R,Y_PHI,Y_Z
REAL(rp), DIMENSION(params%pchunk), INTENT(OUT) :: E_R,E_PHI,E_Z
INTEGER(is), DIMENSION(params%pchunk), INTENT(INOUT) :: flag
TYPE(C_PTR), DIMENSION(params%pchunk), INTENT(INOUT) :: hint
INTEGER (C_INT) :: status
INTEGER :: pp,pchunk
REAL(rp), DIMENSION(3) :: x
REAL(rp), DIMENSION(3) :: Etmp
pchunk=params%pchunk
do pp = 1,pchunk
if (flag(pp) .EQ. 1_is) then
x(1) = Y_R(pp)*params%cpp%length
x(2) = Y_PHI(pp)
x(3) = Y_Z(pp)*params%cpp%length
status = fio_eval_field(F%FIO_E, x(1), &
Etmp(1),hint(pp))
if (status .eq. FIO_SUCCESS) then
E_R(pp)=Etmp(1)/params%cpp%Eo
E_PHI(pp)=Etmp(2)/params%cpp%Eo
E_Z(pp)=Etmp(3)/params%cpp%Eo
else if (status .eq. FIO_NO_DATA) then
E_R(pp) = 0
E_PHI(pp) = 0
E_Z(pp) = 0
flag(pp) = 0_is
else if (status .ne. FIO_SUCCESS) then
flag(pp) = 0_is
end if
! write(6,*) E_R,E_PHI,E_Z
end if
end do
end subroutine get_fio_GCelectric_fields_p