SUBROUTINE rec_split(nele, a, split, row_or_col, nlow, mi, half)
INTEGER, INTENT(IN) :: nele
INTEGER, DIMENSION(3, nele), INTENT(IN) :: a
INTEGER, DIMENSION(3, nele), INTENT(OUT) :: split
INTEGER, INTENT(IN) :: row_or_col
INTEGER, INTENT(OUT) :: nlow
INTEGER, INTENT(IN) :: mi, half
INTEGER :: el, half_m, p_high, p_low
half_m = mi + half - 1
p_low = 1
p_high = nele
DO el = 1, nele
IF (a(row_or_col, el) <= half_m) THEN
split(1:3, p_low) = a(1:3, el)
p_low = p_low + 1
ELSE
split(1:3, p_high) = a(1:3, el)
p_high = p_high - 1
END IF
END DO
nlow = p_low - 1
DBCSR_ASSERT(p_high .EQ. nlow)
END SUBROUTINE rec_split