Exemplo n.º 1
0
def genHRfacSpatialQt(pindx,nsite,isite,int1e,qpts,maxslc=1,model_u=0.):
   p,ip = pindx
   iop  = 1
   isym = 2
   status = 'L'
   isz  = p%2
   site = mpo_dmrg_opers1e.genHRfacSpatial(pindx,nsite,isite,int1e,qpts,model_u)
   # Site physical indices
   qu,qd = qtensor_opers.genQphys(isym,isite)
   # Orbital dependent part
   ql1e,qr1e = qtensor_opers.genElemQnums(p,2*isite  ,iop,status)
   ql2e,qr2e = qtensor_opers.genElemQnums(p,2*isite+1,iop,status)
   ql1 = ql1e
   qr1 = qr2e
   ql1w,qr1w = genWfacQnums(nsite,2*isite  ,isz,status)
   ql2w,qr2w = genWfacQnums(nsite,2*isite+1,isz,status)
   ql2 = ql1w
   qr2 = qr2w
   ql = [q1+q2 for q1,q2 in itertools.product(ql1,ql2)]
   qr = [q1+q2 for q1,q2 in itertools.product(qr1,qr2)]
   if abs(model_u)>1.e-12: 
      if isite == 0:
         qr += [[0.,0.]]
      elif isite == nsite//2-1:
         ql += [[0.,0.]]
      else:
         ql += [[0.,0.]]
         qr += [[0.,0.]]
   # Reduce symmetry: local spin rotation do not change particle number
   if ip is not None:
      ql = qtensor_util.reduceQnumsToN(ql)
      qr = qtensor_util.reduceQnumsToN(qr)
      qu = qtensor_util.reduceQnumsToN(qu)
      qd = qtensor_util.reduceQnumsToN(qd)
   #
   # We sort the internal quantum number first
   #
   nql = len(ql)
   nqr = len(qr)
   idxl = qtensor_opers.sortQnums(ql)
   idxr = qtensor_opers.sortQnums(qr)
   ql = numpy.array(ql)[idxl]
   qr = numpy.array(qr)[idxr]
   site = site[numpy.ix_(idxl,idxr)].copy()
   # Slice operators if necessary
   qts = qtensor.Qt(2)
   qts.maxslc[0] = min(maxslc,nql) 
   qts.maxslc[1] = min(maxslc,nqr)
   qts.genDic()
   for islc in range(qts.maxslc[0]): 
      slc0 = parallel_util.partitionSites(nql,qts.maxslc[0],islc)
      for jslc in range(qts.maxslc[1]):
         slc1 = parallel_util.partitionSites(nqr,qts.maxslc[1],jslc)
	 ijdx = qts.ravel([islc,jslc])
         qts.dic[ijdx] = qtensor.qtensor([False,True,False,True])
         # Note that the qsyms for the last two dimensions are not collected
         qts.dic[ijdx].fromDenseTensor(site[numpy.ix_(slc0,slc1)],[ql[slc0],qr[slc1],qu,qd],ifcollect=[1,1,0,0])
	 qts.size[ijdx] = qts.dic[ijdx].size_allowed
   return qts
Exemplo n.º 2
0
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
Exemplo n.º 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
Exemplo n.º 4
0
def genHenRfacSpatialQt(dmrg, pindx, isite, iop):
    p, ip = pindx
    isym = 2
    site = mpo_dmrg_ptopers.genHenRfacSpatial(dmrg, pindx, isite, iop)
    if iop == 0:
        nbond = 3
    elif iop == 1 or iop == 2:
        nbond = 5
    # Site physical indices
    qu, qd = genQphys(isym, isite)
    ql = [[0., 0.]] * nbond
    qr = [[0., 0.]] * nbond
    if isite == 0: ql = [[0., 0.]]
    if isite == dmrg.nsite - 1: qr = [[0., 0.]]
    ql = numpy.array(ql)
    qr = numpy.array(qr)
    # Reduce symmetry: local spin rotation do not change particle number
    if ip is not None:
        ql = qtensor_util.reduceQnumsToN(ql)
        qr = qtensor_util.reduceQnumsToN(qr)
        qu = qtensor_util.reduceQnumsToN(qu)
        qd = qtensor_util.reduceQnumsToN(qd)
    nql = len(ql)
    nqr = len(qr)
    # Slice operators if necessary
    qts = qtensor.Qt(2)
    qts.maxslc[0] = 1
    qts.maxslc[1] = 1
    qts.genDic()
    for islc in range(qts.maxslc[0]):
        slc0 = parallel_util.partitionSites(nql, qts.maxslc[0], islc)
        for jslc in range(qts.maxslc[1]):
            slc1 = parallel_util.partitionSites(nqr, qts.maxslc[1], jslc)
            ijdx = qts.ravel([islc, jslc])
            qts.dic[ijdx] = qtensor.qtensor([False, True, False, True])
            # Note that the qsyms for the last two dimensions are not collected
            qts.dic[ijdx].fromDenseTensor(site[numpy.ix_(slc0, slc1)],
                                          [ql[slc0], qr[slc1], qu, qd],
                                          ifcollect=[1, 1, 0, 0])
            qts.size[ijdx] = qts.dic[ijdx].size_allowed
    return qts
Exemplo n.º 5
0
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