Beispiel #1
0
    def test_renorm_left_energy(self):
        mpiprint(
            0, '\n' + '=' * 50 +
            '\nTesting left renormalization effect on Energy\n' + '-' * 50)
        from cyclomps.tools.mps_tools import create_mps_list, make_mps_list_left, load_mps_list, calc_mps_norm, move_gauge
        from cyclomps.mpo.tasep import return_mpo
        from cyclomps.algs.dmrg1 import renormalize_left
        # Create an MPS
        d = 2
        N = 4
        mbd = 10
        nState = 4
        mps = create_mps_list([d] * N, mbd, nState)
        mps = make_mps_list_left(mps)
        # Load the MPO
        mpo = return_mpo(N, (0.5, 0.5, 1.))

        # Create a function to compute energy
        def calc_energy(mpsL, mpo):
            mps = load_mps_list(mpsL)
            E = zeros(nState, dtype=mps[0][0].dtype)
            norm = zeros(nState, dtype=mps[0][0].dtype)
            for state in range(nState):
                psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0],
                             mps[state][1], mps[state][2], mps[state][3])
                op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0],
                            mpo[0][1], mpo[0][2], mpo[0][3])
                psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                                  conj(mps[state][1]), conj(mps[state][2]),
                                  conj(mps[state][3]))
                E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
                norm[state] = calc_mps_norm(mpsL, state=state)
            return E, norm

        # Calc initial Energy
        E1, norm1 = calc_energy(mps, mpo)
        # Move gauge using renormalization
        site = N - 1
        (mps0, ) = retrieve_tensors(site - 1, mpsList=mps)
        (mps1, ) = retrieve_tensors(site, mpsList=mps)
        mps0, mps1, EE, EEs, wgt = renormalize_left(mps0,
                                                    mps1,
                                                    state_avg=False)
        save_tensors(site - 1, mpsList=mps, mps=mps0)
        save_tensors(site, mpsList=mps, mps=mps1)
        # Calc Energy Again
        E2, norm2 = calc_energy(mps, mpo)
        # Check Energies
        self.assertTrue(summ(abss(E1[0] - E2[0])) < 1e-10)
        self.assertTrue(summ(abss(E1[1] - E2[1])) < 1e-10)
        self.assertTrue(summ(abss(E1[2] - E2[2])) < 1e-10)
        self.assertTrue(summ(abss(E1[3] - E2[3])) < 1e-10)
        # Check for correct canonical form
        for state in range(nState):
            eye_check = einsum('apb,cpb->ac', mps1[state], conj(mps1[state]))
            eye_actual = eye(eye_check.shape[0])
            self.assertTrue(summ(abss(eye_check - eye_actual)) < 1e-10)
        mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #2
0
    def test_tasep_mpo(self):
        mpiprint(
            0, '\n' + '=' * 50 +
            '\nTesting Initial Environment Using TASEP MPO\n' + '-' * 50)
        # Create an MPS
        from cyclomps.tools.mps_tools import create_mps_list, make_mps_list_right, load_mps_list, calc_mps_norm
        d = 2
        N = 4
        mbd = 10
        nState = 4
        mpsList = create_mps_list([d] * N, mbd, nState)
        # Load the MPO
        from cyclomps.mpo.tasep import return_mpo
        mpo = return_mpo(N, (0.5, 0.5, 1.))

        # Create a function to compute energy
        def calc_energy(mps, mpo, load_mps=True):
            if load_mps:
                mps = load_mps_list(mps)
            E = zeros(nState, dtype=mps[0][0].dtype)
            for state in range(nState):
                psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0],
                             mps[state][1], mps[state][2], mps[state][3])
                op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0],
                            mpo[0][1], mpo[0][2], mpo[0][3])
                psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                                  conj(mps[state][1]), conj(mps[state][2]),
                                  conj(mps[state][3]))
                E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
                norm = einsum('pqrs,pqrs->', psi, psi_conj)
                E[state] /= norm
            return E

        # Compute energy
        E1 = calc_energy(mpsList, mpo)
        mpiprint(0, 'Initial Energy =\n{}'.format(E1))
        # Right Canonicalize
        mpsList = make_mps_list_right(mpsList)
        # Compute energy again
        E2 = calc_energy(mpsList, mpo)
        mpiprint(0, 'Energy after canonicalization =\n{}'.format(E2))
        # Calculate the environment
        from cyclomps.tools.env_tools import calc_env, env_load_ten, load_env_list
        envList = calc_env(mpsList, mpo)
        # Calculate the energy using the environment
        env = load_env_list(envList)
        mps = load_mps_list(mpsList)
        E3 = zeros(nState, dtype=mps[0][0].dtype)
        for state in range(nState):
            E3[state] = einsum('Ala,apb,lPpr,APB,Brb->', env[0][0], mps[0][0],
                               mpo[0][0], conj(mps[0][0]), env[0][1])
            E3[state] /= calc_mps_norm(mpsList, state=state)
        mpiprint(0, 'Energy from environment =\n{}'.format(E3))
        # Check Results
        self.assertTrue(summ(abss(E1[0] - E2[0])) < 1e-10)
        self.assertTrue(summ(abss(E1[0] - E3[0])) < 1e-10)
        mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #3
