{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
"import scipy\n",
"import scipy.sparse as sparse\n",
"import scipy.sparse.linalg as spalin\n",
"import numpy as np\n",
"from scipy import linalg\n",
"import matplotlib.pyplot as plt\n",
"\n",
"np.random.seed(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is the list of functions I'm going to use. I would usually have these in a separate \"module\".\n",
"\n",
"Build lists of x,y,z Pauli matrices on each site.\n",
"Write general code for constructing two-body and one-body terms in Hamiltonians. \n",
"Obtain the level statistics distributions from the spectrum. \n",
"Contruct projectors onto \"diagonal\" symmetry sectors"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def gen_s0sxsysz(L): \n",
" sx = sparse.csr_matrix([[0., 1.],[1., 0.]]) \n",
" sy = sparse.csr_matrix([[0.,-1j],[1j,0.]]) \n",
" sz = sparse.csr_matrix([[1., 0],[0, -1.]])\n",
" s0_list =[]\n",
" sx_list = [] \n",
" sy_list = [] \n",
" sz_list = []\n",
" I = sparse.csr_matrix(np.eye(2**L))\n",
" for i_site in range(L):\n",
" if i_site==0: \n",
" X=sx \n",
" Y=sy \n",
" Z=sz \n",
" else: \n",
" X= sparse.csr_matrix(np.eye(2)) \n",
" Y= sparse.csr_matrix(np.eye(2)) \n",
" Z= sparse.csr_matrix(np.eye(2))\n",
" \n",
" for j_site in range(1,L): \n",
" if j_site==i_site: \n",
" X=sparse.kron(X,sx, 'csr')\n",
" Y=sparse.kron(Y,sy, 'csr') \n",
" Z=sparse.kron(Z,sz, 'csr') \n",
" else: \n",
" X=sparse.kron(X,np.eye(2),'csr') \n",
" Y=sparse.kron(Y,np.eye(2),'csr') \n",
" Z=sparse.kron(Z,np.eye(2),'csr')\n",
" sx_list.append(X)\n",
" sy_list.append(Y) \n",
" sz_list.append(Z)\n",
" s0_list.append(I)\n",
"\n",
" return s0_list, sx_list,sy_list,sz_list \n",
"\n",
"\n",
"def gen_op_total(op_list):\n",
" L = len(op_list)\n",
" tot = op_list[0]\n",
" for i in range(1,L): \n",
" tot = tot + op_list[i] \n",
" return tot\n",
"\n",
"def gen_onsite_field(op_list, h_list):\n",
" L= len(op_list)\n",
" H = h_list[0]*op_list[0]\n",
" for i in range(1,L): \n",
" H = H + h_list[i]*op_list[i] \n",
" return H\n",
"\n",
"# generates \\sum_i O_i O_{i+k} type interactions\n",
"def gen_interaction_kdist(op_list, op_list2=[],k=1, J_list=[], bc='obc'):\n",
" L= len(op_list)\n",
"\n",
" if op_list2 ==[]:\n",
" op_list2=op_list\n",
" H = sparse.csr_matrix(op_list[0].shape)\n",
" if J_list == []:\n",
" J_list =[1]*L\n",
" Lmax = L if bc == 'pbc' else L-k\n",
" for i in range(Lmax):\n",
" H = H+ J_list[i]*op_list[i]*op_list2[np.mod(i+k,L)]\n",
" return H \n",
" \n",
"def gen_nn_int(op_list, J_list=[], bc='obc'):\n",
" return gen_interaction_kdist(op_list,op_list, 1, J_list, bc)\n",
"\n",
"def LevelStatistics(energySpec, ret=True):\n",
" delta = energySpec[1:] -energySpec[0:-1]\n",
" r = list(map(lambda x,y: min(x,y)*1.0/max(x,y), delta[1:], delta[0:-1]))\n",
" if ret==True:\n",
" return np.array(delta), np.array(r), np.mean(r)\n",
" return np.mean(r)\n",
"\n",
"def gen_diagprojector(symvec, symval):\n",
" ind = np.where(symvec==float(symval))\n",
" dim = np.size(ind)\n",
" P = sparse.lil_matrix((dim,len(symvec)))\n",
" for j in range(dim):\n",
" P[j,ind[0][j]] = 1.0\n",
" return P\n",
"\n",
"### !!!! Assumes real eigenvectors!!!!!! #### (Computation is faster if you know your eigenvectors are real)\n",
"def gen_diagonal_ME(op, evecs):\n",
" return np.sum(evecs*np.dot(op, evecs),0)\n",
"\n",
"\n",
" \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Random Matrix Level Statistics #"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2x2 random matrices and the Wigner surmise ###\n",
"Let's start by looking at the distribution of level spacings for a 2x2 real, symmetric Hamiltonian with matrix elements drawn from the Gaussian ensemble (\"GOE = Gaussian Orthogonal Ensemble\").\n",
"\n",
"$H = \\begin{pmatrix} \n",
" h_{11} & h_{12} \\\\ \n",
" h_{12} & h_{22}\n",
" \\end{pmatrix}$.\n",
" \n",
"where $h_{11}, h_{12}, h_{22}$ are drawn randomly and independently from the normal distribution. The eigenvalues for this Hamiltonian are \n",
"\n",
"$E_{1,2} = \\frac{h_{11} + h_{22}}{2} \\pm \\frac{1}{2} \\sqrt{(h_{11}-h_{22})^2 + 4 h_{12}^2}$.\n",
"\n",
"\n",
"You can easily derive (try this using the steps outlined in lecture!) that the distribution of level spacings $s = E_1 - E_2 = \\sqrt{(h_{11}-h_{22})^2 + 4 h_{12}^2}$ agrees with the predicted Wigner surmise (1950s):\n",
"\n",
"$P_{GOE}(s) = \\frac{1}{2} \\pi s e^{-\\frac{1}{4} \\pi s^2}$.\n",
"\n",
"\n",
"Note that I'll use $s$ and $\\Delta$ interchangeably to refer to the level spacings in the spectrum: $\\Delta_n=s_n = E_n-E_{n-1}$. This distribution goes to zero as $s\\rightarrow 0$, reflecting the \"level repulsion\" characteristic of chaotic systems. Indeed, as the expression for $s$ shows, even if $h_{11}$ and $h_{22}$ are degenerate, the eigenvalues are not degenerate because of the off-diagonal coupling $h_{12}$. That is, two levels that try to become degenerate are still \"repelled\" away from each other due to the coupling $h_{12}$. \n",
"\n",
"\n",
"\n",
"\n",
"A random matrix (we'll consider larger random matrices momentarily) is a good model for a chaotic system since, when viewed as a Hamiltonian, it reflects a system with all degrees of coupled to each other in a completely random fashion. Remarkably, local thermalizing spin 1/2 local Hamiltonians (which may have no random parameters at all) also show GOE level statistics! When written as a matrix, these local Hamiltonian models are extremely sparse. So the fact that their eigenspectra show the same statistics as dense random matrices isn't obvious a priori. We're only now (2018) starting to prove how random matrix statistics arises in such models in a few specific cases (Work by Prosen group and Chalker group).\n",
"\n",
"\n",
"By contrast, if the off-diagonal terms in the Hamiltonian $h_{12}=h_{21}$ are forced to be zero, say due to symmetry reasons, then the eigenvalues (equal to the two diagonal entries) are uncorrelated from each each other and their spacing follows a Poisson distribution characteristic of the intervals between uncorrelated random events. The two levels can freely pass through each other and there is no level repulsion. Which means level spacings can be zero with high probability. Similar Poisson statistics are found in integrable systems with extensively many conservation laws (since these extra symmetries prevent generic mixing between spectra), and in MBL systems with extensively many \"emergent\" conservation laws -- the l-bits.\n",
"\n",
"$P_{Poisson}(s) = e^{-s}$. \n",
"\n",
"Note that both the GOE and Poisson distributions are normalized so that the mean level spacing is 1: \n",
"\n",
"$\\langle s \\rangle = \\int ds\\; s \\;P(s) = 1$\n",
"\n",
"This normalization is important to arrive at a universal distribution for level spacings. Of course, if we scale all entries of our matrix by a factor of two, the spacing will also be scaled up by a factor of two. So this normalization is done to get rid of such non-universal effects. When we consider larger $NxN$ random matrices (below), the spacings will depend on $N$ so we will again have to adjust the spectrum to have $\\langle s \\rangle =1$. Such adjustments are called \"spectral unfolding\". \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"## Plot GOE and Poisson distributions\n",
"slist = np.linspace(0,5,100)\n",
"GOE = 0.5*np.pi*slist*np.exp(-0.25*np.pi*slist*slist) \n",
"Poisson = np.exp(-slist)\n",
"plt.figure()\n",
"plt.plot(slist, GOE, label='GOE' )\n",
"plt.plot(slist, Poisson, label='Poisson')\n",
"_=plt.legend()\n",
"_=plt.xlabel('s')\n",
"_=plt.ylabel('P(s)')\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Verify Wigner surmise for 2x2 random matrices\n",
"\n",
"niter = 100000\n",
"delta = np.zeros(niter)\n",
"for n in range(niter):\n",
" randlist = np.random.normal(size = 3)\n",
" M = np.zeros((2,2))\n",
" M[0,0] = randlist[0]\n",
" M[1,1] = randlist[1]\n",
" M[0,1] = M[1,0]= randlist[2]\n",
" \n",
" evals = linalg.eigvalsh(M)\n",
" delta[n] = evals[1]-evals[0]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"plt.figure()\n",
"_=plt.hist(delta/np.mean(delta), bins=100, normed=True) #I divide by the mean to have avg. spacing = 1.\n",
"\n",
"x = np.linspace(0, 4,200)\n",
"GOE = 0.5*np.pi*x*np.exp(-0.25*np.pi*x*x) ### Wigner surmise\n",
"_=plt.plot(x,GOE, 'r', lw=3, label = 'Wigner GOE surmise')\n",
"_=plt.xlabel(r'$\\Delta$')\n",
"_=plt.ylabel(r'$P(\\Delta)$')\n",
"_=plt.title('Level Spacing distribution for 2x2 Gaussian random matrices' )\n",
"_=plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### $N x N$ random matrices ###\n",
"Now let us do this for a large $NxN$ random matrices, again drawn from the GOE ensemble. Since the level spacings will depend on $N$ so we will have to adjust the spectrum to normalize the mean level spacing. I'll consider two different spectral unfolding procedures below for normalizing the mean level spacing to one: a \"naive\" procedure and a more sophisticated one (which is standard in the literature). The naive method simply normalizes $s_i$ by $\\langle s \\rangle$. But this doesn't work so well because the density of states is not uniform -- thus, spacings near $E=0$ where the spectrum is the densest (and the level spacing smallest) should have been normalized differently from spacings near the edges of the spectrum. A standard technique for more properly unfolding the spectrum obtains the \"staircase function\" $N(E)$ as the number of levels upto energy $E$. This has a smooth part $N_{\\rm sm}$ and a fluctuating part. The unfolded spectrum is defined as $\\epsilon_i = N_{\\rm sm}(E_i)$. On average, the local density of states for this unfolded spectrum is approximately one. \n",
"\n",
"Finally, I should mention that there are many different approaches for spectral unfolding (which can be quite ad hoc) and there are papers detailing how various aspects of the spectrum can be quite sensitive to particular unfolding techniques. Thus, for looking at level spacing distributions, it's safest to switch to a different measure of level spacings, the r-ratio, defined by Oganesyan and Huse which precludes the need for unfolding by considering a dimensionless ratio of adjacent level spacings:\n",
"$r_n = \\frac{\\min\\{\\Delta_n, \\Delta_{n-1}\\}}{\\max\\{\\Delta_n, \\Delta_{n-1}\\}}$. Notice that $r\\in [0,1]$ so all dependences on system sizes have been removed. Atas et. al. (PRL 2013) have derived the corresponding GOE/Poisson distributions for the r-ratio and these take the form: \n",
"\n",
"$P_{GOE}(r) = \\frac{27}{4}\\frac{r+r^2}{(1+r+r^2)^{5/2}}$\n",
"\n",
"\n",
"$P_{Poisson}(r) = \\frac{2}{(1+r)^2}$\n",
"\n",
"Below, I'll show the level spacing distributions using all three techniques: \"naive\", staircase unfolded, and r-ratio. \n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"## Constructing a symmetric random matrix efficiently\n",
"a= np.random.normal(size=(4,4))\n",
"np.set_printoptions(precision=2)\n",
"print(a)\n",
"print('\\n')\n",
"print(np.tril(a))\n",
"print('\\n')\n",
"print(np.tril(a,-1).T)\n",
"print('\\n')\n",
"print(np.tril(a)+np.tril(a,-1).T)"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"## Illustration of unfolding using staircase function\n",
"N = 50\n",
"a = np.random.normal(size=(N,N))\n",
"M = np.tril(a) + np.tril(a,-1).T\n",
"evals = linalg.eigvalsh(M)\n",
"\n",
"Nsmooth = np.poly1d(np.polyfit(x=evals, y = range(len(evals)), deg=5))\n",
"\n",
"plt.figure()\n",
"plt.step(evals,range(len(evals)), '.-', label='$N(E_i)$', where = 'mid')\n",
"plt.plot(evals,Nsmooth(evals), 'r-', label='$N_{sm}(E_i)$')\n",
"plt.xlabel(r'$E$')\n",
"plt.ylabel(r'$N(E)$')\n",
"plt.legend(loc=2)\n",
"_=plt.ylim(-1, N)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"## Obtain spectra -- takes a few minutes to run\n",
"\n",
"niter = 100 # number of disorder iterations\n",
"N = 1000 #size of random matrix\n",
"deltalist = np.zeros((niter, N-1))\n",
"deltalist_unfold = np.zeros((niter, N-1))\n",
"rlist = np.zeros((niter, N-2))\n",
"\n",
"for n in range(niter):\n",
" \n",
" #construct matrix\n",
" a = np.random.normal(size=(N,N))\n",
" M = np.tril(a) + np.tril(a,-1).T\n",
" evals = linalg.eigvalsh(M)\n",
" \n",
" # get the unfolded spectrum\n",
" Nsmooth = np.poly1d(np.polyfit(x=evals, y = range(N), deg=5))\n",
" evalssmooth = Nsmooth(evals)\n",
"\n",
" # get the level spacings (naively normalized, staircase unfolded, r-ratio)\n",
" deltalist[n] = evals[1:]-evals[0:-1]\n",
" deltalist[n] = deltalist[n]/np.mean(deltalist[n]) # Naive\n",
" deltalist_unfold[n] = evalssmooth[1:]-evalssmooth[0:-1] # Staircase\n",
" _, rlist[n],_ = LevelStatistics(evals) #r-ratio"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"# obtain probability distributions for the three level-spacing measures\n",
"nbins = 70\n",
"bslist = np.zeros((3,niter, nbins+1)) \n",
"hslist = np.zeros((3,niter, nbins))\n",
"\n",
"for n in range(niter):\n",
" hslist[0,n],bslist[0,n], = np.histogram(deltalist[n], bins=nbins, range=(0,4), normed=True)\n",
" hslist[1,n],bslist[1,n], = np.histogram(deltalist_unfold, bins=nbins, range=(0,4), normed=True)\n",
" hslist[2,n],bslist[2,n], = np.histogram(rlist[n], bins=nbins, range = (0,1), normed=True)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"_=plt.figure()\n",
"_=plt.hist(evals, bins=100, normed=True)\n",
"_=plt.xlabel(r'$E$')\n",
"_=plt.ylabel(r'$P(E)$')\n",
"_=plt.title(r'Density of states for a $NxN$ Gaussian random matrix')\n",
"\n",
"_=plt.figure()\n",
"x = np.linspace(0, 4,100)\n",
"GOE = 0.5*np.pi*x*np.exp(-0.25*np.pi*x*x) ### Wigner surmise\n",
"bslistmean =np.mean(bslist,1) \n",
"hslistmean =np.mean(hslist,1)\n",
"_=plt.plot(0.5*(bslistmean[0,1:]+bslistmean[0,0:-1]),hslistmean[0], 'go-',lw=2,label = 'Naive normalization')\n",
"_=plt.plot(0.5*(bslistmean[1,1:]+bslistmean[1,0:-1]),hslistmean[1], 'bo-',lw=2,label = 'Staircase unfolding')\n",
"_=plt.plot(x,GOE, 'r', lw=2, label='Wigner GOE surmise')\n",
"_=plt.xlabel(r'$s$')\n",
"_=plt.ylabel(r'$P(s)$')\n",
"_=plt.title('Level spacings distribution for NxN Gaussian random matrices' )\n",
"_=plt.xlim([0,4])\n",
"_=plt.legend()\n",
"\n",
"\n",
"_=plt.figure()\n",
"_=plt.plot(0.5*(bslistmean[2,1:]+bslistmean[2,0:-1]),hslistmean[2], 'o-',lw=2,label = 'r-ratio')\n",
"xarr=np.linspace(0,1,100)\n",
"Poi = 2/(1+xarr)**2\n",
"GOE = (27/4.)*(xarr+xarr**2)/(1+xarr+xarr**2)**(5/2.)\n",
"_=plt.xlabel(r'$r$')\n",
"_=plt.ylabel(r'$P(r)$')\n",
"_=plt.plot(xarr, GOE, 'r', lw=2,label='GOE')\n",
"_=plt.legend()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the density of states has the famous \"semicircle distribution\" for random matrices. \n",
"\n",
"While the level spacing distribution for the \"naive\" normalization shows the same qualitative features as the Wigner surmise (level repulsion etc.), there are quantitative deviations due to the poor normalization procedure which doesn't take into account variations in the density of states. On the other hand, the spacing distribution for the properly unfolded spectrum using the \"staircase\" unfolding procedure agrees almost exactly with the Wigner surmise. Finally, the r-ratio distribution which obviates the need for unfolding again agrees well with its prediced form. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Level Statistics across the MBL Transition#\n",
"\n",
"We now switch to studying the r-ratio across the MBL transition.\n",
"\n",
"## Pal Huse Model##\n",
"\n",
"$H = \\sum_i S_i^x S_{i+1}^x + S_i^y S_{i+1}^y + S_i^z S_{i+1}^z + h_i S_i^z$\n",
"\n",
"$S_i^x = \\frac{1}{2}\\sigma_i^x$ are spin 1/2 operators on site $i$. \n",
"\n",
"The fields $h_i$ are drawn uniformly from a random distribution of width $W$. \n",
"This model has a transition from a thermalizing phase to an MBL phase at W~4.\n"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"L=2\n",
"W = 10.0\n",
"\n",
"s0, x,y,z = gen_s0sxsysz(L)\n",
"Hint = 0.25*(gen_nn_int(x) + gen_nn_int(y) + gen_nn_int(z)) #0.25 is for the conversion from Pauli's to spin 1/2s.\n",
"\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Do a basic sanity check that the Hamiltonian you've constructed looks right on a small system"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"np.round(np.real(H.toarray()),2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Diagonalize the Hamiltonian and look at the spectrum"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"L=10\n",
"W = 10.0\n",
"\n",
"s0, x,y,z = gen_s0sxsysz(L)\n",
"Hint = 0.25*(gen_nn_int(x) + gen_nn_int(y) + gen_nn_int(z)) #0.25 is for the conversion from Pauli's to spin 1/2s.\n",
"\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)\n",
"\n",
"evals, evecs = linalg.eigh(np.real(H.toarray()))"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"plt.figure()\n",
"_=plt.plot(evals)\n",
"_=plt.ylabel(r'$E_\\n$')\n",
"_=plt.xlabel(r'$n$')\n",
"plt.figure()\n",
"_=plt.hist(evals, bins=20)\n",
"_=plt.ylabel(r'$P(E)$')\n",
"_=plt.xlabel(r'$E$')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that for this sparse local Hamiltonian with only two-body interactions, the density of states looks like a Gaussian instead of a semicircle. Thus, while RMT predicts many features of the spectrum (like level spacing distribution), there are differnces. "
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"# Look at the r-ratio distribution in the MBL phase. This should look Poisson\n",
"\n",
"W = 10.0\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)\n",
"evals, evecs = linalg.eigh(np.real(H.toarray()))\n",
"\n",
"\n",
"delta,rlist,r = LevelStatistics(evals)\n",
"_=plt.figure()\n",
"_=plt.hist(rlist, normed=True, bins=50)\n",
"plt.xlabel('$r$')\n",
"plt.ylabel('$P(r)$')\n",
"plt.title('W=%.1f'%W)\n",
"xarr=np.linspace(0,1,100)\n",
"Poi = 2/(1+xarr)**2\n",
"GOE = (27/4.)*(xarr+xarr**2)/(1+xarr+xarr**2)**(5/2.)\n",
"_=plt.plot(xarr,Poi, 'r', lw='3', label='Poisson')\n",
"_=plt.plot(xarr,GOE, 'y', lw='3', label='GOE')\n",
"_=plt.legend()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"# Now look at the r-ratio distribution for a W in the thermalizing phase. This should look GOE\n",
"\n",
"\n",
"W = 1.0\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)\n",
"evals, evecs = linalg.eigh(np.real(H.toarray()))\n",
"\n",
"delta,rlist,r = LevelStatistics(evals)\n",
"_=plt.figure()\n",
"_=plt.hist(rlist, normed=True, bins=50)\n",
"plt.xlabel('$r$')\n",
"plt.ylabel('$P(r)$')\n",
"plt.title('W=%.1f'%W)\n",
"xarr=np.linspace(0,1,100)\n",
"Poi = 2/(1+xarr)**2\n",
"GOE = (27/4.)*(xarr+xarr**2)/(1+xarr+xarr**2)**(5/2.)\n",
"_=plt.plot(xarr,Poi, 'r', lw='3', label='Poisson')\n",
"_=plt.plot(xarr,GOE, 'y', lw='3', label='GOE')\n",
"_=plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"What's going on?! Why do the distributions look Poisson in both case? The system conserves $S^z_{tot}$ and the level statistics must be computed in a single symmetry sector! Otherwise the lack of level repulsion between difference sectors of $S^z_{tot}$ gives Poisson distributions. "
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"L=10\n",
"s0, x,y,z = gen_s0sxsysz(L)\n",
"sztot = gen_op_total(z)\n",
"val=0\n",
"P = gen_diagprojector(sztot.diagonal(), val) ## Projects onto the sector with Sztot = 0\n",
"print(P.shape)\n",
"print(P.toarray())"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"W = 1.0\n",
"Hint = 0.25*(gen_nn_int(x) + gen_nn_int(y) + gen_nn_int(z)) #0.25 is for the conversion from Pauli's to spin 1/2s.\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)\n",
"evals, evecs = linalg.eigh(np.real((P*H*(P.T)).toarray()))\n",
"\n",
"delta,rlist,r = LevelStatistics(evals)\n",
"_=plt.figure()\n",
"_=plt.hist(rlist, normed=True, bins=50)\n",
"plt.xlabel('$r$')\n",
"plt.ylabel('$P(r)$')\n",
"plt.title('W=%.1f'%W)\n",
"xarr=np.linspace(0,1,100)\n",
"Poi = 2/(1+xarr)**2\n",
"GOE = (27/4.)*(xarr+xarr**2)/(1+xarr+xarr**2)**(5/2.)\n",
"_=plt.plot(xarr,Poi, 'r', lw='3', label='Poisson')\n",
"_=plt.plot(xarr,GOE, 'y', lw='3', label='GOE')\n",
"_=plt.legend()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Great! Taking the symmetry into account makes the distribution look GOE as expected. Notice the level repulsion since the distribution goes to zero as $r \\rightarrow 0$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To see a crossover from the MBL phase to the thermalizing phase, it's often convenient to use a single number characterizing these distributions instead of looking at the full distributions. Note that $\\langle r \\rangle = 0.53$ in for the GOE distribution, and $\\langle r \\rangle = 0.39$ for the Poisson distribution. This is a single dimensionless number, so we should see $\\langle r \\rangle approach 0.53/0.39 with increasing system size in the thermal/MBL phases respectively. The location of the crossing in the curves for different system sizes thus serves as an estimate of the transition. See Figure 3 in Pal and Huse 2010 (https://arxiv.org/pdf/1010.1992.pdf). "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exercises #\n",
"\n",
"1. Make a plot of $\\langle r\\rangle$ vs. $W$ to see the crossover in level statistics at the MBL transition\n",
"2. Can you do this at a few different system sizes to see the crossover sharpening? (don't go beyond L=10 to avoid over-burdening the cluster)\n",
"3. Can you disorder average over a few separate realizations and make the curves smoother? \n",
"\n",
"4. What's happenening near W=0? Can you think of a way to \"fix\" this? \n"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [],
"source": [
"## Takes several minutes\n",
"Llist = [8,10]\n",
"Wnum=20\n",
"niter = 100\n",
"Wlist = np.linspace(0.1, 8, Wnum)\n",
"ravglist = np.zeros((len(Llist),niter,Wnum))\n",
"\n",
"for l in range(len(Llist)):\n",
" L=Llist[l]\n",
" s0, x,y,z = gen_s0sxsysz(L)\n",
" sztot = gen_op_total(z)\n",
" val=0\n",
" P = gen_diagprojector(sztot.diagonal(), val)\n",
" Hint = 0.25*(gen_nn_int(x) + gen_nn_int(y) + gen_nn_int(z)) #0.25 is for the conversion from Pauli's to spin 1/2s.\n",
" dim = P.shape[0]\n",
" for n in range(niter):\n",
" for w in range(len(Wlist)):\n",
" W= Wlist[w]\n",
" hlist = np.random.uniform(-W/2.0, W/2.0, L)\n",
" H = Hint + gen_onsite_field(hlist, z) \n",
" evals = linalg.eigvalsh(np.real((P*H*(P.T)).toarray()))\n",
" _, _, ravglist[l,n,w] = LevelStatistics(evals[int(dim/3):int(2*dim/3)]) #Use only middle third of spectrum"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
"plt.figure()\n",
"for l in range(len(Llist)):\n",
" plt.plot(Wlist, np.mean(ravglist[l],0), label = r'$L=%d$'%Llist[l])\n",
"_=plt.axhline(y=0.39, color='m', label=r'Poisson')\n",
"_=plt.axhline(y=0.53, color='c', label=r'GOE')\n",
"plt.legend()\n",
"_=plt.xlabel(r'$W$')\n",
"_=plt.ylabel(r'$\\langle r \\rangle$')\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The data is too noisy and the system sizes too small to see a clear sharpening of the transition, but we do see the curves crossing near W~2. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Matrix Elements and ETH##\n",
"\n",
"In the MBL phase, expectation values of local observables evaluated in eigenstates fluctuate wildly from eigenstate to eigenstate at the same energy density, while these vary smoothly with energy in the thermal phase.\n"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"L=12\n",
"s0, x,y,z = gen_s0sxsysz(L)\n",
"sztot = gen_op_total(z)\n",
"val=0\n",
"P = gen_diagprojector(sztot.diagonal(), val)\n",
"Hint = 0.25*(gen_nn_int(x) + gen_nn_int(y) + gen_nn_int(z)) #0.25 is for the conversion from Pauli's to spin 1/2s.\n",
"\n",
"\n",
"W = 10.0\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)\n",
"evals, evecs = linalg.eigh(np.real((P*H*(P.T)).toarray()))\n",
"zop = P*z[int(L/2)]*(P.T)\n",
"ZME_MBL = gen_diagonal_ME(zop.toarray(), evecs)\n",
"\n",
"W = 1.0\n",
"hlist = np.random.uniform(-W/2.0, W/2.0, L) #The factor of two is for the conversion from Pauli's to spin 1/2s.\n",
"H = Hint + gen_onsite_field(hlist, z)\n",
"evals, evecs = linalg.eigh(np.real((P*H*(P.T)).toarray()))\n",
"zop = P*z[int(L/2)]*(P.T)\n",
"ZME_th = gen_diagonal_ME(zop.toarray(), evecs)\n",
"\n",
"\n",
"_=plt.figure()\n",
"_=plt.plot(evals, ZME_MBL, 'o', label = 'W=10 (MBL)')\n",
"_=plt.plot(evals, ZME_th, 'o', label = 'W=1 (Thermal)')\n",
"_=plt.legend(loc=3)\n",
"_=plt.ylabel(r'$\\langle n|Z| n\\rangle$')\n",
"_=plt.xlabel(r'$E_n$')\n",
"_=plt.ylim(-1.1, 1.1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Exercise #\n",
"How do we extend these calculations to do real-time dynamics? Can you see the decay in Imbalance starting from certain initial states (like |10101010>) as in the cold-atom experiments? \n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}