subroutine cart_to_tor_p(pchunk,R0,X_X,X_Y,X_Z,T_R,T_T,T_Z)
INTEGER, INTENT(IN) :: pchunk
REAL(rp), INTENT(IN) :: R0
REAL(rp), INTENT(IN),DIMENSION(pchunk) :: X_X,X_Y,X_Z
REAL(rp), INTENT(OUT),DIMENSION(pchunk) :: T_R,T_T,T_Z
REAL(rp),DIMENSION(pchunk) :: RR
INTEGER :: cc
!! Particle chunk iterator.
!$OMP SIMD
! !$OMP& aligned(RR,X_X,X_Y,T_R,T_T,T_Z,X_Z)
do cc=1_idef,pchunk
RR(cc)=SQRT(X_X(cc)*X_X(cc) + X_Y(cc)*X_Y(cc)) - R0
T_R(cc) = SQRT( RR(cc)*RR(cc) + X_Z(cc)*X_Z(cc) )
T_T(cc) = ATAN2(X_Z(cc), RR(cc))
T_T(cc) = MODULO(T_T(cc),2.0_rp*C_PI)
T_Z(cc) = ATAN2(X_X(cc),X_Y(cc))
T_Z(cc) = MODULO(T_Z(cc),2.0_rp*C_PI)
end do
!$OMP END SIMD
end subroutine cart_to_tor_p