0
 def test_move_gauge_left2(self):
     mpiprint(
         0, '\n' + '=' * 50 +
         '\nTesting moving gauge left effect on Energy\n' + '-' * 50)
     from cyclomps.mpo.tasep import return_mpo
     import copy
     N = 4
     d = 2
     mbd = 10
     nState = 2
     mpsL = create_mps_list([d] * N, mbd, nState)
     mpo = return_mpo(N, (0.5, 0.5, 1.))
     # Calculate initial Energy (very slow way)
     mps = load_mps_list(mpsL)
     E = zeros(nState, dtype=mps[0][0].dtype)
     for state in range(nState):
         psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0], mps[state][1],
                      mps[state][2], mps[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                           conj(mps[state][1]), conj(mps[state][2]),
                           conj(mps[state][3]))
         E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
         #E[state] /= calc_mps_norm(mpsL,state)
     # Move guage one site left
     for state in range(nState):
         site = 3
         ten1 = mps_load_ten(mpsL, state, site - 1)
         ten2 = mps_load_ten(mpsL, state, site)
         ten1, ten2, _, _, _ = move_gauge_left_tens(copy.deepcopy(ten1),
                                                    copy.deepcopy(ten2))
         mps_save_ten(ten1, mpsL, state, site - 1)
         mps_save_ten(ten2, mpsL, state, site)
     #for state in range(nState):
     #    mpsL = move_gauge_left(mpsL,state,3,return_ent=False,return_wgt=False)
     # Calculate Final Energy
     mps = load_mps_list(mpsL)
     E2 = zeros(nState, dtype=mps[0][0].dtype)
     for state in range(nState):
         psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0], mps[state][1],
                      mps[state][2], mps[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                           conj(mps[state][1]), conj(mps[state][2]),
                           conj(mps[state][3]))
         E2[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
         #E2[state] /= calc_mps_norm(mpsL,state)
     # Print
     for state in range(nState):
         self.assertTrue(abs(E[state] - E2[state]) < 1e-10)
     mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #4
0
 def test_move_gauge_right2(self):
     mpiprint(
         0, '\n' + '=' * 50 +
         '\nTesting moving gauge right effect on Energy\n' + '-' * 50)
     N = 4
     d = 2
     mbd = 10
     nState = 2
     mpsL = create_mps_list([d] * N, mbd, nState)
     from cyclomps.mpo.tasep import return_mpo
     mpo = return_mpo(N, (0.5, 0.5, 1.))
     # Calculate initial Energy (very slow way)
     mps = load_mps_list(mpsL)
     E = zeros(nState, dtype=mps[0][0].dtype)
     for state in range(nState):
         psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0], mps[state][1],
                      mps[state][2], mps[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                           conj(mps[state][1]), conj(mps[state][2]),
                           conj(mps[state][3]))
         E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
     # Move guage one site left
     for state in range(nState):
         mpsL = move_gauge_right(mpsL,
                                 state,
                                 0,
                                 return_ent=False,
                                 return_wgt=False)
     # Calculate Final Energy
     mps = load_mps_list(mpsL)
     E2 = zeros(nState, dtype=mps[0][0].dtype)
     for state in range(nState):
         psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0], mps[state][1],
                      mps[state][2], mps[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                           conj(mps[state][1]), conj(mps[state][2]),
                           conj(mps[state][3]))
         E2[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
     # Print
     for state in range(nState):
         mpiprint(
             0, 'State {} Energies: {},{},{}'.format(
                 state, E[state], E2[state],
                 summ(abss(E[state] - E2[state]))))
         self.assertTrue(abs(E[state] - E2[state]) < 1e-10)
     mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #5
0
    def test_canonicalize_mps4(self):
        mpiprint(
            0, '\n' + '=' * 50 +
            '\nTesting Canonicalization effect on Energy\n' + '-' * 50)
        N = 4
        d = 2
        mbd = 10
        nState = 5
        mpsL = create_mps_list([d] * N, mbd, nState)
        from cyclomps.mpo.tasep import return_mpo
        mpo = return_mpo(N, (0.5, 0.5, 1.))

        # Create function to calculate energy and norm
        def calc_energy(mps, mpo, load_mps=True):
            if load_mps:
                mps = load_mps_list(mps)
            E = zeros(nState, dtype=mps[0][0].dtype)
            norm = zeros(nState, dtype=mps[0][0].dtype)
            for state in range(nState):
                psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0],
                             mps[state][1], mps[state][2], mps[state][3])
                op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0],
                            mpo[0][1], mpo[0][2], mpo[0][3])
                psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                                  conj(mps[state][1]), conj(mps[state][2]),
                                  conj(mps[state][3]))
                E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
                norm[state] = einsum('pqrs,pqrs->', psi, psi_conj)
            return E, norm

        # Calculate initial norm
        E, norm = calc_energy(mpsL, mpo, load_mps=True)
        # Make the MPS Right canonical
        mpsL = make_mps_list_left(mpsL)
        # Calculate Final norm
        E2, norm2 = calc_energy(mpsL, mpo, load_mps=True)
        # Print
        for state in range(nState):
            mpiprint(
                0, 'Norm of State {}: {},{},{}'.format(
                    state, norm[state], norm2[state],
                    abs(norm[state] - norm2[state])))
            self.assertTrue(abs(norm[state] - norm2[state]) < 1e-8)
            mpiprint(
                0, 'Energy of State {}: {},{},{}'.format(
                    state, E[state], E2[state], abs(E[state] - E2[state])))
            self.assertTrue(abs(E[state] - E2[state]) < 1e-8)
        mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #6
