1 rabi oscillation
In [ ]:
Copied!
# Install qubex library if not installed
# !pip install git+https://github.com/amachino/qubex.git
# Install qubex library if not installed
# !pip install git+https://github.com/amachino/qubex.git
In [ ]:
Copied!
import numpy as np
import qubex as qx
from qubex.simulator import Control, QuantumSimulator, QuantumSystem, Transmon
import numpy as np
import qubex as qx
from qubex.simulator import Control, QuantumSimulator, QuantumSystem, Transmon
In [ ]:
Copied!
# Define the transmon qubit (unit: GHz, ns)
qubit = Transmon(
label="Q01",
dimension=3,
frequency=7.648,
anharmonicity=-0.333,
relaxation_rate=0.00005,
dephasing_rate=0.00005,
)
# Define the quantum system with the qubit
system = QuantumSystem(objects=[qubit])
# Define the quantum simulator with the system
simulator = QuantumSimulator(system)
# Define the transmon qubit (unit: GHz, ns)
qubit = Transmon(
label="Q01",
dimension=3,
frequency=7.648,
anharmonicity=-0.333,
relaxation_rate=0.00005,
dephasing_rate=0.00005,
)
# Define the quantum system with the qubit
system = QuantumSystem(objects=[qubit])
# Define the quantum simulator with the system
simulator = QuantumSimulator(system)
In [ ]:
Copied!
# Check the Hamiltonian of the system
system.hamiltonian
# Check the Hamiltonian of the system
system.hamiltonian
In [ ]:
Copied!
# Define the drive pulse
# Rectangular pulse with amplitude 4π/100 and duration 100 ns
# Rabi frequency will be 2/100 = 0.02 GHz = 20 MHz
duration = 100
drive = qx.pulse.Rect(
duration=duration,
amplitude=2 * (2 * np.pi) / duration,
)
# Plot the drive pulse
drive.plot()
# Define the drive pulse
# Rectangular pulse with amplitude 4π/100 and duration 100 ns
# Rabi frequency will be 2/100 = 0.02 GHz = 20 MHz
duration = 100
drive = qx.pulse.Rect(
duration=duration,
amplitude=2 * (2 * np.pi) / duration,
)
# Plot the drive pulse
drive.plot()
On-resonant Rabi oscillation¶
In [ ]:
Copied!
# Define the control with the target qubit and the drive pulse
control = Control(
target=qubit,
waveform=drive,
)
# Run the simulation by solving the master equation
result = simulator.mesolve(
controls=[control], # List of controls
initial_state={"Q01": "0"}, # Initial states of the qubits
n_samples=101, # Number of samples
)
# Define the control with the target qubit and the drive pulse
control = Control(
target=qubit,
waveform=drive,
)
# Run the simulation by solving the master equation
result = simulator.mesolve(
controls=[control], # List of controls
initial_state={"Q01": "0"}, # Initial states of the qubits
n_samples=101, # Number of samples
)
In [ ]:
Copied!
# Show the last population of the qubit
result.show_last_population(qubit.label)
# Plot the population dynamics of the qubit
result.plot_population_dynamics(qubit.label)
# Plot the Bloch vectors of the qubit
result.plot_bloch_vectors(qubit.label)
# Display the Bloch sphere of the qubit
result.display_bloch_sphere(qubit.label)
# Show the last population of the qubit
result.show_last_population(qubit.label)
# Plot the population dynamics of the qubit
result.plot_population_dynamics(qubit.label)
# Plot the Bloch vectors of the qubit
result.plot_bloch_vectors(qubit.label)
# Display the Bloch sphere of the qubit
result.display_bloch_sphere(qubit.label)
Off-resonant Rabi oscillation¶
In [ ]:
Copied!
detuning = 0.01
control = Control(
target=qubit,
frequency=qubit.frequency + detuning,
waveform=drive,
)
result = simulator.mesolve(
controls=[control],
initial_state={"Q01": "0"},
n_samples=101,
)
result.show_last_population(qubit.label)
result.plot_population_dynamics(qubit.label)
# qubit frame
result.plot_bloch_vectors(qubit.label, frame="qubit")
result.display_bloch_sphere(qubit.label, frame="qubit")
# drive frame
result.plot_bloch_vectors(qubit.label, frame="drive")
result.display_bloch_sphere(qubit.label, frame="drive")
detuning = 0.01
control = Control(
target=qubit,
frequency=qubit.frequency + detuning,
waveform=drive,
)
result = simulator.mesolve(
controls=[control],
initial_state={"Q01": "0"},
n_samples=101,
)
result.show_last_population(qubit.label)
result.plot_population_dynamics(qubit.label)
# qubit frame
result.plot_bloch_vectors(qubit.label, frame="qubit")
result.display_bloch_sphere(qubit.label, frame="qubit")
# drive frame
result.plot_bloch_vectors(qubit.label, frame="drive")
result.display_bloch_sphere(qubit.label, frame="drive")