예제 #1
0
 def test_energy_calc_heis(self):
     from cyclopeps.tools.peps_tools import PEPS
     from cyclopeps.ops.heis import return_op
     from cyclopeps.algs.tebd import run_tebd
     mpiprint(
         0, '\n' + '=' * 50 + '\nPeps Full Update Heisenberg test\n' +
         '-' * 50)
     # Create PEPS
     Nx = 4
     Ny = 4
     d = 2
     D = 3
     Zn = None
     backend = 'numpy'
     chi = 50
     # Get mpo
     ham = return_op(Nx, Ny, sym=None, backend=backend)
     # Run TEBD
     Ef, _ = run_tebd(Nx,
                      Ny,
                      d,
                      ham,
                      D=D,
                      Zn=Zn,
                      chi=chi,
                      backend=backend,
                      n_step=100,
                      su_step_size=0.1,
                      su_conv_tol=1e-5,
                      su_n_step=1)
     print('Final  E = {}'.format(Ef))
     mpiprint(0, 'Passed\n' + '=' * 50)
예제 #2
0
 def test_energy_calc_heis_Z2_not_reduced(self):
     from cyclopeps.tools.peps_tools import PEPS
     from cyclopeps.ops.heis import return_op
     from cyclopeps.algs.tebd import run_tebd
     mpiprint(
         0, '\n' + '=' * 50 +
         '\nPeps Full Update Z2 (not reduced) Heisenberg test\n' + '-' * 50)
     # Create PEPS
     Nx = 4
     Ny = 4
     d = 2
     D = 2
     Zn = 2
     backend = 'numpy'
     chi = 50
     # Get mpo
     ham = return_op(Nx, Ny, sym='Z2', backend=backend)
     # Run TEBD
     Ef, _ = run_tebd(Nx,
                      Ny,
                      d,
                      ham,
                      D=D,
                      Zn=Zn,
                      chi=chi,
                      backend=backend,
                      n_step=1,
                      su_step_size=[0.5, 0.1],
                      su_conv_tol=1e-5,
                      reduced=False,
                      su_n_step=1)
     print('Final  E = {}'.format(Ef))
     mpiprint(0, 'Passed\n' + '=' * 50)
예제 #3
0
# Bias sweeps
sVec = linspace(-0.5, 0.5, 30)

# TEBD Parameters
step_sizes = [0.1, 0.05, 0.01]
n_step = [50, 50, 50]
chi = [10, 20, 50]

# ---------------------------------------------------------
E = []
peps = None
for i, s in enumerate(sVec):
    # Create the Suzuki trotter decomposed operator
    params = (c, s)
    ops = return_op(Nx, Ny, params, hermitian=False)
    # Run TEBD
    Ef, peps = run_tebd(Nx,
                        Ny,
                        d,
                        ops,
                        peps=peps,
                        D=D,
                        chi=chi,
                        n_step=n_step,
                        step_size=step_sizes)

    E.append(Ef)

    for s2 in range(len(E)):
        print('{}\t{}'.format(sVec[s2], E[s2]))
예제 #4
0
dens_ops_bot = return_dens_op(Nx, Ny, top=False)

# Run TEBD
peps = PEPS(Nx, Ny, d, D[0], chi[0], fname=fnamer, fdir=savedir)
pepsl = PEPS(Nx, Ny, d, D[0], chi[0], fname=fnamel, fdir=savedir)

# Loop over all optimizaton parameters
for ind in range(len(D)):

    # --------------------------------------------------------------------
    # Calculate right eigenstate
    Ef, peps = run_tebd(Nx,
                        Ny,
                        d,
                        ops,
                        peps=peps,
                        D=D[ind],
                        chi=chi[ind],
                        n_step=n_step[ind],
                        step_size=dt[ind],
                        conv_tol=conv[ind])

    # --------------------------------------------------------------------
    # Calculate left eigenstate
    Efl, pepsl = run_tebd(Nx,
                          Ny,
                          d,
                          ops,
                          peps=pepsl,
                          D=D[ind],
                          chi=chi[ind],
                          n_step=n_step[ind],
예제 #5
0
             norm_bs_upper=3.,
             norm_bs_lower=0.)

