Beispiel #1
0
def test_hubbard_square_lattice_2xd(d):
    for shape, periodic in itertools.product(((2, d), (d, 2)), (True, False)):
        lattice = HubbardSquareLattice(*shape, periodic=periodic)
        assert lattice.n_sites == 2 * d
        n_neighbor_pairs = 2 * (2 * (d - (not periodic)) + d)
        assert (len(tuple(lattice.neighbors_iter())) == 2 *
                len(tuple(lattice.neighbors_iter(False))) == n_neighbor_pairs)
Beispiel #2
0
def test_hubbard_square_lattice_1xd(d):
    for shape, periodic in itertools.product(((1, d), (d, 1)), (True, False)):
        lattice = HubbardSquareLattice(*shape, periodic=periodic)
        assert lattice.n_sites == d
        assert (len(tuple(lattice.neighbors_iter())) ==
                2 * len(tuple(lattice.neighbors_iter(False))) == 2 *
                (d - (not periodic)))
def test_hubbard_square_lattice_2x2():
    for periodic in (True, False):
        lattice = HubbardSquareLattice(2, 2, periodic=periodic)
        assert lattice.n_sites == 4
        assert len(tuple(lattice.neighbors_iter(False))) == 4
        assert len(tuple(lattice.neighbors_iter())) == 8
        assert len(tuple(lattice.diagonal_neighbors_iter(False))) == 2
        assert len(tuple(lattice.diagonal_neighbors_iter())) == 4