Your task will be to generate an entangling Mølmer–Sørensen gate for two trapped Ytterbium ions.
Mølmer–Sørensen-type operations entangle multiple ions using laser drives tuned close to the frequency of an ion chain oscillation mode.
Particular drives give rise to relative phases and phase space displacements during an operation.
The operational infidelity of the gate is determined by the relative phases and displacements at the final time of the drives.
In a successful Mølmer–Sørensen operation in an ion chain, the phase-space trajectories for all modes return to zero (that is, avoiding residual internal-motional entanglement), and set the phase acquired between the internal states of each pair of ions to a target value.
The interaction Hamiltonian for Mølmer–Sørensen-type operations in a chain with ions takes the form ( as per Boulder Opal convention)
where the axis dimension and collective mode dimension are combined into a single index for simplicity,
is the Pauli operator for ion ,
is the Lamb–Dicke parameter of mode for ion ,
is the drive addressing ion ,
is the annihilation operator for mode ,
and
is the relative detuning of the laser frequency from the motional frequency of mode .
The trapped ions module is capable of finding optimal drives which create the target entangling phases in the system.
With indicating the phase between each pair of ions () (indexing from 0), the operation acting on the internal degrees of freedom of the ions can be described as:
Although the trapped ions module can deal with larger ion chains, in this tutorial you will work with a pair of ions and create an entangling gate with a global beam addressing both ions.
With a target phase of , the corresponding entangling operation is then
Before doing any calculation with Boulder Opal, you always need to import the necessary libraries.
In this case, import the numpy, matplotlib.pyplot, qctrlvisualizer, and boulderopal packages.
To learn more about installing Boulder Opal, see the Get started guide.
# Import packages.
import numpy as np
import matplotlib.pyplot as plt
import qctrlvisualizer
import boulderopal as bo
# Apply Q-CTRL style to plots created in pyplot.
plt.style.use(qctrlvisualizer.get_qctrl_style())
Start by specifying the physical parameters for the laser drive and ion trap, and calculating the ion chain properties with the boulderopal.ions.obtain_ion_chain_properties function.
The function returns a dictionary containing the Lamb–Dicke parameters and relative detunings.
Define the optimizable drives according to the degrees of freedom in the hardware.
In this case, define a single optimizable piecewise-constant complex drive by creating a boulderopal.ions.ComplexOptimizableDrive object.
Pass to it its maximum Rabi rate (modulus) and the ions it addresses in the system (both of them), as well as the number of optimizable piecewise-constant segments it should have.
Define the duration of the gate to be implemented, as well as the target phases for all the ions.
The target phases must be a strictly lower triangular matrix, that is, indicates the total relative phase target for ions and , with .
You now have everything necessary to carry out the optimization.
Use the boulderopal.ions.ms_optimize function to obtain the optimized pulse that implements the target Mølmer–Sørensen gate.
Pass to it the system parameters, the optimizable drives, as well as the gate duration and the target phases matrix.
You can also use the cost_history_scope parameter to request the evolution of the cost value during the optimization.
result = bo.ions.ms_optimize(
drives=[drive],
lamb_dicke_parameters=lamb_dicke_parameters,
relative_detunings=relative_detunings,
duration=duration,
target_phases=target_phases,
cost_history_scope="ITERATION_VALUES",
)
Your task (action_id="1828688") is queued.
Your task (action_id="1828688") has started.
Your task (action_id="1828688") has completed.
After the calculation is complete, the results are stored in the output of the returned dictionary, result.
It contains the optimized values for each optimizable drive, as well as the optimized system dynamics (the "phases", "displacements", and "infidelities") and the "sample_times" at which they're sampled.
A low infidelity at the end of the operation ensures us that the ion pairs have acquired the right phases, without generating any entanglement without the internal and external degrees of freedom of the ions.
You can retrieve the evolution of the cost during the different optimizations from the optimized values dictionary, and plot them with the plot_cost_histories function from the Q-CTRL Visualizer package.
You can easily visualize the dynamics of the relative phase between the two ions over the duration of the gate, by extracting the phases from the result.
For high-fidelity operations, the relative phase obtained at the end of the operation should match the target phase for the ion pair (marked by a horizontal dashed black line).
You can visualize the trajectory of the center of a coherent state in (rotating) optical phase space for each mode.
The closure of these trajectories is a necessary condition for an effective operation.
You can obtain the overall displacement for each mode by summing the displacements over the ion dimension.
total_displacement = np.sum(result["output"]["displacements"]["value"], axis=-1)
fig, axs = plt.subplots(1, 2)
plot_range = 1.05 * np.max(np.abs(total_displacement))
fig.suptitle("Phase space trajectories")
for k in range(2):
for mode in range(ion_count):
axs[k].plot(
np.real(total_displacement[:, k, mode]),
np.imag(total_displacement[:, k, mode]),
label=f"mode {mode % ion_count}",
)
axs[k].plot(
np.real(total_displacement[-1, k, mode]),
np.imag(total_displacement[-1, k, mode]),
"k*",
markersize=10,
)
axs[k].set_xlim(-plot_range, plot_range)
axs[k].set_ylim(-plot_range, plot_range)
axs[k].set_aspect("equal")
axs[k].set_xlabel("q")
axs[0].set_title("$x$-axis")
axs[0].set_ylabel("p")
axs[1].set_title("$y$-axis")
axs[1].yaxis.set_ticklabels([])
hs, ls = axs[0].get_legend_handles_labels()
axs[1].legend(handles=hs, labels=ls, loc="upper left", bbox_to_anchor=(1, 1))
plt.show()
Here, and are the dimensionless quadratures for each mode .
The black star marks the final displacement for each mode, which overlap at zero; this indicates that the operation has not caused any residual state-motional entanglement or motional heating.
The z-axis modes are not addressed, and thus have no excursions in phase space.
You've reached the end of the tutorial.
Congratulations on obtaining your first Mølmer–Sørensen gate.
You can easily extend the calculations you have done here by having longer ion chains, adding drives that address different ions, trying a robust optimization, etc.
The different classes and functions in the trapped ions module are described in their reference page.