Boulder Opal allows you to optimize and simulate a wide variety of controls for quantum systems. Jaksch et al. proposed a scheme for the implementation of entangling gates that leverage the interaction between Rydberg states of neutral atoms. This interaction is very strong and results in a blockade effect that inhibits simultaneous excitation of adjacent atoms to a Rydberg state, enabling very fast generation of entanglement. Saffman et al. have examined the use of adiabatic rapid passage (ARP) pulses to implement entangling controlled-Z (CZ) gates with robustness to laser intensity and detuning errors.
In this notebook, we demonstrate how Boulder Opal can be used to generate controls that extend this robustness by explicitly including it in the optimization, along with robustness to the decay of the Rydberg excited state. This strategy achieves both better best-case performance and greater robustness to noise than the adiabatic pulses.
import numpy as np
import matplotlib.pyplot as plt
import qctrlvisualizer as qv
import boulderopal as bo
bo.cloud.set_verbosity("QUIET")
plt.style.use(qv.get_qctrl_style())
controls_for_plots = lambda opt: {
"$\\Omega$": opt["output"]["amplitude"],
"$\\Delta$": opt["output"]["detuning"],
}
# Read and write helper functions, type independent.
def save_variable(file_name, var):
"""
Save a single variable to a file using jsonpickle.
"""
with open(file_name, "w+") as file:
file.write(jsonpickle.encode(var))
def load_variable(file_name):
"""
Load a variable from a file encoded with jsonpickle.
"""
with open(file_name, "r+") as file:
return jsonpickle.decode(file.read())
Our starting point is the Hamiltonian described by Saffman et al. for the CZ gate:
where is the blockade strength and the subscripts , correspond to the control and target qubits, respectively. We will assume a global drive, meaning that the envelope for and are the same. Treating the atoms as a three-level system with hyperfine qubit states and and a Rydberg excited state , we can write as
The total Hamiltonian can then be written as
We aim to implement the CZ gate which, up to global single-qubit rotations, is given in the computational basis by
Saffman et al. propose the implementation of the entangling CZ gate with a symmetric ARP pulse applied globally to both atomic qubits. This control sequence is characterized by an amplitude and detuning given, respectively, by
where each pulse has total duration , is set so the amplitude is zero at the start and end of the pulse, is the center of the pulse, and . Two pulses are used in succession to implement the gate. In what follows, we will use these pulses as benchmarks for comparison with the solutions obtained using Boulder Opal.
The analytic ARP pulses defined above are capable of implementing the CZ operation with high fidelity with a strong blockade, however the gate infidelity grows as the blockade weakens, as we will see below. In this section, we show how to produce an optimized, band-limited control sequence with Boulder Opal that achieves high fidelity gates, even with weaker blockades, by accounting for the blockade strength.
Let's start with the definition of operators and parameters for the system. In the cell below we consider the following pulse parameters used in Saffman et al.:
We now define a function that optimizes the pulses to achieve the target CZ gate. For the ARP scheme only the single qubit phase is optimizable.
For the general optimal pulse, the time dependence of and will be only constrained by the maximum value of the amplitudes of the pulses and by the imposition of bandwidth limits to generate smooth pulse envelopes.
Note that some Boulder Opal functions support a run_async flag, that when set to True enables to submit jobs asynchronously.
Depending on your Boulder Opal plan, these jobs may run concurrently on different machines and save you time.
For more details on asynchronous job submission, refer to this user guide.
As an example, let's create a standard ARP pulse and calculate the gate infidelity using the function above for a given value of the blockade ( in this case).
For the general optimal pulse in the absence of noise we see an improvement of the gate infidelity by several orders of magnitude. The controls used for the optimal pulse are also shown here.
For the two pulse schemes (ARP and optimal), we can optimize the gate and measure the resulting infidelity for varying blockade strengths. The optimal pulse outperforms the ARP pulse by several orders of magnitude for every blockade strength, including in the low blockade region where the ARP infidelity increases.
# Vary blockade strength from 250 MHz to 4 GHz.
blockades = 2 * np.pi * 1e6 * np.array([250, 500, 1750, 2500, 4000])
arp_jobs = [
optimize_cz_gate(
"ARP",
B,
cost_node="infidelity",
dephasing=False,
amplitude=False,
decay=0.0,
run_async=True,
)
for B in blockades
]
optimal_jobs = [
optimize_cz_gate(
"optimal",
B,
cost_node="infidelity",
dephasing=False,
amplitude=False,
decay=0.0,
run_async=True,
)
for B in blockades
]
blockade_scan_results = {}
blockade_scan_results["ARP"] = [job.get_result() for job in arp_jobs]
blockade_scan_results["Optimal, non-robust"] = [
job.get_result() for job in optimal_jobs
]
Now we will investigate the susceptibility of these solutions to dephasing and noise in the control amplitudes. For this, the detuning and intensity errors are treated as quasi-static coherent error terms in the Hamiltonian during the gate, with the transformations:
Note that the amplitude error is treated as a relative error rather than a constant offset. To evaluate the control performance in the presence of noise, we will fix the blockade strength at two different values and scan over different values of the noise while calculating the corresponding gate infidelity. For the coherent dynamics considered so far, calculations can be efficiently performed using Boulder Opal by creating a batch of Hamiltonians that can run in parallel.
# Indices in the list of blockades for the chosen values.
B_indices = [0, -2]
# Defining the error ranges for the scan.
scan_point_count = 61
detuning_error_values = (
np.linspace(-0.2, 0.2, num=scan_point_count) * 2 * np.pi * 1e6
) # rad/s
amplitude_error_values = np.linspace(-0.3, 0.3, num=scan_point_count)
# Define control list.
control_list = [
results[B_idx] for B_idx in B_indices for results in blockade_scan_results.values()
]
def run_coherent_simulation(
control_results, detuning_error_values, amplitude_error_values, run_async
):
graph = bo.Graph()
# Get blockade value
B = control_results["output"]["blockade"]["value"] * 2 * np.pi
# Get pulse values
Omega = graph.pwc(**control_results["output"]["amplitude"])
Delta = graph.pwc(**control_results["output"]["detuning"])
detuning_error = graph.constant_pwc(
constant=detuning_error_values[:, None, None],
duration=duration,
batch_dimension_count=2,
)
amplitude_error = graph.constant_pwc(
constant=amplitude_error_values[None, :, None],
duration=duration,
batch_dimension_count=2,
)
# add noise to the hamiltonian
hamiltonian = (
graph.hermitian_part(Omega * (1.0 + amplitude_error) * drive_operator)
+ (Delta + detuning_error) * detuning_operator
+ B * blockade_operator
)
theta_s = control_results["output"]["theta_s"]["value"]
cz_op = (
h_00
+ graph.exp(1j * theta_s) * h_01
+ graph.exp(1j * (2 * theta_s + np.pi)) * h_11
)
target = graph.target(operator=cz_op)
infid = graph.infidelity_pwc(
hamiltonian=hamiltonian, target=target, name="infidelity"
)
return bo.execute_graph(graph, "infidelity", run_async=run_async)
# Run the dephasing/amplitude error scans for ARP pulse.
jobs = [
run_coherent_simulation(
control, detuning_error_values, amplitude_error_values, run_async=True
)
for control in control_list
]
infidelity_scan = [job.get_result() for job in jobs]
# Extracting scan results.
error_scan = {}
idx = 0
for B_idx in B_indices:
scan_per_scheme = {}
for scheme in blockade_scan_results.keys():
scan_per_scheme[scheme] = infidelity_scan[idx]["output"]["infidelity"]["value"]
idx += 1
error_scan[B_idx] = scan_per_scheme
for B_idx, scan in error_scan.items():
fig, axs = plt.subplots(1, 2, figsize=(15, 5))
fig.tight_layout()
fig.subplots_adjust(wspace=0.1, hspace=0.2)
fig.suptitle(
f"Quasi-static scans for optimized pulses with B={blockades[B_idx]/2/np.pi/1e6} MHz",
y=1.18,
x=0.4,
)
all_min = np.min([inf for inf in scan.values()])
all_max = np.max([inf for inf in scan.values()])
for idx, (scheme, infidelity) in enumerate(scan.items()):
axs[idx].set_title(
scheme + "\n" + "Min. infidelity=" + f"{np.min(infidelity):.3e}"
)
c = axs[idx].pcolormesh(
detuning_error_values / (2 * np.pi * 1e3),
amplitude_error_values,
infidelity.squeeze().T,
vmin=all_min,
vmax=all_max,
cmap=plt.colormaps["plasma"].reversed(),
)
contours = axs[idx].contour(
detuning_error_values / (2 * np.pi * 1e3),
amplitude_error_values,
infidelity.squeeze().T,
levels=[0.001, 0.01],
colors="#680CEA",
)
axs[idx].set_xlabel("Detuning error (kHz)")
plt.clabel(contours, inline=True, fontsize=8)
if idx != 0:
axs[idx].set_yticks([])
cbar = fig.colorbar(c, ax=axs, label="Gate infidelity")
axs[0].set_ylabel("Relative amplitude error")
plt.show()
print("\n")
These results show that the ARP pulse shows some robustness to detuning and amplitude errors for large values of the blockade strength. The optimized pulse shows a strong robustness against dephasing for both values of blockade, even though this was not enforced in the optimization.
In the previous sections, we saw that one can achieve orders of magnitude improvement in gate infidelity when pulses are optimized for different values of the blockade strength. The optimized pulses also show robustness against detuning errors. Now we will design pulses to include robustness against noise in the control amplitude. Note that the optimization function defined in the previous section already allows for designing such pulses by simply setting the values in the robustness dictionary to True.
We will choose two values for the Blockade strength (250 MHz and 2.5 GHz) and for each, find optimal pulses robust to amplitude noise.
robustness_options = [{"dephasing": False, "amplitude": True, "decay": 0}]
jobs = [
optimize_cz_gate(
pulse_scheme="robust",
blockade_strength=blockades[B_idx],
cost_node="infidelity",
dephasing=robustness["dephasing"],
amplitude=robustness["amplitude"],
decay=robustness["decay"],
run_async=True,
)
for B_idx in B_indices
for robustness in robustness_options
]
robust_controls = [job.get_result() for job in jobs]
# Storing scan results in a dictionary.
scheme_list = ["Amplitude robust"]
robust_controls_dic = {key: {} for key in scheme_list}
idx = 0
for B_idx in B_indices:
scan_per_scheme = {}
for scheme in scheme_list:
robust_controls_dic[scheme].update({B_idx: robust_controls[idx]})
idx += 1
Now we will characterize the robust pulses by scanning over different values different values of the noise and calculating the resulting gate infidelity. Then we can compare the robust pulse with the original ARP pulse and the optimized pulse of the previous section by plotting the quasi-static scans for detuning and amplitude errors independently.
# Run the scans.
jobs = [
run_coherent_simulation(
control, detuning_error_values, amplitude_error_values, run_async=True
)
for control in robust_controls
]
infidelity_scan = [job.get_result() for job in jobs]
# Extracting scan results.
robust_error_scan = {}
idx = 0
for B_idx in B_indices:
scan_per_scheme = {}
for scheme in scheme_list:
scan_per_scheme[scheme] = infidelity_scan[idx]["output"]["infidelity"]["value"]
idx += 1
robust_error_scan[B_idx] = scan_per_scheme
The optimized pulse outperforms the ARP pulse in both overall gate infidelity and in robustness against dephasing for both values of . The robust optimized pulse also provides infidelities orders of magnitude smaller than the ones achieved with ARP pulses for a range of amplitude noise that increases for smaller blockade strength.
We will now investigate the effect of spontaneous emission on gate performance using the pulses from the previous sections. The decay of the Rydberg state is an incoherent process, and so to simulate it we use the Lindblad master equation
where is an index over the two atoms and is a decay operator between the Rydberg state and the state . is the decay rate of the Rydberg state, are branching ratios between the three lower levels and is a "dark" state that represents hyperfine levels not used to encode the qubit. Saffman et al. take , and .
To assess robustness of our pulses, we simulate the master equation using the initial state
Ideally, applying a CZ gate to this state will produce a maximally-entangled state, equivalent to a Bell state up to single-qubit rotations. We can quantify the error in the gate operation by taking the overlap of the final state with the target entangled state,
with
This is equivalent to the Bell state fidelity used in the paper, assuming that single-qubit operations can be performed perfectly.
To evaluate the gate performance in the presence of decay, we define a function that simulates the open quantum system with a spontaneous emission term. The function below takes values of relative intensity error and detuning error, and returns a graph that simulates the master equation for those values and calculates the Bell state infidelity.
We will now show how Boulder Opal can be used to produce a control pulse that is designed to be robust to intensity and detuning errors, as well as decay of the Rydberg state. Directly including the decay in a master equation simulation during the optimization would be very computationally expensive, so we instead add a cost term to the infidelity, which integrates the population of the Rydberg state during the gate. This cost term is given by
This cost is already included in the optimize_cz_gate function defined at the beginning of this notebook. To enable this term, we just need to input a non-zero penalty as the value of decay key in the robustness dictionary. In the next cell we run an optimization with this decay option.
jobs = [
optimize_cz_gate(
pulse_scheme="amplitude robust",
blockade_strength=blockades[B_idx],
cost_node="cost",
dephasing=False,
amplitude=True,
decay=0.05,
run_async=True,
)
for B_idx in B_indices
]
decay_robust_control = {B_idx: job.get_result() for B_idx, job in zip(B_indices, jobs)}
We will now choose a range for each error source and execute the simulations for three different pulses: ARP, amplitude robust, and amplitude robust with decay mitigation.
# Defining the error ranges for the scan.
scan_point_count = 15
error_values = {
"Detuning": np.linspace(-0.2, 0.2, num=scan_point_count) * 2 * np.pi * 1e6,
"Amplitude": np.linspace(-0.3, 0.3, num=scan_point_count),
}
decay_results = {}
for B_idx in B_indices:
# Define control list.
controls = {
"ARP": blockade_scan_results["ARP"][B_idx],
"Amplitude robust": robust_controls_dic["Amplitude robust"][B_idx],
"Amplitude robust with decay mitigation": decay_robust_control[B_idx],
}
# Detuning scan.
results = {"Detuning": {}, "Amplitude": {}}
for scheme, control in controls.items():
jobs = [
run_decay_simulation(detuning_error, 0, control, run_async=True)
for detuning_error in error_values["Detuning"]
]
simulations = [job.get_result() for job in jobs]
infidelities = [s["output"]["infidelity"]["value"] for s in simulations]
results["Detuning"][scheme] = np.array(infidelities)
# Amplitude scan.
for scheme, control in controls.items():
jobs = [
run_decay_simulation(0, amplitude_error, control, run_async=True)
for amplitude_error in error_values["Amplitude"]
]
simulations = [job.get_result() for job in jobs]
infidelities = [s["output"]["infidelity"]["value"] for s in simulations]
results["Amplitude"][scheme] = np.array(infidelities)
decay_results[B_idx] = results
fig, ax = plt.subplots(2, 2, figsize=(15, 10))
fig.tight_layout()
fig.subplots_adjust(wspace=0.1, hspace=0.2)
fig.suptitle(f"Quasi-static scans", y=1.15)
color_plot = {
"ARP": "k",
"Amplitude robust": qv.QCTRL_STYLE_COLORS[1],
"Dual robust": qv.QCTRL_STYLE_COLORS[2],
"Optimal": qv.QCTRL_STYLE_COLORS[3],
"Amplitude robust with decay mitigation": qv.QCTRL_STYLE_COLORS[0],
}
error_values["Detuning"] = error_values["Detuning"] / 2 / np.pi / 1e3
for idx, (B_idx, all_controls) in enumerate(decay_results.items()):
ax[idx][0].plot(
np.linspace(-0.2, 0.2, num=61) * 1e3,
robust_error_scan[B_idx]["Amplitude robust"][:, 30],
label="Amplitude robust, no decay",
ls="--",
c=color_plot["Amplitude robust"],
alpha=0.4,
)
ax[idx][1].plot(
np.linspace(-0.3, 0.3, num=61),
robust_error_scan[B_idx]["Amplitude robust"][30, :],
label="Amplitude robust, no decay",
ls="--",
c=color_plot["Amplitude robust"],
alpha=0.4,
)
ax[idx][0].plot(
np.linspace(-0.2, 0.2, num=61) * 1e3,
error_scan[B_idx]["ARP"][:, 30],
label="ARP, no decay",
ls="--",
c=color_plot["ARP"],
alpha=0.4,
)
ax[idx][1].plot(
np.linspace(-0.3, 0.3, num=61),
error_scan[B_idx]["ARP"][30, :],
label="ARP, no decay",
ls="--",
c=color_plot["ARP"],
alpha=0.4,
)
ax[idx][0].set_ylabel("Infidelity")
for idx2, (scan_name, control_results) in enumerate(all_controls.items()):
ax[idx][idx2].set_title(
scan_name + f" scan for B={blockades[B_idx]/2/np.pi/1e6} MHz"
)
for control_type, control in control_results.items():
ax[idx][idx2].plot(
error_values[scan_name],
control.T,
label=control_type,
c=color_plot[control_type],
)
ax[0][idx2].set_xticks([])
ax[1][0].set_xlabel("Detuning error (kHz)")
ax[1][1].set_xlabel("Relative Amplitude error")
for a in ax.ravel():
a.set_yscale("log")
ax[0][0].legend(loc="best", bbox_to_anchor=(1.6, 1.35), ncol=2)
plt.show()
The plot shows a decrease in the Bell state fidelity when decay is taken into account. This effect is stronger for higher blockade.
The robust pulse with decay mitigation outperforms the ARP for the detuning range considered and by a factor of for the best infidelity. The ARP pulse is already quite robust against amplitude errors but the robust pulse with decay mitigation outperforms it roughly in the same region as in the no-decay case.
Was this useful?
New to Boulder Opal?
Get access to everything you need to automate and optimize quantum hardware performance at scale.