Beispiel #1
0
def test_compute_K():
    pairs = [(0, 1), (2, 3), (4, 5)]  # singlets on a 3x2 grid -> k_y = pi
    psi = mps.MPS.from_singlets(spin_half, 6, pairs, bc='infinite')
    psi.test_sanity()
    lat = Square(3, 2, spin_half, order='default', bc_MPS='infinite', bc='periodic')
    U, W, q, ov, te = psi.compute_K(lat, verbose=100)
    assert (ov == -1.)
    npt.assert_array_equal(W, [1.])
 def init_lattice(self, model_params):
     bc_MPS = model_params.get('bc_MPS', 'infinite')
     order = model_params.get('order', 'default')
     site = self.init_sites(model_params)
     Lx = model_params.get('Lx', 4)
     Ly = model_params.get('Ly', 6)
     bc_x = 'periodic' if bc_MPS == 'infinite' else 'open'  # Next line needs default
     bc_x = model_params.get('bc_x', bc_x)
     bc_y = model_params.get('bc_y', 'cylinder')
     assert bc_y in ['cylinder', 'ladder']
     bc_y = 'periodic' if bc_y == 'cylinder' else 'open'
     if bc_MPS == 'infinite' and bc_x == 'open':
         raise ValueError(
             "You need to use 'periodic' `bc_x` for infinite systems!")
     lat = Square(Lx, Ly, site, order=order, bc=[bc_x, bc_y], bc_MPS=bc_MPS)
     return lat
 def init_lattice(self, model_params):
     bc_MPS = model_params.get('bc_MPS', self.defaults['bc_MPS'])
     order = model_params.get('order', self.defaults['order'])
     site = self.init_sites(model_params)
     #hop_x, hop_y = gauge_hopping(model_params) #Call this to initalise mx and my from gsuge hopping defaults
     mx = model_params.get('mx', self.defaults['flux_q'])
     my = model_params.get('my', self.defaults['my'])
     Lx = model_params.get('Lx', self.defaults['Lx']) * mx
     Ly = model_params.get('Ly', self.defaults['Ly']) * my
     bc_x = 'periodic' if bc_MPS == 'infinite' else 'open'
     model_params.update({'bc_x': bc_x})  # updates bc_x in model_par
     bc_y = model_params.get('bc_y', 'cylinder')
     assert bc_y in ['cylinder', 'ladder']
     bc_y = 'periodic' if bc_y == 'cylinder' else 'open'
     if bc_MPS == 'infinite' and bc_x == 'open':
         raise ValueError(
             "You need to use 'periodic' `bc_x` for infinite systems!")
     # bc = [bc_x, bc_y]
     lat = Square(Lx, Ly, site, order=order, bc=[bc_x, bc_y], bc_MPS=bc_MPS)
     return lat