Transmon-Resonator Chain Emulation

This example demonstrates how to run an analog simulation of a chain consisting of transmon qubits and resonators using YAQS.

A Hamiltonian is initialized using a coupled transmon-resonator model. A State is prepared in a specific computational basis state. The system is evolved under a noise-free analog simulation using the Tensor Jump Method (TJM). Finally, expectation values for all computational basis states are collected and visualized.

Define the system Hamiltonian

 1import numpy as np
 2from mqt.yaqs.core.data_structures.hamiltonian import Hamiltonian
 3
 4length = 3 # Qubit - resonator - qubit
 5qubit_dim = 2
 6resonator_dim = 2
 7w_q = 4/(2*np.pi)
 8w_r = 4/(2*np.pi)
 9alpha = 0
10g = 2/(2*np.pi)
11
12H_0 = Hamiltonian.coupled_transmon(
13    length=length,
14    qubit_dim=qubit_dim,
15    resonator_dim=resonator_dim,
16    qubit_freq=w_q,
17    resonator_freq=w_r,
18    anharmonicity=alpha,
19    coupling=g,  # T_swap = pi/(2g)
20)

Define the initial state

1from mqt.yaqs.core.data_structures.state import State
2
3# Initialize in state |100⟩: left qubit excited
4state = State(
5    length,
6    initial="basis",
7    basis_string="100",
8    physical_dimensions=[qubit_dim, resonator_dim, qubit_dim],
9)

Define the noise model

1from mqt.yaqs.core.data_structures.noise_model import NoiseModel
2
3gamma = 0.0  # No noise for this simulation
4noise_model = NoiseModel([
5    {"name": name, "sites": [i], "strength": gamma}
6    for i in range(length)
7    for name in ["lowering"]
8])

Define the simulation parameters

 1from mqt.yaqs.core.data_structures.simulation_parameters import Observable, AnalogSimParams
 2
 3T_swap = np.pi/(2*g)
 4
 5# Measure all computational basis states
 6bitstrings = ["000", "001", "010", "011", "100", "101", "110", "111"]
 7sim_params = AnalogSimParams(
 8    observables=[Observable(bstr) for bstr in bitstrings], elapsed_time=T_swap, dt=T_swap/1000,
 9    sample_timesteps=True
10)

Run the simulation

1from mqt.yaqs import Simulator
2
3sim = Simulator()
4result = sim.run(state, H_0, sim_params, noise_model)

Plot the results

 1import matplotlib.pyplot as plt
 2import numpy as np
 3
 4pvm_observables = result.observables
 5leakage = np.ones_like(result.expectation_values[0])
 6for measurement, values in zip(pvm_observables, result.expectation_values, strict=True):
 7    leakage -= values
 8    plt.plot(values, label=measurement.gate.bitstring)
 9plt.plot(leakage, label="Leakage")
10
11plt.xlabel("Timestep")
12plt.ylabel("Probability")
13plt.title("Population in Computational Basis States Over Time")
14plt.legend(loc="center left", bbox_to_anchor=(1, 0.5))
15plt.tight_layout()
16plt.show()