def test_fullchain(self, caplog): qbt1 = scq.Transmon.create() qbt2 = scq.TunableTransmon.create() hs = scq.HilbertSpace([qbt1, qbt2]) pvals_by_name = {"ng": np.linspace(0.0, 1.0, 3)} def update_hilbertspace(ng): qbt1.ng = ng sweep = scq.ParameterSweep( hilbertspace=hs, paramvals_by_name=pvals_by_name, update_hilbertspace=update_hilbertspace, evals_count=5, ) central_dispatch.LOGGER.setLevel(logging.DEBUG) qbt1.EC = 0.67 assert "Transmon broadcasting QUANTUMSYSTEM_UPDATE" in caplog.text assert ( "Central dispatch calling HilbertSpace about QUANTUMSYSTEM_UPDATE" in caplog.text) assert "Client HilbertSpace broadcasting HILBERTSPACE_UPDATE" in caplog.text assert ( "Central dispatch calling ParameterSweep about HILBERTSPACE_UPDATE" in caplog.text) central_dispatch.LOGGER.setLevel(logging.WARNING)
def test_unregister(self, caplog): qbt = scq.Transmon.create() hs = scq.HilbertSpace([qbt]) central_dispatch.LOGGER.setLevel(logging.DEBUG) del hs assert "Unregistering HilbertSpace" in caplog.text central_dispatch.LOGGER.setLevel(logging.WARNING)
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(): 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 test_register(self, caplog): central_dispatch.LOGGER.setLevel(logging.DEBUG) qbt = scq.Transmon.create() hs = scq.HilbertSpace([qbt]) assert "Registering HilbertSpace for QUANTUMSYSTEM_UPDATE" in caplog.text central_dispatch.LOGGER.setLevel(logging.WARNING)
''' 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()