def linear_cell_to_tuple(c1, repeat_units):
    """
    Convert a linear index into a tuple assuming lexicographic indexing.

    :arg c1: (int) Linear index.
    :arg repeat_units: (3 int indexable) Dimensions of grid.
    """

    c1 = int(c1)
    c1x = c1 % repeat_units[0]
    c1y = ((c1 - c1x) // repeat_units[0]) % repeat_units[1]
    c1z = (c1 - c1x - c1y * repeat_units[0]) // (repeat_units[0] * repeat_units[1])
    return c1x, c1y, c1z