J = 1.0 # spin interaction g = 0.809 # transverse field h = 0.9045 # parallel field Omega = 4.5 # drive frequency # ##### set up alternating Hamiltonians ##### # define time-reversal symmetric periodic step drive def drive(t, Omega): return np.sign(np.cos(Omega * t)) drive_args = [Omega] # compute basis in the 0-total momentum and +1-parity sector basis = spin_basis_1d(L=L, a=1, kblock=0, pblock=1) # define PBC site-coupling lists for operators x_field_pos = [[+g, i] for i in range(L)] x_field_neg = [[-g, i] for i in range(L)] z_field = [[h, i] for i in range(L)] J_nn = [[J, i, (i + 1) % L] for i in range(L)] # PBC # static and dynamic lists static = [["zz", J_nn], ["z", z_field], ["x", x_field_pos]] dynamic = [["zz", J_nn, drive, drive_args], ["z", z_field, drive, drive_args], ["x", x_field_neg, drive, drive_args]] # compute Hamiltonians H = 0.5 * hamiltonian(static, dynamic, dtype=np.float64, basis=basis) # ##### set up second-order van Vleck Floquet Hamiltonian ##### # zeroth-order term Heff_0 = 0.5 * hamiltonian(static, [], dtype=np.float64, basis=basis)
##### set up semi-classical Hamiltonian ##### # define operators dipole_op = [[A, 0]] # define periodic drive and its parameters def drive(t, Omega): return np.cos(Omega * t) drive_args = [Omega] # define semi-classical static and dynamic lists static_sc = [["z", at_energy]] dynamic_sc = [["x", dipole_op, drive, drive_args]] # compute semi-classical basis basis_sc = spin_basis_1d(L=1) # compute semi-classical Hamiltonian H_{sc}(t) H_sc = hamiltonian(static_sc, dynamic_sc, dtype=np.float64, basis=basis_sc) # ##### define initial state ##### # define atom ground state psi_at_i = np.array([1.0, 0.0]) # spin-down eigenstate of \sigma^z # define photon coherent state with mean photon number Nph psi_ph_i = coherent_state(np.sqrt(Nph), Nph_tot + 1) # compute atom-photon initial state as a tensor product psi_i = np.kron(psi_at_i, psi_ph_i) # ##### calculate time evolution ##### # define time vector over 30 driving cycles with 100 points per period t = Floquet_t_vec(Omega, 30) # t.i = initial time, t.T = driving period # evolve atom-photon state with Hamiltonian H
##### define model parameters ##### L=10 # system size Jxy=1.0 # xy interaction Jzz_0=1.0 # zz interaction at time t=0 h_MBL=3.9 # MBL disorder strength h_ETH=0.1 # delocalised disorder strength vs=np.logspace(-2.0,0.0,num=20,base=10) # log_2-spaced vector of ramp speeds # ##### set up Heisenberg Hamiltonian with linearly varying zz-interaction ##### # define linear ramp function v = 1.0 # declare ramp speed variable def ramp(t): return (0.5 + v*t) ramp_args=[] # compute basis in the 0-total magnetisation sector (requires L even) basis = spin_basis_1d(L,Nup=L/2,pauli=False) # define operators with OBC using site-coupling lists J_zz = [[Jzz_0,i,i+1] for i in range(L-1)] # OBC J_xy = [[Jxy/2.0,i,i+1] for i in range(L-1)] # OBC # static and dynamic lists static = [["+-",J_xy],["-+",J_xy]] dynamic =[["zz",J_zz,ramp,ramp_args]] # compute the time-dependent Heisenberg Hamiltonian H_XXZ = hamiltonian(static,dynamic,basis=basis,dtype=np.float64) # ##### calculate diagonal and entanglement entropies ##### def realization(vs,H_XXZ,basis,real): """ This function computes the entropies for a single disorder realisation. --- arguments --- vs: vector of ramp speeds
from qspin.operators import hamiltonian # Hamiltonians and operators from qspin.basis import spin_basis_1d # Hilbert space spin basis import numpy as np # generic math functions # ##### define model parameters ##### L = 12 # system size Jxy = np.sqrt(2.0) # xy interaction Jzz_0 = 1.0 # zz interaction hz = 1.0 / np.sqrt(3.0) # z external field # ##### set up Heisenberg Hamiltonian in an enternal z-field ##### # compute spin-1/2 basis basis = spin_basis_1d(L, pauli=False) basis = spin_basis_1d(L, pauli=False, Nup=L / 2) # zero magnetisation sector basis = spin_basis_1d(L, pauli=False, Nup=L / 2, pblock=1) # and positive parity sector # define operators with OBC using site-coupling lists J_zz = [[Jzz_0, i, i + 1] for i in range(L - 1)] # OBC J_xy = [[Jxy / 2.0, i, i + 1] for i in range(L - 1)] # OBC h_z = [[hz, i] for i in range(L - 1)] # static and dynamic lists static = [["+-", J_xy], ["-+", J_xy], ["zz", J_zz]] dynamic = [] # compute the time-dependent Heisenberg Hamiltonian H_XXZ = hamiltonian(static, dynamic, basis=basis, dtype=np.float64) # ##### various exact diagonalisation routines ##### # calculate entire spectrum only E = H_XXZ.eigvalsh() # calculate full eigensystem E, V = H_XXZ.eigh()