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 genGlobalSpatialQt(nsite, isite, key):
    isym = 2
    # (D,D,4,4) [D<=2]
    site = mpo_dmrg_spinopers.genGlobalSpatial(nsite, isite, key)
    # Status
    qt = qtensor.qtensor([False, True, False, True])
    # Site physical indices
    qu, qd = qtensor_opers.genQphys(isym, isite)
    ql, qr = genSpinOpersQnums(nsite, isite, key)
    qt.fromDenseTensor(site, [ql, qr, qu, qd])
    return qt
Exemplo n.º 3
0
def genLocal2SpatialQt(nsite, isite, ig, jg, ikey, jkey, fac):
    isym = 2
    # (D,D,4,4) [D<=2]
    site = mpo_dmrg_spinopers.genLocal2Spatial(nsite, isite, ig, jg, ikey,
                                               jkey, fac)
    # 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)]
    qt.fromDenseTensor(site, [ql, qr, qu, qd])
    return qt
Exemplo n.º 4
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.º 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