0
 def test_dmrg2(self):
     mpiprint(0,'\n'+'='*20+'\nTesting one-site dmrg\n'+\
              '-Davidson\n-Fixed BD\n-not orthonormalized\n-calc left\n-Multiple BD\n'+'='*20)
     # Use the TASEP MPO
     from cyclomps.algs.dmrg1 import dmrg
     from numpy import complex_
     from cyclomps.mpo.tasep import return_mpo
     mpo = return_mpo(10,(0.5,0.5,1.))
     E1 = dmrg(mpo,
               alg='davidson',
               dtype=complex_,
               tol=1e-5,
               mbd=[10,20],
               min_iter=3,
               nStates=2,
               fixed_bd=True,
               left=False)
     mpiprint(0,'Passed\n'+'='*20)
Beispiel #7
0
 def test_dmrg1(self):
     mpiprint(0,'\n'+'='*20+'\nTesting one-site dmrg\n'+\
              '-Exact Diagonalization\n-not fixed\n-not orthonormalized\n-calc left\n'+'='*20)
     # Use the TASEP MPO
     from cyclomps.algs.dmrg1 import dmrg
     from numpy import complex_
     from cyclomps.mpo.tasep import return_mpo
     mpo = return_mpo(10,(0.5,0.5,1.))
     E0 = dmrg(mpo,
               alg='exact',
               dtype=complex_,
               tol=1e-3,
               max_iter=[4,2],
               min_iter=[2,0],
               mbd = [10,20],
               mps_subdir='test_mps',
               env_subdir='test_env',
               nStates=1,
               fixed_bd=False,
               orthonormalize=False,
               left=True,
               end_gauge=5)
     mpiprint(0,'Passed\n'+'='*20)
Beispiel #8
0
if __name__ == "__main__":
    from cyclomps.mpo.tasep import return_mpo, return_tebd_ops
    from cyclomps.algs.dmrg1 import dmrg
    N = 30
    a = 0.5
    b = 0.5
    D = 10
    sVec = [
        -1., -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, -0.05,
        -0.01, 0., 0.01, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
    ]
    for sind, s in enumerate(sVec):
        # Get operators
        ops = return_tebd_ops(N, (a, b, s))
        ham = return_mpo(N, (a, b, s))
        # Start by trying DMRG
        E0, mps = dmrg(ham,
                       mbd=D,
                       max_iter=5,
                       nStates=1,
                       fixed_bd=True,
                       return_state=True)
        # Try again with TEBD
        E = tebd(ops,
                 H=ham,
                 D=[D, D, D, D, D, D, D, D, D],
                 step_size=[1., 0.9, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1],
                 n_step=[10, 10, 10, 10, 10, 10, 10, 10, 10],
                 conv_tol=1e-8)
        print(s, E)
