def calculate_and_save():
    energies = np.empty((B_list.size, 2**number_of_spins))
    for i,B in enumerate(B_list):
        print i
        calc = ising_calculator_AFM(number_of_spins, alpha, B)
        energies[i,:] = calc.find_energies()
    np.save('energy_array', energies)
Exemple #2
0
def calculate_and_save():
    energies = np.empty((B_list.size, 2**number_of_spins))
    for i, B in enumerate(B_list):
        print i
        calc = ising_calculator_AFM(number_of_spins, alpha, B)
        energies[i, :] = calc.find_energies()
    np.save('energy_array', energies)
Exemple #3
0
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