def get_atom_indices_from_zmat_parameter(param):
    """
    Get the atom indices from a zmat parameter.

    Examples:
        'R_0_2' --> ((0, 2),)
        'A_0_1_2' --> ((0, 1, 2),) corresponding to angle 0-1-2
        'D_0_1_2_4' --> ((0, 1, 2, 4),)
        'R_0|0_3|4' --> ((0, 3), (0, 4))
        'A_0|0|0_1|1|1_2|3|4' --> ((0, 1, 2), (0, 1, 3), (0, 1, 4)) corresponding to angles 0-1-2, 0-1-3, and 0-1-4
        'D_0|0|0_1|1|1_2|3|4_5|6|9' --> ((0, 1, 2, 5), (0, 1, 3, 6), (0, 1, 4, 9))
        'RX_0_2' --> ((0, 2),)

    Args:
        param (str): The zmat parameter.

    Returns:
        tuple: Entries are tuples of indices, each describing R, A, or D parameters.
               The tuple entries for R, A, and D types are of lengths 2, 3, and 4, respectively.
               The number of tuple entries depends on the number of consolidated parameters.
    """
    result, index_groups = list(), list()
    splits = param.split('_')[1:]  # exclude the type char ('R', 'A', or 'D')
    for split in splits:
        index_groups.append(split.split('|'))
    for i in range(len(index_groups[0])):
        result.append(tuple(int(index_group[i]) for index_group in index_groups))
    return tuple(result)