def get_1d_coords(p, i, j):
    """
    Finds index of site in 1d chain from 2d lattics based on snake
    decomposition, ie 1d coords on 2d lattice look like:
        0, 1, 2, 3,
        7, 6, 5, 4,
        8, 8, 10, 11
    Args:
        p - dictionary that contains the relevant system parameters
        i - row index on 2d lattice
        j - column index on 2d lattice
    Returns:
        reshaped_i - index of site on 1d chain
    """
    if i % 2 == 0:
        reshaped_i = i * p['W'] + j
    else:
        reshaped_i = i * p['W'] + (p['W'] - j - 1)
    return reshaped_i