Ejemplo n.º 1
0
def eval_vbond(pepsa0, pepsa, i, j, auxbond):
    debug = False
    # Sz*Sz
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("pq,qludr->pludr", Sz, pepsa[i, j])
    pepsb[i + 1, j] = einsum("pq,qludr->pludr", Sz, pepsa[i + 1, j])
    valzz = peps.dot(pepsa0, pepsb, auxbond)
    if debug: print(i, j), 'valzz=', valzz
    # Sp*Sm
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("xpq,qludr->plxudr", Sp,
                         pepsa[i, j]).merge_adjpair(2, 3)
    pepsb[i + 1, j] = einsum("xpq,qludr->pluxdr", Sm,
                             pepsa[i + 1, j]).merge_adjpair(3, 4)
    valpm = peps.dot(pepsa0, pepsb, auxbond)
    if debug: print(i, j), 'valpm=', valpm
    # Sm*Sp
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("xpq,qludr->plxudr", Sm,
                         pepsa[i, j]).merge_adjpair(2, 3)
    pepsb[i + 1, j] = einsum("xpq,qludr->pluxdr", Sp,
                             pepsa[i + 1, j]).merge_adjpair(3, 4)
    valmp = peps.dot(pepsa0, pepsb, auxbond)
    if debug: print(i, j), 'valmp=', valmp
    return valzz + 0.5 * (valpm + valmp)
Ejemplo n.º 2
0
def test_conf():
    np.random.seed(5)
    nr = 3
    nc = 3
    pdim = 2
    bond = 2
    auxbond = 4
    # Initialization:
    # [[0 1 0 1]
    #  [1 0 1 0]
    #  [0 1 0 1]
    #  [1 0 1 0]
    #  [0 1 0 1]
    #  [1 0 1 0]]
    configa = np.zeros([nr, nc], dtype=np.int)
    for i in range(nr):
        for j in range(nc):
            configa[i, j] = (i + j) % 2
    pepsa = peps.create(pdim, configa)
    #for i in range(nr):
    #    for j in range(nc):
    #        print '(i,j)=',(i,j)
    #        pepsa[i,j].prt()
    print "CEVAL =", peps.ceval(pepsa, configa, auxbond)
    PP = peps.dot(pepsa, pepsa, None)
    print "<P|P> =", PP

    Sp = peps_h.get_Sp()
    Sm = peps_h.get_Sm()
    Sz = peps_h.get_Sz()
    i = j = 0

    # Sm*Sp
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("xpq,qludr->plxudr", Sm,
                         pepsa[i, j]).merge_adjpair(2, 3)
    pepsb[i, j].prt()
    pepsb[i, j + 1] = einsum("xpq,qludr->pluxdr", Sp,
                             pepsa[i, j + 1]).merge_adjpair(3, 4)
    valmp = peps.dot(pepsb, pepsa, auxbond)
    print 'valmp=', valmp
    # Sz*Sz
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("pq,qludr->pludr", Sz, pepsa[i, j])
    pepsb[i, j + 1] = einsum("pq,qludr->pludr", Sz, pepsa[i, j + 1])
    valzz = peps.dot(pepsb, pepsa, auxbond)
    print 'valzz=', valzz
    # Sp*Sm
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("xpq,qludr->plxudr", Sp,
                         pepsa[i, j]).merge_adjpair(2, 3)
    pepsb[i, j + 1] = einsum("xpq,qludr->pluxdr", Sm,
                             pepsa[i, j + 1]).merge_adjpair(3, 4)
    valpm = peps.dot(pepsb, pepsa, auxbond)
    print 'valpm=', valpm
    return 0
Ejemplo n.º 3
0
def eval_vbond(pepsa0, pepsa, i, j, auxbond):
    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("pq,qludr->pludr", Sz, pepsa[i, j])
    pepsb[i + 1, j] = einsum("pq,qludr->pludr", Sz, pepsa[i + 1, j])
    valzz = peps.dot(pepsa0, pepsb, auxbond)

    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("pq,qludr->pludr", Sp, pepsa[i, j])
    pepsb[i + 1, j] = einsum("pq,qludr->pludr", Sm, pepsa[i + 1, j])
    valpm = peps.dot(pepsa0, pepsb, auxbond)

    pepsb = peps.copy(pepsa)
    pepsb[i, j] = einsum("pq,qludr->pludr", Sm, pepsa[i, j])
    pepsb[i + 1, j] = einsum("pq,qludr->pludr", Sp, pepsa[i + 1, j])
    valmp = peps.dot(pepsa0, pepsb, auxbond)
    return valzz + .5 * (valpm + valmp)