Beispiel #9
0
 def test_move_gauge_left_(self):
     mpiprint(
         0, '\n' + '=' * 50 +
         '\nTesting moving gauge left effect on Norm\n' + '-' * 50)
     from cyclomps.mpo.tasep import return_mpo
     N = 4
     d = 2
     mbd = 10
     nState = 2
     mpsL = create_mps_list([d] * N, mbd, nState)
     mpo = return_mpo(N, (0.5, 0.5, 1.))
     # Calculate initial norm
     mps = load_mps_list(mpsL)
     norm = zeros(nState, dtype=mpsL[0][0]['dtype'])
     E = zeros(nState, dtype=mpsL[0][0]['dtype'])
     for state in range(nState):
         norm[state] = calc_mps_norm(mpsL, state=state)
         psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0], mps[state][1],
                      mps[state][2], mps[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                           conj(mps[state][1]), conj(mps[state][2]),
                           conj(mps[state][3]))
         E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
     # Move guage one site left
     for state in range(nState):
         mpsL = move_gauge_left(mpsL,
                                state,
                                3,
                                return_ent=False,
                                return_wgt=False)
     # Calculate Final norm
     mps2 = load_mps_list(mpsL)
     norm2 = zeros(nState, dtype=mpsL[0][0]['dtype'])
     E_ = zeros(nState, dtype=mpsL[0][0]['dtype'])
     E2 = zeros(nState, dtype=mpsL[0][0]['dtype'])
     for state in range(nState):
         norm2[state] = calc_mps_norm(mpsL, state=state)
         psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0], mps[state][1],
                      mps[state][2], mps[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                           conj(mps[state][1]), conj(mps[state][2]),
                           conj(mps[state][3]))
         E_[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
         psi = einsum('apb,bqc,crd,dse->pqrs', mps2[state][0],
                      mps2[state][1], mps2[state][2], mps2[state][3])
         op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0], mpo[0][1],
                     mpo[0][2], mpo[0][3])
         psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps2[state][0]),
                           conj(mps2[state][1]), conj(mps2[state][2]),
                           conj(mps2[state][3]))
         E2[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
     # Print
     for state in range(nState):
         mpiprint(
             0, 'Norm of State {}: {},{}'.format(state, norm[state],
                                                 norm2[state]))
         mpiprint(
             0, 'Energies: {}, {}, {}'.format(E[state], E_[state],
                                              E2[state]))
         self.assertTrue(abs(norm[state] - norm2[state]) < 1e-8)
         self.assertTrue(abs(E[state] - E2[state]) < 1e-8)
     mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #10
0
    def test_renorm_avg_left_energy2(self):
        mpiprint(
            0, '\n' + '=' * 50 +
            '\nTesting state avg left renormalization effect on Energy\n' +
            '-' * 50)
        from cyclomps.tools.mps_tools import create_mps_list, make_mps_list_left, load_mps_list, calc_mps_norm, move_gauge
        from cyclomps.mpo.tasep import return_mpo
        from cyclomps.algs.dmrg1 import renormalize_left
        # Create an MPS
        d = 2
        N = 4
        mbd = 10
        nState = 4
        mpsL = create_mps_list([d] * N, mbd, nState)
        mpsL = make_mps_list_left(mpsL)
        # Load the MPO
        mpo = return_mpo(N, (0.5, 0.5, 1.))

        # Create a function to compute energy
        def calc_energy(mpsL, mpo, load_mps=True):
            if load_mps:
                mps = load_mps_list(mpsL)
            else:
                mps = mpsL
            E = zeros(nState, dtype=mps[0][0].dtype)
            for state in range(nState):
                psi = einsum('apb,bqc,crd,dse->pqrs', mps[state][0],
                             mps[state][1], mps[state][2], mps[state][3])
                op = einsum('iPpj,jQqk,kRrl,lSsm->PpQqRrSs', mpo[0][0],
                            mpo[0][1], mpo[0][2], mpo[0][3])
                psi_conj = einsum('apb,bqc,crd,dse->pqrs', conj(mps[state][0]),
                                  conj(mps[state][1]), conj(mps[state][2]),
                                  conj(mps[state][3]))
                E[state] = einsum('pqrs,PpQqRrSs,PQRS', psi, op, psi_conj)
            return E

        # Calc initial Energy
        E1 = calc_energy(mpsL, mpo)
        mps = load_mps_list(mpsL)
        E1_ = calc_energy(mps, mpo, load_mps=False)
        E1__ = calc_energy(mps, mpo, load_mps=False)
        # Move gauge using renormalization
        site = N - 1
        (mps0, ) = retrieve_tensors(site - 1, mpsList=mpsL)
        (mps1, ) = retrieve_tensors(site, mpsList=mpsL)
        mps0_ = copy.deepcopy(mps0)
        mps1_ = copy.deepcopy(mps1)
        mps0, mps1, EE, EEs, wgt = renormalize_left(mps0, mps1, state_avg=True)
        save_tensors(site - 1, mpsList=mpsL, mps=mps0)
        save_tensors(site, mpsList=mpsL, mps=mps1)
        # Check to make sure contracted states and local energies are the same
        for state in range(nState):
            finalState = einsum('apb,bqc->apqc', conj(mps0[state]),
                                conj(mps1[state]))
            initState = einsum('apb,bqc->apqc', conj(mps0_[state]),
                               conj(mps1_[state]))
            mpoComb = einsum('lPpm,mQqn->lPpQqn', mpo[0][site - 1],
                             mpo[0][site])
            initLocalE = einsum('apqc,lPpQqn,APQC->AlaCnc', initState, mpoComb,
                                conj(initState))
            finalLocalE = einsum('apqc,lPpQqn,APQC->AlaCnc', finalState,
                                 mpoComb, conj(finalState))
            self.assertTrue(summ(abss(finalState - initState)) < 1e-10)
            self.assertTrue(summ(abss(initLocalE - initLocalE)) < 1e-10)
        # Check to make sure we get the same energies from resulting states
        for state in range(nState):
            mps[state][site - 1] = mps0[state]
            mps[state][site] = mps1[state]
        # Calc Energy Again
        E2 = calc_energy(mps, mpo, load_mps=False)
        # Check Energies
        self.assertTrue(summ(abss(E1[0] - E2[0])) < 1e-10)
        self.assertTrue(summ(abss(E1[1] - E2[1])) < 1e-10)
        self.assertTrue(summ(abss(E1[2] - E2[2])) < 1e-10)
        self.assertTrue(summ(abss(E1[3] - E2[3])) < 1e-10)
        # Check for correct canonical form
        for state in range(nState):
            eye_check = einsum('apb,cpb->ac', mps1[state], conj(mps1[state]))
            eye_actual = eye(eye_check.shape[0])
            self.assertTrue(summ(abss(eye_check - eye_actual)) < 1e-10)
        mpiprint(0, 'Passed\n' + '=' * 50)
Beispiel #11
0
beta = 0.5
s = 1.

# Maximum bond dimension
mbd = 100

# Specify number of processors
n = 28

# Calculation Settings
alg = "'davidson'"
tol = 1e-5
max_iter = 1
min_iter = 0
mps_dir = "'tasep_mps'"
env_dir = "'tasep_env'"
nStates = 1
fixed_bd = True
state_avg = False
orthonormalize = False
end_gauge = 0
left = False

# Set up mpo
mpo = return_mpo(N,(alpha,beta,s))

# Run DMRG
cProfile.run("E0 = dmrg(mpo,alg="+alg+",dtype=complex_,mbd = "+str(mbd)+",tol="+str(tol)+",max_iter="+str(max_iter)+",min_iter="+str(min_iter)+",mps_subdir="+mps_dir+",env_subdir="+env_dir+",nStates="+str(nStates)+",fixed_bd="+str(fixed_bd)+",state_avg="+str(state_avg)+",orthonormalize="+str(orthonormalize)+",end_gauge="+str(end_gauge)+",left="+str(left)+")",'n'+str(n)+'_dmrg_stats_'+str(mbd))
if RANK == 0:
    p = pstats.Stats('n'+str(n)+'_dmrg_stats_'+str(mbd))
Beispiel #12
0
import unittest
from cyclomps.tools.utils import *
from cyclomps.algs.dmrg1 import dmrg
from numpy import complex_
from cyclomps.mpo.tasep import return_mpo
import cProfile
import pstats
mpo = return_mpo(10, (0.5, 0.5, 1.))
mbd = 10
n = 28
cProfile.run(
    "E0 = dmrg(mpo,alg='davidson',dtype=complex_,mbd = " + str(mbd) +
    ",tol=1e-5,max_iter=2,min_iter=2,mps_subdir='tasep_mps',env_subdir='tasep_env',nStates=1,fixed_bd=True,state_avg=False,orthonormalize=False,end_gauge=0,left=False)",
    'n' + str(n) + '_dmrg_stats_' + str(mbd))
if RANK == 0:
    p = pstats.Stats('n' + str(n) + '_dmrg_stats_' + str(mbd))