def __get_group(split, pos, direction):
    """
    Gets the group that an atom belongs to based on its position. Only works in
    one direction as it is used for NEMD.

    Args:
        split (list(float)):
            List of boundaries. First element should be lower boundary of
            sim. box in specified direction and the last the upper.

        position (float):
            Position of the atom

        direction (str):
            Which direction the split will work

    Returns:
        int: Group of atom

    """
    if direction == 'x':
        d = pos[0]
    elif direction == 'y':
        d = pos[1]
    else:
        d = pos[2]
    errmsg = 'Out of bounds error: {}'.format(d)
    for i, val in enumerate(split[:-1]):
        if i == 0 and d < val:
            print(errmsg)
            return -1
        if val <= d < split[i + 1]:
            return i
    print(errmsg)
    return -1