def distribute_atoms(atoms, n):
    """ split a 1D list atoms into n nearly-even-sized chunks.
    """
    k, m = divmod(len(atoms), n)
    return [atoms[i*k+min(i,m) : (i+1)*k+min(i+1,m)] for i in range(n)]