Example #1
0
def genMPO_Local2Rpt(nsite,ig,jg,ikey,jkey,fac,fname,xts,ifQt,debug=False):
   if debug: print '\n[mpo_dmrg_propsMPORpt.genMPO_Local2Rpt] fname=',fname
   if debug: print ' ig=',ig,' jg=',jg,' ikey/jkey=',(ikey,jkey)
   t0 = time.time()
   fop = h5py.File(fname,'w')
   npt = len(xts)
   nop = 1*npt
   fop['nop'] = nop
   for isite in range(nsite):
      ti = time.time()
      gname = 'site'+str(isite)
      grp = fop.create_group(gname)
      if not ifQt:
	 cop = mpo_dmrg_spinopers.genLocal2Spatial(nsite,isite,ig,jg,ikey,jkey,fac)
         for ipt in range(npt):
            rop = mpo_dmrg_opers.genExpISyPhiMat(xts[ipt])
      	    wop = numpy.tensordot(cop,rop,axes=([3],[0]))
            grp['op'+str(ipt)] = wop
      else:
         for ipt in range(npt):
	    cop = qtensor_spinopers.genLocal2RSpatialQt(nsite,isite,ig,jg,ikey,jkey,fac,xts[ipt])
            cop.dump(grp,'op'+str(ipt))
      tf = time.time()
      if debug: print ' isite =',isite,' time = %.2f s'%(tf-ti) 
   t1 = time.time()
   if debug: print ' time for genMPO_Local2Rpt = %.2f s'%(t1-t0)
   return fop
def genLocalRSpatialQt(nsite, isite, ig, key, phi):
    isym = 2
    # (D,D,4,4) [D<=2]
    cop = mpo_dmrg_spinopers.genLocalSpatial(nsite, isite, ig, key)
    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 = qtensor_opers.genQphys(isym, isite)
    ql, qr = genSpinOpersQnums(nsite, isite, key)
    # Reduce symmetry
    qu = qtensor_util.reduceQnumsToN(qu)
    qd = qtensor_util.reduceQnumsToN(qd)
    ql = qtensor_util.reduceQnumsToN(ql)
    qr = qtensor_util.reduceQnumsToN(qr)
    qt.fromDenseTensor(site, [ql, qr, qu, qd], ifcollect=[0, 0, 0, 0])
    return qt
Example #3
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
def genLocal2RSpatialQt(nsite, isite, ig, jg, ikey, jkey, fac, phi):
    isym = 2
    # (D,D,4,4) [D<=2]
    cop = mpo_dmrg_spinopers.genLocal2Spatial(nsite, isite, ig, jg, ikey, jkey,
                                              fac)
    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 = qtensor_opers.genQphys(isym, isite)
    qli, qri = genSpinOpersQnums(nsite, isite, ikey)
    qlj, qrj = genSpinOpersQnums(nsite, isite, jkey)
    # Direct product of quantum numbers
    ql = [q1 + q2 for q1, q2 in itertools.product(qli, qlj)]
    qr = [q1 + q2 for q1, q2 in itertools.product(qri, qrj)]
    # Reduce symmetry
    qu = qtensor_util.reduceQnumsToN(qu)
    qd = qtensor_util.reduceQnumsToN(qd)
    ql = qtensor_util.reduceQnumsToN(ql)
    qr = qtensor_util.reduceQnumsToN(qr)
    qt.fromDenseTensor(site, [ql, qr, qu, qd], ifcollect=[0, 0, 0, 0])
    return qt