# Loop over all optimizaton parameters
for ind in range(len(D)):
    # Update PEPS Parameters
    pepsl.D = D[ind]
    pepsl.chi = chi[ind]
    pepsl.fname = prepend + "Nx{}_Ny{}_sx{}_sy{}_D{}_chi{}_run_left".format(
        Nx, Ny, sxind, syind, D[ind], chi[ind])

    # --------------------------------------------------------------------
    # Calculate left eigenstate
    for i in range(5):
        try:
            Efl, pepsl = run_tebd(Nx,
                                  Ny,
                                  d,
                                  opsl,
                                  peps=pepsl,
                                  D=D[ind],
                                  chi=chi[ind],
                                  n_step=n_step[ind],
                                  step_size=dt[ind],
                                  conv_tol=conv[ind])
            break
        except Exception as e:
            print('Failed Left TEBD:\n{}'.format(e))
            print('Restarting ({}/{} restarts)'.format(i, 5))
            pepsl.load_tensors(pepsl.fdir + pepsl.fname)
예제 #6
0
curr_ops = return_curr_op(Nx,Ny,params)
dens_ops_top = return_dens_op(Nx,Ny,top=True)
dens_ops_bot = return_dens_op(Nx,Ny,top=False)

# Run TEBD
peps = PEPS(Nx,Ny,d,D[0],chi[0])
pepsl = PEPS(Nx,Ny,d,D[0],chi[0])
for ind in range(len(D)):
    print('Right Vector' + '-'*50)
    # Calculate right state
    try:
        Ef,peps = run_tebd(Nx,
                           Ny,
                           d,
                           ops,
                           peps=peps,
                           D=D[ind],
                           chi=chi[ind],
                           n_step=ns[ind],
                           step_size=dt[ind])
    except Exception as e: 
        print('Error in using previous peps, starting with random')
        print(e)
        try:
            peps = PEPS(Nx,Ny,d,D[ind],chi[ind])
            Ef,peps = run_tebd(Nx,
                               Ny,
                               d,
                               ops,
                               peps=peps,
                               D=D[ind],
예제 #7
0
jr = 0.9
jl = 0.1
ju = 0.5
jd = 0.5
cr = 0.5
cl = 0.5
cu = 0.5
cd = 0.5
dr = 0.5
dl = 0.5
du = 0.5
dd = 0.5
sx = -0.5
sy = 0.
params = (jr, jl, ju, jd, cr, cl, cu, cd, dr, dl, du, dd, sx, sy)

# Create the Suzuki trotter decomposed operator
ops = return_op(peps.Nx, peps.Ny, params)

# Run TEBD
Ef, _ = run_tebd(peps.Nx,
                 peps.Ny,
                 peps.d,
                 ops,
                 peps=peps,
                 D=D[start:],
                 chi=chi[start:],
                 n_step=n_step[start:],
                 conv_tol=1e-8,
                 step_size=step_sizes[start:])
예제 #8
0
ju = 0.5
jd = 0.5
cr = 0.5
cl = 0.5
cu = 0.5
cd = 0.5
dr = 0.5
dl = 0.5
du = 0.5
dd = 0.5
sx = -0.2
sy = 0.
params = (jr, jl, ju, jd, cr, cl, cu, cd, dr, dl, du, dd, sx, sy)

# Create the Suzuki trotter decomposed operator
ops = return_op(Nx, Ny, params)

# Run TEBD
Ef, _ = run_tebd(Nx,
                 Ny,
                 d,
                 ops,
                 D=D,
                 su_step_size=[0.5, 0.1, 0.05],
                 su_n_step=[50, 50, 50],
                 su_conv_tol=1e-5,
                 su_chi=20,
                 chi=chi,
                 n_step=n_step,
                 step_size=step_sizes)