The new t-J site is defined as
Python: Select all
class t_Jk_Site(Site):
def __init__(self, cons_N='N', cons_Sz='Sz',Ly=1,k=1):
if cons_N not in ['N', 'parity', None]:
raise ValueError("invalid `cons_N`: " + repr(cons_N))
if cons_Sz not in ['Sz', 'parity', None]:
raise ValueError("invalid `cons_Sz`: " + repr(cons_Sz))
d = 3
states = ['holon', 'up', 'down']
N_diag = np.array([0,1,1], dtype=np.float64)
Nup = np.array([0,1,0], dtype=np.float64)
Ndown = np.array([0,0,1], dtype=np.float64)
Ntot = np.diag(N_diag)
JW = np.diag(1. - 2. * N_diag) # (-1)^Nu
JWu = np.diag(1. - 2. * Nup) # (-1)^Nu
JWd = np.diag(1. - 2. * Ndown) # (-1)^Nu
Cu = np.zeros((d, d))
Cu[0, 1] = 1.
Cdu = np.transpose(Cu)
Cd_noJW = np.zeros((d, d))
Cd_noJW[0, 2] = 1.
Cd = np.dot(JWu, Cd_noJW)
Cdd = np.transpose(Cd)
Sz = np.zeros((d, d))
Sz[1, 1] = 0.5
Sz[2, 2] = -0.5
Sp = np.zeros((d, d))
Sp[1, 2] = 1.0
Sm = np.zeros((d, d))
Sm[2, 1] = 1.0
ops = dict(JW=JW,Cu=Cu, Cdu=Cdu, Cd=Cd, Cdd=Cdd,
Ntot=Ntot,Sz=Sz, Sp=Sp, Sm=Sm) # yapf: disable
# handle charges
qmod = []
qnames = []
charges = []
M=[[0,0,0],[0,1,1]]
if cons_N == 'N':
for i in range(Ly):
qnames.append('N'+str(i))
qmod.append(1)
for i in range(Ly):
if i==k:
charges.append(M[1])
else:
charges.append(M[0])
elif cons_N == 'parity':
for i in range(Ly):
qnames.append('N'+str(i))
qmod.append(2)
for i in range(Ly):
if i==k:
charges.append(M[1])
else:
charges.append(M[0])
if cons_Sz == 'Sz':
qnames.append('Sz')
qmod.append(1)
charges.append([0, 1, -1])
print(charges)
if len(qmod) == 0:
leg = npc.LegCharge.from_trivial(d)
else:
if len(qmod) == 1:
charges = charges[Ly]
elif len(qmod) == Ly: #need to transpose
list1=[]
for i in range(len(charges[0])):
list2=[]
for j in range(len(charges)):
list2.append(charges[j][i])
list1.append(list2)
charges = list1
else: #need to transpose
list1=[]
for i in range(len(charges[0])):
list2=[]
for j in range(len(charges)):
list2.append(charges[j][i])
list1.append(list2)
charges = list1
chinfo = npc.ChargeInfo(qmod, qnames)
print(charges)
leg_unsorted = npc.LegCharge.from_qflat(chinfo, charges)
# sort by charges
perm_qind, leg = leg_unsorted.sort()
perm_flat = leg_unsorted.perm_flat_from_perm_qind(perm_qind)
self.perm = perm_flat
# permute operators accordingly
for opname in ops:
ops[opname] = ops[opname][np.ix_(perm_flat, perm_flat)]
# and the states
states = [states[i] for i in perm_flat]
self.cons_N = cons_N
self.cons_Sz = cons_Sz
Site.__init__(self, leg, states, **ops)
# specify fermionic operators
self.need_JW_string |= set(['Cu', 'Cdu', 'Cd', 'Cdd'])
def __repr__(self):
"""Debug representation of self"""
return "t_Jk_Site({cN!r}, {cS!r})".format(
cN=self.cons_N, cS=self.cons_Sz)