def apply_dephasing(number_of_spins, alpha, B): ''' takes number of spins, alpha, and the magnetic field and returns the FM hamiltonian along with its ground state and the dephased ground state ''' calc = ising_calculator_FM(number_of_spins, alpha, B) H = calc.get_H() energy,groundstate = H.groundstate() dm_groundstate = ket2dm(groundstate) dephased = do_dephasing_dm(dm_groundstate, number_of_spins) return H, dm_groundstate, dephased
def calculate_and_save(): quant = state_quantifier(number_of_spins) ground_states = [] for i,B in enumerate(B_list): print i calc = ising_calculator_FM(number_of_spins, alpha, B) H = calc.get_H() energy,groundstate = H.groundstate() ground_states.append(groundstate) sx,sy,sz = quant.get_reduced_dms(ground_states, spin = 0) np.save('magnetization_array_one_spin_{}'.format(number_of_spins), (B_list,sx,sy,sz))
def calculate_and_save(): magnetization_array = np.empty_like(B_list) quant = state_quantifier(number_of_spins) for i,B in enumerate(B_list): print i calc = ising_calculator_FM(number_of_spins, alpha, B) H = calc.get_H() energy,groundstate = H.groundstate() m = quant.absolute_magnetization_x(groundstate) magnetization_array[i] = m np.save('magnetization_array_{}'.format(number_of_spins), magnetization_array)
def calculate_and_save(): quant = state_quantifier(number_of_spins) ground_states = [] for i, B in enumerate(B_list): print i calc = ising_calculator_FM(number_of_spins, alpha, B) H = calc.get_H() energy, groundstate = H.groundstate() ground_states.append(groundstate) sx, sy, sz = quant.get_reduced_dms(ground_states, spin=0) np.save('magnetization_array_one_spin_{}'.format(number_of_spins), (B_list, sx, sy, sz))
def apply_dephasing(number_of_spins, alpha, B,fm_str = 'AFM',kT = 0.0): ''' takes number of spins, alpha, and the magnetic field and returns the hamiltonian along with its ground state and the dephased ground state choose fm_str = 'FM' for ferromagnetic interaction, and 'AFM' for anti-ferromagnetic ''' if fm_str == 'FM': calc = ising_calculator_FM(number_of_spins, alpha, B) elif fm_str == 'AFM': calc = ising_calculator_AFM(number_of_spins, alpha, B) H = calc.get_H() if kT == 0.0: energy,groundstate = H.groundstate() dm_groundstate = ket2dm(groundstate) else: Hdata = H.data.todense() arr_mp = mp.matrix(-Hdata /kT) exp_mp = mp.expm(arr_mp) trace = np.array(exp_mp.tolist()).trace() normalized_mp = exp_mp / trace normalized_np = np.array(normalized_mp.tolist(), dtype = np.complex) dm_groundstate = Qobj(normalized_np, dims = 2 * [number_of_spins*[2]]) dephased = do_dephasing_dm(dm_groundstate, number_of_spins) return H, dm_groundstate, dephased
#constructing a list of operators sx_list and sy_list where #the operator sx_list[i] applies sigma_x on the ith particle and #identity to the rest sx_list = [] sy_list = [] for n in range(N): op_list = [] for m in range(N): op_list.append(si) op_list[n] = sx sx_list.append(tensor(op_list)) op_list[n] = sy sy_list.append(tensor(op_list)) calc = ising_calculator_FM(number_of_spins, alpha, B) H = calc.get_H() # energy,state = H.groundstate() # print 'groundstate energy', energy # print 'groundstate expectation', expect(sx_list[0], state) # print 'groundstate expectation', expect(sx_list[1], state) # print 'groundstate expectation', expect(sx_list[2], state) # print state[0:10] # print state.dag() * H * state # print expect(H, state) # print state[0:10] # print state.norm() # print expect(sx_list[3] , state) energies, states = H.eigenstates() print energies[0:2]