def integrate(self, type='NLS'): r = ode(getattr(self, '_func_' + type)) opt = Odeoptions() opt.atol = 1e-12 opt.rtol = 1e-10 opt.max_step = self.dz r.set_integrator('zvode', method=opt.method, order=opt.order, atol=opt.atol, rtol=opt.rtol, nsteps=opt.nsteps, first_step=opt.first_step, min_step=opt.min_step, max_step=opt.max_step) r.set_initial_value(self.a0, 0) self.Y = [r.y] for i in trange(1, len(self.z)): self.Y.append(r.integrate(self.z[i])) self.Y = np.array(self.Y)
def integrate(self): r = ode(self.__func_LS_cyc) opt = Odeoptions() opt.atol = 1e-10 opt.rtol = 1e-8 opt.max_step = .005 r.set_integrator('zvode', method=opt.method, order=opt.order, atol=opt.atol, rtol=opt.rtol, nsteps=opt.nsteps, first_step=opt.first_step, min_step=opt.min_step, max_step=opt.max_step) r.set_initial_value(self.a0, 0) self.Y = [r.y] for i in trange(1, len(self.z)): self.Y.append(r.integrate(self.z[i])) self.Y = np.array(self.Y)
def __init__(self, number_spins, alpha, B_field, opts=Odeoptions()): self.opts = opts calc = ising_calculator_FM(number_spins, alpha) H0, Ht = calc.get_H() #time dependent hamiltonian with exponential ramping of Ht # self.H = [H0, [Ht, 'Bstop + (Bstart - Bstop) * exp(-t / ramp_time)']] self.H = H0 + Ht * B_field
from qutip import mesolve, Qobj, tensor, qsave, qload, Odeoptions, qeye, sigmax, sigmay, sigmaz, expect, ket2dm, basis from integrator import time_dependent_simulator import numpy as np from matplotlib import pyplot number_spins = 2 alpha = 1. Bstart = 50.0 #units of J0 Bstop = 0.01 #units of J0 ramp_time = 1. #units of 1/J0 t_list = np.linspace(0, 12 * ramp_time, 2000) #set up integrator options opts = Odeoptions() opts.nsteps = 10000000 def all_spins_up_y(): up_y = Qobj([[1], [1.j]]).unit() state = tensor([up_y] * number_spins) return state def plot_magnetization(states, b_fields): from scripts.theory.time_independent.state_quantifier import state_quantifier quant = state_quantifier(number_spins) ms = [quant.absolute_magnetization_x(state) for state in states] pyplot.xscale('log') pyplot.plot(b_fields, ms) pyplot.ylim([-0.05, 1.05]) pyplot.xlim([0.05, 50.05])
from qutip import mesolve, Qobj, tensor, qsave, qload, Odeoptions, qeye, sigmax, sigmay, sigmaz, expect, ket2dm, basis from integrator import time_dependent_simulator import numpy as np from matplotlib import pyplot number_spins = 2 alpha = 1. Bstart = 50.0 #units of J0 Bstop = 0.01 #units of J0 ramp_time = 1. #units of 1/J0 t_list = np.linspace(0, 12 * ramp_time , 2000) #set up integrator options opts = Odeoptions() opts.nsteps = 10000000 def all_spins_up_y(): up_y = Qobj([[1],[1.j]]).unit() state = tensor([up_y] * number_spins) return state def plot_magnetization(states, b_fields): from scripts.theory.time_independent.state_quantifier import state_quantifier quant = state_quantifier(number_spins) ms = [quant.absolute_magnetization_x(state) for state in states] pyplot.xscale('log') pyplot.plot(b_fields, ms) pyplot.ylim([-0.05,1.05]) pyplot.xlim([0.05, 50.05]) pyplot.xlabel('B/J0') pyplot.ylabel('Magnetization')