示例#1
0
 def test_canonical_normalization_z2(self):
     from cyclopeps.tools.peps_tools import PEPS
     mpiprint(
         0, '\n' + '=' * 50 +
         '\nCanonical Peps Normalization test (Z2 Symmetry) \n' + '-' * 50)
     Nx = 3
     Ny = 5
     d = 2
     D = 3
     chi = 10
     Zn = 2
     backend = 'numpy'
     peps = PEPS(Nx=Nx,
                 Ny=Ny,
                 d=d,
                 D=D,
                 chi=chi,
                 Zn=Zn,
                 backend=backend,
                 normalize=False,
                 canonical=True)
     norm = peps.calc_norm(chi=chi)
     norm = peps.normalize()
     mpiprint(0, 'Norm = {}'.format(norm))
     self.assertTrue(abs(1.0 - norm) < 1e-3)
     mpiprint(0, 'Passed\n' + '=' * 50)
示例#2
0
 def test_normalization_Z2_ctf(self):
     from cyclopeps.tools.peps_tools import PEPS
     mpiprint(
         0, '\n' + '=' * 50 +
         '\nPeps (5x5) Normalization test with Z2 Symmetry (ctf)\n' +
         '-' * 50)
     Nx = 5
     Ny = 5
     d = 2
     D = 6
     chi = 10
     Zn = 2  # Zn symmetry (here, Z2)
     backend = 'ctf'
     # Generate random PEPS
     peps = PEPS(Nx=Nx,
                 Ny=Ny,
                 d=d,
                 D=D,
                 chi=chi,
                 Zn=Zn,
                 backend=backend,
                 normalize=False)
     # Compute the norm (2 ways for comparison)
     norm0 = peps.calc_norm(chi=chi)
     peps_sparse = peps.make_sparse()
     norm1 = peps_sparse.calc_norm(chi=chi)
     mpiprint(0, 'Symmetric Dense Norm = {}'.format(norm0))
     mpiprint(0, 'Symmetric Sparse Norm = {}'.format(norm1))
     # Normalize the PEPS
     norm2 = peps.normalize()
     peps_sparse = peps.make_sparse()
     norm3 = peps_sparse.calc_norm(chi=chi)
     mpiprint(0,
              'Symmetric Dense Norm (After normalized) = {}'.format(norm2))
     mpiprint(0,
              'Symmetric Sparse Norm (After normalized) = {}'.format(norm3))
     # Do some assertions to check if passed
     self.assertTrue(abs((norm0 - norm1) / norm1) < 1e-3)
     self.assertTrue(abs(1.0 - norm2) < 1e-3)
     self.assertTrue(abs(1.0 - norm3) < 1e-3)
     mpiprint(0, 'Passed\n' + '=' * 50)
示例#3
0
        print_str = ''
        for j in range(Ny-1):
            print_str += '{} '.format(density_top[0][i][j])
        print(print_str)
    for i in range(Nx):
        print_str = ''
        for j in range(Ny-1):
            print_str += '{} '.format(density_bot[0][i][j])
        print(print_str)
    print('Horizontal Density')
    for i in range(Ny):
        print_str = ''
        for j in range(Nx-1):
            print_str += '{} '.format(density_top[1][i][j])
        print(print_str)
    for i in range(Ny):
        print_str = ''
        for j in range(Nx-1):
            print_str += '{} '.format(density_bot[1][i][j])
        print(print_str)

    # Increase PEPS D if wanted
    if (len(D)-1 > ind):
        if (D[ind+1] > D[ind]):
            peps.increase_mbd(D[ind+1],chi=chi[ind+1])
        peps.chi = chi[ind+1]
        if (D[ind+1] > D[ind]):
            pepsl.increase_mbd(D[ind+1],chi=chi[ind+1])
        pepsl.chi = chi[ind+1]
        peps.normalize()