Created
December 28, 2017 21:34
-
-
Save rakhuba/614c1e2c61f05cc8ed05af1bf898ef8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function, absolute_import, division | |
from six.moves import xrange | |
import sys | |
import tt | |
import numpy as np | |
from tt.eigb import eigb | |
import time | |
import copy | |
""" Compute minimal eigenvalues for the Heisenberg model """ | |
def gen_1d(mat,e,i,d): | |
w = mat | |
for j in range(i): | |
w = tt.kron(e,w) | |
for j in range(d-i-1): | |
w = tt.kron(w,e) | |
return w | |
def gen_heisen(d, Jx=1., Jz=1.): | |
sx = [[0, 1], [1, 0]] | |
sx = np.array(sx,dtype=np.float) | |
sz = [[1, 0], [0, -1]] | |
sz = np.array(sz,dtype=np.float) | |
sz = 0.5 * sz | |
sp = [[0, 1], [0, 0]]; sp = np.array(sp, dtype=np.float) | |
sm = sp.T | |
e = np.eye(2) | |
sx = tt.matrix(sx,1e-12) | |
sz = tt.matrix(sz,1e-12) | |
sp = tt.matrix(sp,1e-12) | |
sm = tt.matrix(sm,1e-12) | |
e = tt.matrix(e,1e-12) | |
#Generate ssx, ssz | |
ssp = [gen_1d(sp, e, i, d) for i in range(d)] | |
ssz = [gen_1d(sz, e, i, d) for i in range(d)] | |
ssm = [gen_1d(sm, e, i, d) for i in range(d)] | |
ssx = [gen_1d(sx, e, i, d) for i in range(d)] | |
A = None | |
for i in range(d-1): | |
A = A + Jx * (ssp[i] * ssm[i+1] + ssm[i] * ssp[i+1]) + Jz * (ssz[i] * ssz[i+1]) | |
A = A.round(1e-8) | |
A = A.round(1e-8) | |
return A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment