def __init__(self, f1, f2): self.f_qubit1 = f1 self.f_qubit2 = f2 # define hamiltonian for two qubits (zeeman on qubit 1, zeeman on qubit 2, exchange between qubits) -- convert from qutip to numpy (brackets) self.B1 = qt.tensor(qt.sigmaz() / 2, qt.qeye(2))[:, :] self.B2 = qt.tensor(qt.qeye(2), qt.sigmaz() / 2)[:, :] self.J = (qt.tensor(qt.sigmax(), qt.sigmax()) + qt.tensor(qt.sigmay(), qt.sigmay()) + qt.tensor(qt.sigmaz(), qt.sigmaz()))[:, :] / 4 self.my_Hamiltonian = 2 * np.pi * (f1 * self.B1 + f2 * self.B2) # Create the solver self.solver_obj = ME.VonNeumann(4) # Add the init hamiltonian self.solver_obj.add_H0(self.my_Hamiltonian)
def __init__(self, f1, f2): self.f_qubit1 = f1 self.f_qubit2 = f2 self.H_mw_qubit_1 = np.array(list(basis(4,0)*basis(4,2).dag() + basis(4,1)*basis(4,3).dag()))[:,0] self.H_mw_qubit_2 = np.array(list(basis(4,0)*basis(4,1).dag() + basis(4,2)*basis(4,3).dag()))[:,0] # define hamiltonian for two qubits (zeeman on qubit 1, zeeman on qubit 2, exchange between qubits) -- convert from qutip to numpy (brackets) self.B1 = qt.tensor(qt.sigmaz()/2, qt.qeye(2))[:,:] self.B2 = qt.tensor(qt.qeye(2), qt.sigmaz()/2)[:,:] # transformed into rotating frame, so energy is 0 self.my_Hamiltonian = 0*self.B1 # Create the solver self.solver_obj = ME.VonNeumann(4) # Add the init hamiltonian self.solver_obj.add_H0(self.my_Hamiltonian)
X, noise_ampl**2 ) # produces the same results of a white noise, but takes as second input the noise variance instead of the amplitude (var = ampl^2) lindmid = time.time() s.calculate_evolution(Z0, 0, total_t, evo_steps) lindend = time.time() s.plot_expectation(*pop, 1) # VonNeumann calculation and plotting vnstart = time.time() v = me.VonNeumann(2) v.add_H0(Z) white = me.noise_py() white.init_white(X, noise_ampl) v.add_noise_obj(white) v.set_number_of_evalutions(vn_samples) vnmid = time.time() v.calculate_evolution(Z0, 0, total_t, evo_steps) vnend = time.time() v.plot_expectation(*pop, 2) print('\n Measuring the time of the script:')
def __init__(self, B_1, B_2, chargingE1, chargingE2, tunnel_coupling): # Generate static part of hamiltonian (using numpy/qutip stuff) # All energy's should be expressed in Hz # H_bar = 1 self.H_charg1 = np.array(list(qt.basis(6, 4) * qt.basis(6, 4).dag()))[:, 0] self.H_charg2 = np.array(list(qt.basis(6, 5) * qt.basis(6, 5).dag()))[:, 0] self.H_B_field1 = np.array( list(-qt.basis(6, 0) * qt.basis(6, 0).dag() - qt.basis(6, 1) * qt.basis(6, 1).dag() + qt.basis(6, 2) * qt.basis(6, 2).dag() + qt.basis(6, 3) * qt.basis(6, 3).dag()))[:, 0] / 2 self.H_B_field2 = np.array( list(-qt.basis(6, 0) * qt.basis(6, 0).dag() + qt.basis(6, 1) * qt.basis(6, 1).dag() - qt.basis(6, 2) * qt.basis(6, 2).dag() + qt.basis(6, 3) * qt.basis(6, 3).dag()))[:, 0] / 2 self.H_exchange = np.array( list(-qt.basis(6, 1) * qt.basis(6, 1).dag() - qt.basis(6, 2) * qt.basis(6, 2).dag() + qt.basis(6, 1) * qt.basis(6, 2).dag() + qt.basis(6, 2) * qt.basis(6, 1).dag()))[:, 0] / 2 self.H_tunnel = np.array( list( qt.basis(6, 1) * qt.basis(6, 4).dag() - qt.basis(6, 2) * qt.basis(6, 4).dag() + qt.basis(6, 1) * qt.basis(6, 5).dag() - qt.basis(6, 2) * qt.basis(6, 5).dag() + qt.basis(6, 4) * qt.basis(6, 1).dag() - qt.basis(6, 4) * qt.basis(6, 2).dag() + qt.basis(6, 5) * qt.basis(6, 1).dag() - qt.basis(6, 5) * qt.basis(6, 2).dag()))[:, 0] self.B_1 = B_1 self.B_2 = B_2 self.chargingE1 = chargingE1 self.chargingE2 = chargingE2 self.tunnel_coupling = tunnel_coupling self.my_Hamiltonian = 2 * np.pi * (self.H_charg1 * chargingE1 + self.H_charg2 * chargingE2 + self.H_tunnel * tunnel_coupling) self.h_raw = self.my_Hamiltonian / 2 / np.pi + self.H_B_field1 * B_1 + self.H_B_field2 * B_2 # Clock of rotating frame self.f_qubit1 = B_1 self.f_qubit2 = B_2 # Init params self.amp_noise_1 = 0 self.amp_noise_2 = 0 self.number_of_samples = 1 self.one_f_noise = 0 # Create the solver self.solver_obj = ME.VonNeumann(6) # Add the init hamiltonian self.solver_obj.add_H0(self.my_Hamiltonian) if self.f_qubit1 - self.f_qubit2 != 0: # add time dependent tunnelcouplings (see presentation) locations_1 = np.array([[1, 4], [1, 5]], dtype=np.int32) self.solver_obj.add_cexp_time_dep( locations_1, (self.f_qubit1 - self.f_qubit2) / 2) locations_1 = np.array([[2, 4], [2, 5]], dtype=np.int32) self.solver_obj.add_cexp_time_dep( locations_1, (self.f_qubit2 - self.f_qubit1) / 2)