Skip to content

Commit

Permalink
send
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandro-santini committed Jun 15, 2022
1 parent d7065b1 commit 27ace1f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
Binary file modified algorithms/__pycache__/iTimeEvolvingBlockDecimation.cpython-38.pyc
Binary file not shown.
18 changes: 13 additions & 5 deletions algorithms/iTimeEvolvingBlockDecimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,23 @@ def set_U(self,dt,order=1):
if order == 1:
self.U.append(expm(-1j*H*dt).reshape(d,d,d,d).transpose(2,3,0,1))
self.U.append(expm(-1j*H*dt).reshape(d,d,d,d).transpose(2,3,0,1))
if order == 2:
elif order == 2:
self.U.append(expm(-1j*H*dt/2).reshape(d,d,d,d).transpose(2,3,0,1))
self.U.append(expm(-1j*H*dt).reshape(d,d,d,d).transpose(2,3,0,1))
self.U.append(expm(-1j*H*dt/2).reshape(d,d,d,d).transpose(2,3,0,1))
if order == 4:
elif order == 3:
c_trot = np.zeros(3)
d_trot = np.zeros(3)
c_trot[0] = 1; c_trot[1] = -2/3; c_trot[2] = 2/3
d_trot[0] = -1/24; d_trot[1] = 3/4; d_trot[2] = 7/24
for i in range(3):
self.U.append(expm(-1j*H*c_trot[i]*dt).reshape(d,d,d,d).transpose(2,3,0,1))
self.U.append(expm(-1j*H*d_trot[i]*dt).reshape(d,d,d,d).transpose(2,3,0,1))
elif order == 4:
tau1 = 1./(4.-4.**(1./3.))*dt; tau2=tau1;
tau3 = dt-2*tau1-2*tau2
for tau in [tau1/2,tau1,(tau1+tau2)/2,tau2,(tau2+tau3)/2,tau3,tau3/2 ]:
self.U.append(expm(-1j*H*tau/2).reshape(d,d,d,d).transpose(2,3,0,1))
for tau in [tau1/2,tau1,(tau1+tau2)/2,tau2,(tau2+tau3)/2,tau3,(tau2+tau3)/2,tau2,(tau1+tau2)/2,tau1,tau1/2]:
self.U.append(expm(-1j*H*tau).reshape(d,d,d,d).transpose(2,3,0,1))

def time_step(self):
for K in self.U:
Expand All @@ -63,7 +71,7 @@ def time_step(self):
self.psi.B2 = V
self.psi.B1 = oe.contract('i,ijk,k->ijk',1./self.psi.Sv,U,S)
self.psi.Sv, self.psi.B1, self.psi.B2 = S, self.psi.B2, self.psi.B1

def err_normalization(self):
return np.abs(self.psi.compute_norm()-1)

Expand Down
Binary file modified spin_systems/__pycache__/iHamiltonians.cpython-38.pyc
Binary file not shown.
13 changes: 11 additions & 2 deletions spin_systems/iHamiltonians.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ def IsingChainWithAncilla(J=1., h_z=0.25, h_x=0.):
sz_anc = np.kron(Id2,sz)
sx_anc = np.kron(Id2,sx)

H = -J*(np.kron(sx_sys,sx_sys))-h_z*(np.kron(sz_sys,Id4)+np.kron(Id4,sz_sys))-h_x*(np.kron(sx_sys,Id4)+np.kron(Id4,sx_sys))
H += -J*(np.kron(sx_anc,sx_anc))-h_z*(np.kron(sz_anc,Id4)+np.kron(Id4,sz_anc))-h_x*(np.kron(sx_anc,Id4)+np.kron(Id4,sx_anc))
H = -J*(np.kron(sx_sys,sx_sys))-h_z/2*(np.kron(sz_sys,Id4)+np.kron(Id4,sz_sys))-h_x/2*(np.kron(sx_sys,Id4)+np.kron(Id4,sx_sys))
H += -J*(np.kron(sx_anc,sx_anc))-h_z/2*(np.kron(sz_anc,Id4)+np.kron(Id4,sz_anc))-h_x/2*(np.kron(sx_anc,Id4)+np.kron(Id4,sx_anc))

return H

def IsingChain(J=1., h_z=0.25, h_x=0.):
sz = np.array([[1,0],[0,-1]])
sx = np.array([[0,1],[1,0]])
Id2 = np.eye(2)

H = -J*(np.kron(sx,sx))-h_z/2*(np.kron(sz,Id2)+np.kron(Id2,sz))-h_x/2*(np.kron(sx,Id2)+np.kron(Id2,sx))

return H

0 comments on commit 27ace1f

Please sign in to comment.