Skip to content

Commit

Permalink
committ
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandro-santini committed Jun 4, 2022
1 parent 96c166e commit 4a9129e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
13 changes: 12 additions & 1 deletion spin_systems/ClassicalIsingTermalState.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import numpy as np
import opt_einsum as oe
from ..tensors.MatrixProductState import MPS
from ..tensors.iMatrixProductState import iMPS

def Ising_ThermalState(L, K):
"""
Expand Down Expand Up @@ -36,4 +38,13 @@ def Ising_ThermalState(L, K):
tensors[i] = tensors[i].reshape(shp[0],shp[1]*shp[2],shp[3])
rho_t = MPS(L,d=4,tensors=tensors)
rho_t.right_normalize()
return rho_t
return rho_t

def iMPSstate(K):
B = Ising_ThermalState(3, K).tensors[1]
theta = oe.contract('abc,cde->abde',B,B).reshape(8,8)
Sb = np.linalg.svd(theta,compute_uv=False)[:2]
Sb /= np.linalg.norm(Sb)
return iMPS(Sb,B,B,d=4)


3 changes: 1 addition & 2 deletions spin_systems/Hamiltonians.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,4 @@ def Hierarchical_Dyson_model(N,sigma,h,J=1):
tensors[k][i+1,i] = np.eye(2)
if k+i<L:
tensors[k][-1,i,:,:] = A[k,k+i]*sigma_x
return MPO(L,tensors=tensors)

return MPO(L,tensors=tensors)
3 changes: 2 additions & 1 deletion spin_systems/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from . import Hamiltonians
from . import observables
from . import states
from . import ClassicalIsingTermalState
from . import ClassicalIsingTermalState
from . import iHamiltonians
Binary file modified spin_systems/__pycache__/ClassicalIsingTermalState.cpython-38.pyc
Binary file not shown.
18 changes: 18 additions & 0 deletions spin_systems/iHamiltonians.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy as np

def IsingChainWithAncilla(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)
Id4 = np.eye(4)

sz_sys = np.kron(sz,Id2)
sx_sys = np.kron(sx,Id2)

sz_anc = np.kron(Id2,sz)
sx_anc = np.kron(Id2,sz)

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))

return H

0 comments on commit 4a9129e

Please sign in to comment.