Example #1
0
def test_TFIModel2D_general():
    check_general_model(
        TFIModel2D, dict(Lx=2, J=1., g=0.1), {
            'Ly': [2, 3],
            'bc_MPS': ['finite', 'infinite'],
            'bc_y': ['ladder', 'cylinder']
        })
def test_BoseHubbardModel():
    check_general_model(bose_hubbard.BoseHubbardModel, {
        'lattice': "Square",
        'Lx': 2,
        'Ly': 3,
        'V': 0.1,
        'U': 0.3
    }, {})
Example #3
0
def test_BosonicHaldane():
    model_pars = {
        'Lx': 3,
        'Ly': 3,
        'phi_ext': 0.1,
        'conserve': 'N',
    }
    check_general_model(BosonicHaldaneModel, model_pars, {'bc_MPS': ['finite', 'infinite']})
def test_TFIModel2D_general():
    check_general_model(
        TFIModel, dict(Lx=2, J=1., g=0.1), {
            'Ly': [2, 3],
            'bc_MPS': ['finite', 'infinite'],
            'bc_y': ['ladder', 'cylinder'],
            'lattice': ['Square', 'Honeycomb', 'Kagome']
        })
Example #5
0
def test_SpinChainNNN():
    check_general_model(spins_nnn.SpinChainNNN, {
        'hz': 0.5,
        'Jx': -2.,
        'Jy': -2.,
        'Jz': 0.4,
        'L': 4
    }, {
        'conserve': [None, 'Sz'],
        'bc_MPS': ['finite', 'infinite']
    })
Example #6
0
def test_HofstadterFermions():
    model_pars = {'Lx': 3, 'Ly': 3, 'phi': (1, 3), 'conserve': 'N', 'v': 0.456, 'mu': 0.123}
    check_general_model(HofstadterFermions, model_pars, {
        'bc_MPS': ['finite', 'infinite'],
        'gauge': ['landau_x', 'landau_y'],
    })
    model_pars['gauge'] = 'symmetric'
    model_pars['Lx'] = model_pars['Ly'] = 4
    model_pars['phi'] = (1, 4)
    model_pars['mx'] = model_pars['my'] = 2
    check_general_model(HofstadterFermions, model_pars, {'bc_MPS': ['finite', 'infinite']})
Example #7
0
def test_SpinChain():
    check_general_model(spins.SpinChain, {}, {
        'conserve': [None, 'parity', 'Sz'],
        'S': [0.5, 1, 2]
    })
    check_general_model(spins.SpinChain, {'hz': 2.,
                                          'Jx': -4.,
                                          'Jz': -0.4,
                                          'L': 4}, {
                                              'conserve': [None, 'parity'],
                                              'bc_MPS': ['finite', 'infinite']
                                          })
Example #8
0
def test_XXZChain_general(tol=1.e-14):
    check_general_model(XXZChain, dict(L=4, Jxx=1., hz=0., bc_MPS='finite'), {
        'Jz': [0., 1., 2.],
        'hz': [0., 0.2]
    })
    model_param = dict(L=3, Jxx=1., Jz=1.5, hz=0.25, bc_MPS='finite')
    m1 = XXZChain(model_param)
    m2 = XXZChain2(model_param)
    for Hb1, Hb2 in zip(m1.H_bond, m2.H_bond):
        if Hb1 is None:
            assert Hb2 is None
            continue
        assert npc.norm(Hb1 - Hb2) < tol
Example #9
0
def test_AKLT_finite():
    L = 4
    check_general_model(aklt.AKLTChain, {'L': L}, {})
    M = aklt.AKLTChain({'L': L, 'bc_MPS': 'finite'})
    psi = MPS.from_lat_product_state(M.lat, [['up'], ['down']])
    eng = TwoSiteDMRGEngine(
        psi, M, {'trunc_params': {
            'svd_min': 1.e-10,
            'chi_max': 10
        }})
    E0, psi0 = eng.run()
    assert abs(E0 - (-2 / 3.) * (L - 1)) < 1.e-10
    # note: if we view the system as spin-1/2 projected to spin-1, the first and last spin
    # are arbitrary.
    # if they are in a superposition, this will contribute at most another factor of 2 to chi.
    assert all([chi <= 4 for chi in psi0.chi])
def test_TFIChain_general():
    check_general_model(TFIChain, dict(L=4, J=1., bc_MPS='finite'), {
        'conserve': [None, 'parity'],
        'g': [0., 0.2]
    })
def test_BoseHubbardModel():
    check_general_model(bose_hubbard_chain.BoseHubbardModel, {'lattice': "Square"}, {})
Example #12
0
def test_XXZChain_general():
    check_general_model(XXZChain, dict(L=4, Jxx=1., hz=0., bc_MPS='finite'), {
        'Jz': [0., 1., 2.],
        'hz': [0., 0.2]
    })
def test_BoseHubbardChain():
    check_general_model(bose_hubbard.BoseHubbardChain, {}, {})
Example #14
0
def test_FermionChain():
    check_general_model(FermionChain, {'L': 4}, {
        'conserve': [None, 'parity', 'N'],
        'mu': [0., 0.123],
        'bc_MPS': ['finite', 'infinite']
    })
Example #15
0
def test_SpinModel():
    check_general_model(spins.SpinModel, {'lattice': "Square"}, {})
def test_FermiHubbardChain():
    check_general_model(fermions_hubbard.FermionicHubbardChain, {}, {})
def test_FermiHubbardModel():
    check_general_model(fermions_hubbard.FermionicHubbardModel,
                        {'lattice': "Square"}, {})
Example #18
0
def test_MixedXKModel_general(model_class):
    check_general_model(model_class, dict(Lx=2, Ly=3, bc_MPS='infinite'))
Example #19
0
def test_ToricCode_general():
    check_general_model(ToricCode, dict(Lx=2, Ly=3, bc_MPS='infinite'), {
        'conserve': [None, 'parity'],
    })
Example #20
0
def test_HofstadterBosons():
    check_general_model(HofstadterBosons, {'Lx': 4}, {
        'conserve': [None, 'parity', 'N'],
        'U': [0., 0.123],
        'bc_MPS': ['finite', 'infinite']
    })
Example #21
0
def test_FermiHubbardModel():
    check_general_model(hubbard.FermiHubbardModel, {
        'lattice': "Square",
        'Lx': 2,
        'Ly': 3
    }, {})
Example #22
0
def test_SpinModel():
    check_general_model(spins.SpinModel, {'lattice': "Square", 'Lx': 2, 'Ly': 3}, {})
Example #23
0
def test_FermionModel():
    check_general_model(FermionModel, {'lattice': "Square"}, {})
Example #24
0
def test_FermionModel():
    check_general_model(FermionModel, {
        'lattice': "Square",
        'Lx': 2,
        'Ly': 3
    }, {})
Example #25
0
def test_FermiHubbardChain():
    check_general_model(hubbard.FermiHubbardChain, {}, {})