def hamiltonian_use_addhc(self): res1 = qubit.Oscillator( E_osc=6.0, truncated_dim=4 # up to 3 photons (0,1,2,3) ) res2 = qubit.Oscillator( E_osc=5.5, truncated_dim=7 ) # Form a list of all components making up the Hilbert space. hilbertspace = HilbertSpace([res1, res2]) g1 = 0.29 interaction1 = InteractionTerm( g_strength=g1, op1=res1.annihilation_operator(), subsys1=res1, op2=res2.creation_operator(), subsys2=res2, add_hc=True ) interaction_list = [interaction1] hilbertspace.interaction_list = interaction_list return hilbertspace.hamiltonian()
def hilbertspace_initialize2(): CPB1 = scq.Transmon(EJ=40.0, EC=0.2, ng=0.0, ncut=40, truncated_dim=3) CPB2 = scq.Transmon(EJ=3.0, EC=1.0, ng=0.0, ncut=10, truncated_dim=4) resonator = scq.Oscillator(E_osc=6.0, truncated_dim=4) # up to 3 photons (0,1,2,3) # Form a list of all components making up the Hilbert space. hilbertspace = HilbertSpace([CPB1, CPB2, resonator]) g1 = 0.1 # coupling resonator-CPB1 (without charge matrix elements) g2 = 0.2 # coupling resonator-CPB2 (without charge matrix elements) hilbertspace.add_interaction( g=g1, op1=CPB1.n_operator, op2=resonator.creation_operator, add_hc=True ) hilbertspace.add_interaction( g=g2, op1=(CPB2.n_operator(), CPB2), op2=( resonator.creation_operator() + resonator.annihilation_operator(), resonator, ), ) return hilbertspace
def hamiltonian_use_addhc(self): res1 = scq.Oscillator(E_osc=6.0, truncated_dim=4) res2 = scq.Oscillator(E_osc=5.5, truncated_dim=7) # Form a list of all components making up the Hilbert space. hilbertspace = HilbertSpace([res1, res2]) g1 = 0.29 hilbertspace.add_interaction( g=g1, op1=res1.annihilation_operator, op2=res2.creation_operator, add_hc=True, ) return hilbertspace.hamiltonian()
def test_explorer(): qbt = qubit.Fluxonium( EJ=2.55, EC=0.72, EL=0.12, flux=0.0, cutoff=110, truncated_dim=9 ) osc = qubit.Oscillator( E_osc=4.0, truncated_dim=5 ) hilbertspace = qubit.HilbertSpace([qbt, osc]) interaction = InteractionTerm( g_strength=0.2, op1=qbt.n_operator(), subsys1=qbt, op2=osc.creation_operator() + osc.annihilation_operator(), subsys2=osc ) interaction_list = [interaction] hilbertspace.interaction_list = interaction_list param_name = r'$\Phi_{ext}/\Phi_0$' param_vals = np.linspace(-0.5, 0.5, 100) subsys_update_list = [qbt] def update_hilbertspace(param_val): qbt.flux = param_val sweep = ParameterSweep( param_name=param_name, param_vals=param_vals, evals_count=10, hilbertspace=hilbertspace, subsys_update_list=subsys_update_list, update_hilbertspace=update_hilbertspace, ) swp.generate_chi_sweep(sweep) swp.generate_charge_matrixelem_sweep(sweep) explorer = Explorer( sweep=sweep, evals_count=10 ) explorer.interact()
def hilbertspace_initialize(): CPB1 = qubit.Transmon( EJ=40.0, EC=0.2, ng=0.0, ncut=40, truncated_dim=3 # after diagonalization, we will keep 3 levels ) CPB2 = qubit.Transmon( EJ=3.0, EC=1.0, ng=0.0, ncut=10, truncated_dim=4 ) resonator = qubit.Oscillator( E_osc=6.0, truncated_dim=4 # up to 3 photons (0,1,2,3) ) # Form a list of all components making up the Hilbert space. hilbertspace = HilbertSpace([CPB1, CPB2, resonator]) g1 = 0.1 # coupling resonator-CPB1 (without charge matrix elements) g2 = 0.2 # coupling resonator-CPB2 (without charge matrix elements) interaction1 = InteractionTerm( g_strength=g1, op1=CPB1.n_operator(), subsys1=CPB1, op2=resonator.creation_operator() + resonator.annihilation_operator(), subsys2=resonator ) interaction2 = InteractionTerm( g_strength=g2, op1=CPB2.n_operator(), subsys1=CPB2, op2=resonator.creation_operator() + resonator.annihilation_operator(), subsys2=resonator ) interaction_list = [interaction1, interaction2] hilbertspace.interaction_list = interaction_list return hilbertspace
def hilbertspace_initialize(): transmon1 = qubit.Transmon( EJ=40.0, EC=0.2, ng=0.0, ncut=40, truncated_dim=3 # after diagonalization, we will keep 3 levels ) transmon2 = qubit.Transmon(EJ=3.0, EC=1.0, ng=0.0, ncut=10, truncated_dim=4) resonator = qubit.Oscillator( omega=6.0, truncated_dim=4 # up to 3 photons (0,1,2,3) ) # Form a list of all components making up the Hilbert space. return qubit.HilbertSpace([transmon1, transmon2, resonator])
def initialize(self): # Set up the components / subspaces of our Hilbert space # Set up the components / subspaces of our Hilbert space CPB1 = qubit.Transmon( EJ=40.0, EC=0.2, ng=0.3, ncut=40, truncated_dim=3 # after diagonalization, we will keep 3 levels ) CPB2 = qubit.Transmon( EJ=30.0, EC=0.15, ng=0.0, ncut=10, truncated_dim=4 ) resonator = qubit.Oscillator( E_osc=6.0, truncated_dim=4 # up to 3 photons (0,1,2,3) ) # Form a list of all components making up the Hilbert space. hilbertspace = HilbertSpace([CPB1, CPB2, resonator]) g1 = 0.1 # coupling resonator-CPB1 (without charge matrix elements) g2 = 0.2 # coupling resonator-CPB2 (without charge matrix elements) interaction1 = InteractionTerm( g_strength=g1, op1=CPB1.n_operator(), subsys1=CPB1, op2=resonator.creation_operator() + resonator.annihilation_operator(), subsys2=resonator ) interaction2 = InteractionTerm( g_strength=g2, op1=CPB2.n_operator(), subsys1=CPB2, op2=resonator.creation_operator() + resonator.annihilation_operator(), subsys2=resonator ) interaction_list = [interaction1, interaction2] hilbertspace.interaction_list = interaction_list param_name = 'flux' # name of varying external parameter param_vals = np.linspace(0., 2.0, 300) # parameter values subsys_update_list = [CPB1, CPB2] # list of HilbertSpace subsystems which are affected by parameter changes def update_hilbertspace(param_val): # function that shows how Hilbert space components are updated CPB1.EJ = 20 * np.abs(np.cos(np.pi * param_val)) CPB2.EJ = 15 * np.abs(np.cos(np.pi * param_val * 0.65)) sweep = ParameterSweep( param_name=param_name, param_vals=param_vals, evals_count=20, hilbertspace=hilbertspace, subsys_update_list=subsys_update_list, update_hilbertspace=update_hilbertspace ) return sweep
def initialize(self, num_cpus): # Set up the components / subspaces of our Hilbert space scq.settings.MULTIPROC = "pathos" CPB1 = scq.Transmon( EJ=40.0, EC=0.2, ng=0.0, ncut=40, truncated_dim=3, # after diagonalization, we will keep 3 levels ) CPB2 = scq.Transmon(EJ=3.0, EC=1.0, ng=0.0, ncut=10, truncated_dim=4) resonator = scq.Oscillator( E_osc=6.0, truncated_dim=4) # up to 3 photons (0,1,2,3) # Form a list of all components making up the Hilbert space. hilbertspace = HilbertSpace([CPB1, CPB2, resonator]) g1 = 0.1 # coupling resonator-CPB1 (without charge matrix elements) g2 = 0.2 # coupling resonator-CPB2 (without charge matrix elements) interaction1 = InteractionTerm( g_strength=g1, op1=CPB1.n_operator(), subsys1=CPB1, op2=resonator.creation_operator() + resonator.annihilation_operator(), subsys2=resonator, ) interaction2 = InteractionTerm( g_strength=g2, op1=CPB2.n_operator(), subsys1=CPB2, op2=resonator.creation_operator() + resonator.annihilation_operator(), subsys2=resonator, ) interaction_list = [interaction1, interaction2] hilbertspace.interaction_list = interaction_list param_name = "flux" # name of varying external parameter param_vals = np.linspace(-0.1, 0.6, 100) # parameter values subsys_update_list = [ CPB1 ] # list of HilbertSpace subsys_list which are affected by parameter changes def update_hilbertspace( param_val): # function that shows how Hilbert space # components are updated CPB1.EJ = 40.0 * np.cos(np.pi * param_val) sweep = ParameterSweep( param_name=param_name, param_vals=param_vals, evals_count=15, hilbertspace=hilbertspace, subsys_update_list=subsys_update_list, update_hilbertspace=update_hilbertspace, num_cpus=num_cpus, ) return sweep
''' Two transmons coupled to a resonator Follow the link for details https://scqubits.readthedocs.io/en/latest/guide/ipynb/hilbertspace.html#Example:-two-transmons-coupled-to-a-harmonic-mode ''' import scqubits as qubit import scqubits.utils.plotting as plot import numpy as np from scqubits import HilbertSpace, InteractionTerm, ParameterSweep import qutip as qt import matplotlib.pyplot as plt tmon1 = qubit.Transmon(EJ=40,EC=0.2,ng=0.3, ncut=40, truncated_dim=4) tmon2 = qubit.Transmon(EJ=15.0, EC=0.15, ng=0.0, ncut=30,truncated_dim=4) resonator = qubit.Oscillator( E_osc=4.5, truncated_dim=4 # up to 3 photons (0,1,2,3) ) hilbertspace = qubit.HilbertSpace([tmon1, tmon2, resonator]) print(hilbertspace) bare_hamiltonian = hilbertspace.bare_hamiltonian() print("---------- Bare Hamiltonian -------------") print(bare_hamiltonian) #plt.show()