Beispiel #1
0
def genMPO_Apq(nsite, islst, fname, ifQt, debug=False):
    if debug: print '\n[mpo_dmrg_propsMPO.genMPO_Apq] fname=', fname
    t0 = time.time()
    fop = h5py.File(fname, 'w')
    nop = nsite**2
    fop['nop'] = nop
    is1, is2 = islst
    for isite in range(nsite):
        ti = time.time()
        gname = 'site' + str(isite)
        grp = fop.create_group(gname)
        if not ifQt:
            # Loop over operators
            idx = 0
            for p in range(nsite):
                for q in range(nsite):
                    oplst = [[2 * p + is1, 1], [2 * q + is2, 0]]
                    cop = mpo_dmrg_opers.genElemProductSpatial(oplst, isite)
                    grp['op' + str(idx)] = cop
                    idx += 1
        else:
            # Loop over operators
            idx = 0
            for p in range(nsite):
                for q in range(nsite):
                    oplst = [[2 * p + is1, 1], [2 * q + is2, 0]]
                    cop = qtensor_opers.genElemProductSpatialQt(oplst, isite)
                    cop.dump(grp, 'op' + str(idx))
                    idx += 1
        tf = time.time()
        if debug: print ' isite =', isite, ' time = %.2f s' % (tf - ti)
    t1 = time.time()
    if debug: print ' time for genMPO_Apq = %.2f s' % (t1 - t0)
    return fop
Beispiel #2
0
def genMPO_Epq(nsite, p, q, fname, ifQt, debug=False):
    if debug: print '\n[mpo_dmrg_propsMPO.genMPO_Epq] fname=', fname
    t0 = time.time()
    fop = h5py.File(fname, 'w')
    nop = 2
    fop['nop'] = nop
    for isite in range(nsite):
        ti = time.time()
        gname = 'site' + str(isite)
        grp = fop.create_group(gname)
        if not ifQt:
            # {pa+*qa,pb+*qb}
            for is1 in [0, 1]:
                oplst = [[2 * p + is1, 1], [2 * q + is1, 0]]
                cop = mpo_dmrg_opers.genElemProductSpatial(oplst, isite)
                grp['op' + str(is1)] = cop
        else:
            # {pa+*qa,pb+*qb}
            for is1 in [0, 1]:
                oplst = [[2 * p + is1, 1], [2 * q + is1, 0]]
                cop = qtensor_opers.genElemProductSpatialQt(oplst, isite)
                cop.dump(grp, 'op' + str(is1))
        tf = time.time()
        if debug: print ' isite =', isite, ' time = %.2f s' % (tf - ti)
    t1 = time.time()
    if debug: print ' time for genMPO_Epq = %.2f s' % (t1 - t0)
    return fop
Beispiel #3
0
def genElemProductSpatialQt(oplst, isite):
    isym = 2
    # (1,1,4,4)
    site = mpo_dmrg_opers.genElemProductSpatial(oplst, isite)
    # Status
    qt = qtensor.qtensor([False, True, False, True])
    # Site physical indices
    qu, qd = genQphys(isym, isite)
    # Orbital dependent part
    ql, qr = genElemProductQnums(oplst, isite)
    # Final conversion
    qt.fromDenseTensor(site, [ql, qr, qu, qd])
    return qt
Beispiel #4
0
def genElemProductRSpatialQt(oplst, isite, phi):
    isym = 2
    # (1,1,4,4)
    cop = mpo_dmrg_opers.genElemProductSpatial(oplst, isite)
    rop = mpo_dmrg_opers.genExpISyPhiMat(phi)
    site = numpy.tensordot(cop, rop, axes=([3], [0]))
    # Status
    qt = qtensor.qtensor([False, True, False, True])
    # Site physical indices
    qu, qd = genQphys(isym, isite)
    # Orbital dependent part
    ql, qr = genElemProductQnums(oplst, isite)
    # Reduce symmetry: local spin rotation do not change particle number
    qu = qtensor_util.reduceQnumsToN(qu)
    qd = qtensor_util.reduceQnumsToN(qd)
    ql = qtensor_util.reduceQnumsToN(ql)
    qr = qtensor_util.reduceQnumsToN(qr)
    # Final conversion
    qt.fromDenseTensor(site, [ql, qr, qu, qd], ifcollect=[0, 0, 0, 0])
    return qt