PRBench / tasks /task_wu_2021 /GateOf2D.md
StarThomas1002's picture
Add 31 PRBench task specifications (instructions, task.yaml, paper markdown; ground truth withheld)
a48f2b1 verified
|
Raw History Blame Contribute Delete
84.9 kB
## **High-fidelity entangling gates in a three-dimensional ion crystal under micromotion**
Y.-K. W[u](https://orcid.org/0000-0003-2184-7553) , \* Z.-D. Liu,\* W.-D. Zhao, and L.-M. Duan
*Center for Quantum Information, IIIS, Tsinghua University, Beijing 100084, People's Republic of China*
(Received 27 September 2020; revised 16 January 2021; accepted 2 February 2021; published 19 February 2021)
An ion trap is one of the most promising candidates for quantum computing. Current schemes mainly focus on a linear chain of up to about 100 ions in a Paul trap. To further scale up the qubit number, one possible direction is to use 2D or 3D ion crystals (Wigner crystals). In these systems, ions are generally subjected to large micromotion due to the strong fast-oscillating electric field, which can significantly influence the performance of entangling gates. In this paper, we develop an efficient numerical method to design high-fidelity entangling gates in a general 3D ion crystal. We present numerical algorithms to solve the equilibrium configuration of the ions and their collective normal modes. We then give a mathematical description of the micromotion and use it to generalize the gate scheme for linear ion chains into a general 3D crystal. The involved time integral of highly oscillatory functions is expanded into a fast-converging series for accurate and efficient evaluation and optimization. As a numerical example, we show a high-fidelity entangling gate design between two ions in a 100-ion crystal, with a theoretical fidelity above 99.9%.
## DOI: [10.1103/PhysRevA.103.022419](https://doi.org/10.1103/PhysRevA.103.022419)
## **I. INTRODUCTION**
Over the past few decades, quantum computing has attracted wide interest because it challenges the strong Church-Turing thesis and has a potential exponential speedup over classical computers for certain problems [\[1\]](#page-13-0). To realize quantum computing, some basic requirements, known as the DiVincenzo's criteria [\[2\]](#page-13-0), need to be fulfilled, among which is a universal gate set that any desired multiqubit unitary gates can be generated from. A commonly used universal gate set consists of a few single-qubit gates and a two-qubit entangling gate [\[1\]](#page-13-0). While the single-qubit gates are relatively simple, the two-qubit gate usually turns out to be much more difficult and has become the focus of research. In addition, such entangling gates also find applications in other fields such as digital quantum simulation [\[3\]](#page-13-0), variational hybrid quantum-classical algorithms [\[4,5\]](#page-13-0), and quantum metrology [\[6\]](#page-13-0).
Trapped ions have become one of the leading platforms for realizing quantum computing owing to the long coherence time, convenient initialization and readout, and the strong state-dependent coupling between ions mediated by laser [\[7–10\]](#page-13-0) or microwave [\[11–14\]](#page-13-0) driving. Dedicated schemes for high-fidelity entangling gates, known as the Mølmer-Sørensen gate [\[15\]](#page-13-0) and its variants, have been developed for ion chains in a linear Paul trap. The gate can be designed using different collective motional modes of the ions [\[16,17\]](#page-13-0), through various control and optimization methods for the driving field [\[18–20\]](#page-13-0), and have been demonstrated in experiments from two to more than ten ions [\[21–27\]](#page-13-0).
One major problem of the linear configuration is the scalability. It is estimated that the current gate schemes can be generalized to about 100 ions [\[28](#page-13-0)[–30\]](#page-14-0), while for larger number of qubits we need more complicated schemes like ion shuttling [\[28](#page-13-0)[,31\]](#page-14-0) or photonic quantum networks [\[32–34\]](#page-14-0). Although noticeable progress has been achieved in these directions in recent years, these approaches require additional exquisite control of the ion system and their speed is limited by the slow quantum wiring process.
Therefore, it is appealing to consider a scheme using the current control techniques and move the complexity into the design of the control sequence. One such possibility is to increase qubit numbers by exploring higher dimensional ion systems in 2D or 3D, where large Wigner crystals of ions have been observed in experiments for hundreds to thousands of ions [\[35,36\]](#page-14-0). Some pioneering works have been performed in Refs. [\[37–40\]](#page-14-0). In particular, it has been shown that the micromotion of the ions, which is inevitable for large 2D or 3D ion crystals in a Paul trap and leads to deviation from the gate scheme in 1D, is not a source of decoherence. Actually, micromotion has been exploited earlier in experiments for selective single-ion addressing [\[41\]](#page-14-0). The idea is then to describe the micromotion of an ion crystal theoretically and experimentally [\[42–45\]](#page-14-0), and to find a suitable laser sequence to realize high-fidelity gates under micromotion [\[37–39,46\]](#page-14-0). In previous works, approximations are made to the lowest orders of micromotion; while for high gate fidelity, it will be necessary to consider higher order corrections. In this paper, we will develop an efficient algorithm to design entangling gates in general ion crystals up to arbitrary orders of micromotion. We will assume a general 3D crystal, with our results directly applicable to 2D as a special case of the trapping potential.
The paper is organized as follows. First, we briefly review a commonly used gate scheme in 1D ion chains in Sec. [II](#page-1-0) and describe the effects of micromotion when generalizing it to 3D. In Sec. [III A,](#page-2-0) we describe a numerical method to solve the equilibrium positions and micromotion of the ions,
<sup>\*</sup>These authors contributed equally to this work.
<span id="page-1-0"></span>from which we further solve all the collective normal modes in Sec. III B. In Sec. IV, we provide efficient numerical algorithms to include the micromotion into the gate design, whose theoretical errors can be systematically controlled to arbitrary orders. A numerical example is presented in Sec. V. Finally we conclude in Sec. VI. Appendix A summarizes the numerical algorithms and Appendix B gives an example of incorporating the robustness condition against certain parameter drifts into our algorithms.
#### II. GATE SCHEME IN 1D ION CHAINS
In this section, we briefly review how two-ion entangling gates can be realized in a linear chain of N ions. It will later be generalized to a 3D ion crystal in the following sections. Here we will follow the notation of Ref. [47].
The coupling between two ions is generated by off-resonantly driving them near some motional sidebands simultaneously. Assuming two driving fields on the ion j with the same Rabi frequency $\Omega_j$ , opposite detuning $\pm \mu$ to the atomic transition frequency and opposite wave vectors $\pm \Delta k$ along a transverse direction x, which is known as the phase-insensitive configuration [48], the qubit-phonon interaction Hamiltonian takes the form
$$\hat{H} = \sum_{j} \hbar \Omega_{j} \cos \left[\mu t + \varphi_{j} - \Delta k \,\hat{x}_{j}(t)\right] \hat{\sigma}_{j}^{x},\tag{1}$$
where the index j runs over the two ions being driven, $\varphi_j$ a motional phase depending on the initial phases of the driving fields and the equilibrium positions of the ions, $\hat{\sigma}_j^x$ the corresponding Pauli X operators, and $\hat{x}_j(t)$ the time-evolved position operators in the transverse direction. We can decompose the transverse motion into normal modes,
$$\hat{x}_j(t) = \sum_k b_j^k \sqrt{\frac{\hbar}{2m\omega_k}} (\hat{a}_k e^{-i\omega_k t} + \hat{a}_k^{\dagger} e^{i\omega_k t}), \tag{2}$$
where k labels a normal mode with a creation (annihilation) operator $\hat{a}_k^{\dagger}(\hat{a}_k)$ , a mode frequency $\omega_k$ , and a normalized mode vector $b_k^{\dagger}$ for $j=1, 2, \dots, N$ .
With the Lamb-Dicke parameter $\eta_k \equiv \Delta k \sqrt{\hbar/2m\omega_k} \ll 1$ for typical experiments, and assuming weak excitation of the phonon modes during the gate (which is known as the Lamb-Dicke regime), we only need to consider the lowest order expansions in $\eta_k$ ,
$$\hat{H} = \sum_{j} \sum_{k} \chi_{j}(t) \eta_{k} b_{j}^{k} (\hat{a}_{k} e^{-i\omega_{k}t} + \hat{a}_{k}^{\dagger} e^{i\omega_{k}t}) \hat{\sigma}_{j}^{x}, \qquad (3)$$
where $\chi_j(t) \equiv \hbar \Omega_j \sin{(\mu t + \varphi_j)}$ . The zeroth order term is dropped as a single-qubit rotation which can be compensated after the entangling gate. The error of neglecting the higher order terms is shown to be $O(\eta_k^4)$ in the gate fidelity [47].
Time evolution under this Hamiltonian with duration $\tau$ is given by the unitary operator
$$\hat{U}(\tau) = \exp\left[i\sum_{j} \hat{\phi}_{j}(\tau)\hat{\sigma}_{j}^{x} + i\sum_{i < j} \Theta_{ij}(\tau)\hat{\sigma}_{i}^{x}\sigma_{j}^{x}\right], \quad (4)$$
where
$$\hat{\phi}_j(\tau) = -i \sum_{k} \left[ \alpha_j^k(\tau) \hat{a}_k^{\dagger} - \alpha_j^{k*}(\tau) \hat{a}_k \right], \tag{5}$$
$$\alpha_j^k(\tau) = -\frac{i}{\hbar} \eta_k b_j^k \int_0^{\tau} \chi_j(t) e^{i\omega_k t} dt, \qquad (6)$$
describe the spin-phonon coupling after the gate, and
$$\Theta_{ij}(\tau) = \frac{1}{\hbar^2} \sum_{k} \eta_k^2 b_i^k b_j^k \int_0^{\tau} dt_1 \int_0^{t_1} dt_2 \times \left[ \chi_i(t_1) \chi_j(t_2) + \chi_j(t_1) \chi_i(t_2) \right] \sin \left[ \omega_k(t_1 - t_2) \right]$$
(7)
is the coupling between the two spins i and j.
For an ideal entangling gate, we want the qubit state to be decoupled from the phonon modes, that is, $\alpha_j^k = 0$ ; we also want $\Theta_{ij} = \pm \pi/4$ for the maximal entanglement such that the ideal gate $\exp(\pm i\pi \sigma_i^x \sigma_j^x/4)$ is equivalent to the CNOT gate up to single-qubit rotations. To characterize the deviation from the ideal gate, we compute the average gate fidelity over different initial qubit states and a thermal distribution of the phonon states. For small deviation from the ideal case, we have [47]
$$\delta F = \frac{4}{5} \left[ \left( \Theta_{ij} \mp \frac{\pi}{4} \right)^2 + \sum_{jk} |\alpha_j^k|^2 (2\bar{n}_k + 1) \right], \quad (8)$$
where $\bar{n}_k$ is the average phonon number in the k-th mode.
Up to this point, the formulation is general and we can apply amplitude, frequency, or phase modulations [18–20] of the driving field to optimize the gate fidelity. For concreteness, below we will focus on a specific method of amplitude modulation to optimize the gate performance.
Let us set the driving fields on the two ions to be the same and divide the gate time $\tau$ into $n_{\text{seg}}$ equal segments. In each segment, we set the Rabi frequency on the two ions to be a constant. Define a real column vector $\mathbf{\Omega} = (\Omega_1, \Omega_2, \cdots, \Omega_{n_{\text{seg}}})^T$ corresponding to the Rabi frequency of each segment, and we get
$$\alpha_i^k(\tau) = A_i^k \mathbf{\Omega}, \quad \Theta_{ij} = \mathbf{\Omega}^T \mathbf{\gamma}' \mathbf{\Omega},$$
(9)
where $A_{j}^{k}$ is a row vector whose nth component is
$$A_j^k(n) = -i\eta_k b_j^k \int_{(n-1)\tau/n_{\text{seg}}}^{n\tau/n_{\text{seg}}} \sin \mu t \, e^{i\omega_k t} dt, \qquad (10)$$
and $\mathbf{y}'$ is an $n_{\text{seg}}$ by $n_{\text{seg}}$ matrix with the (p, q) component given by
$$\gamma'(p,q) = \begin{cases} 2\sum_{k} \eta_{k}^{2} b_{i}^{k} b_{j}^{k} \int_{(p-1)\tau/n_{\text{seg}}}^{p\tau/n_{\text{seg}}} dt_{1} \int_{(q-1)\tau/n_{\text{seg}}}^{q\tau/n_{\text{seg}}} dt_{2} \sin \mu t_{1} \sin \mu t_{2} \sin[\omega_{k}(t_{1}-t_{2})] & (p>q) \\ 2\sum_{k} \eta_{k}^{2} b_{i}^{k} b_{j}^{k} \int_{(p-1)\tau/n_{\text{seg}}}^{p\tau/n_{\text{seg}}} dt_{1} \int_{(p-1)\tau/n_{\text{seg}}}^{t_{1}} dt_{2} \sin \mu t_{1} \sin \mu t_{2} \sin[\omega_{k}(t_{1}-t_{2})] & (p=q) \\ 0 & (p(11)$$
<span id="page-2-0"></span>By suitably scaling $\Omega$ , we can always set $\Theta_{ij} = \pm \pi/4$ . Then the gate infidelity can be approximated as
$$\delta F = \frac{4}{5} \mathbf{\Omega}^T M \mathbf{\Omega}, \tag{12}$$
where $M \equiv \sum_{jk} A_j^{k\dagger} A_j^k (2\bar{n}_k + 1)$ . By definition, M is a Hermitian matrix, but actually we can express it in a real symmetric form since $\Omega^T M \Omega = \Omega^T \text{Re}[M] \Omega$ . Similarly we can define a symmetric matrix $\gamma \equiv (\gamma' + \gamma'^T)/2$ such that $\Theta_{ij} = \Omega^T \gamma' \Omega = \Omega^T \gamma \Omega$ .
To optimize the gate fidelity, we minimize $\Omega^T M \Omega$ under the constraint $\Omega^T \gamma \Omega = \pm \pi/4$ . We can introduce a Lagrange multiplier and consider the optimization of $f(\Omega, \lambda) = \Omega^T M \Omega - \lambda (\Omega^T \gamma \Omega \mp \pi/4)$ as
$$M\Omega - \lambda \gamma \Omega = 0, \quad \Omega^T \gamma \Omega = \pm \pi/4.$$
(13)
This is a generalized eigenvalue problem. We can solve its eigenvalue with the smallest absolute value and the corresponding eigenvector, which, after suitable normalization, gives us the optimal $\Omega$ .
Let us now briefly discuss how this gate scheme can be generalized to a general 3D ion crystal, which will be expanded in more detail in the following sections. One straightforward generalization is that we shall replace the transverse normal modes in Eq. (2) by all the normal modes in the 3D crystal, since the motions in different directions are coupled together. However, there are more differences between the 1D and the 3D cases. For the linear configuration, the trap can be designed such that the ions align on the null of the radio frequency (rf) field without micromotion. The ions thus stay at their equilibrium positions and the small perturbation can be well approximated by the normal modes in a harmonic pseudopotential. On the other hand, in a 3D ion crystal it is generally not possible to suppress the micromotion of all the ions. Then the equilibrium solution is not a static configuration of the ions, but a finite oscillation at the RF frequency for all the ions. Such an oscillation can be absorbed into $\varphi_i$ in Eq. (1) as a time-dependent motional phase for each ion. Moreover, when the amplitudes of these equilibrium trajectories are comparable to the width of the laser beams, the Rabi frequency $\Omega_i$ will also be time dependent. Finally, the normal mode expansions in Eq. (2) will generally also include the micromotion at the RF frequency, which need to be considered in the evaluation of $\alpha_i^k$ [Eq. (6)] and $\Theta_{ij}$ [Eq. (7)].
# III. EQUILIBRIUM TRAJECTORIES AND NORMAL MODES UNDER MICROMOTION
As mentioned above, to design the entangling gate, first we need to solve the equilibrium trajectories of the ions and the collective normal modes for small deviation away from them. Important works on this topic have been performed in Refs. [42,43] which are most suitable for a few ions to the lowest orders of the micromotion. In this section, we briefly review these results and generalize them to an efficient numerical algorithm that can work for hundreds of ions and to the arbitrary orders of micromotion.
For convenience, we define the length unit $L_0 = (e^2/4\pi \epsilon_0 m \omega_{\rm rf}^2)^{1/3}$ and the time unit $T_0 = 2/\omega_{\rm rf}$ . Then we can consider the dimensionless equation of motion (EOM) of N
ions
$$\ddot{R}_{i\sigma} + \sum_{\rho} (A_{\sigma\rho} - 2Q_{\sigma\rho}\cos 2t)R_{i\rho} - 4\sum_{j\neq i} \frac{R_{i\sigma} - R_{j\sigma}}{\left[\sum_{\rho} (R_{i\rho} - R_{j\rho})^2\right]^{\frac{3}{2}}} = 0,$$
(14)
where $i, j = 1, 2, \cdots, N$ corresponds to each ion and $\sigma, \rho = x, y, z$ for the three spatial directions. The first two terms correspond to the well-known Mathieu equation for a single ion in an RF trap, while the third term describes the Coulomb interaction between different ions with the motions in different directions coupled together. In the previous works (e.g., Refs. [8,42]), it is usually assumed for convenience that the principal axes of the DC and the RF fields coincide, so A and Q matrices are diagonal in the same frame. Since this assumption may not hold for some trap designs, here we choose to work with the more general case.
## A. Periodic equilibrium solutions
The potential in Eq. (14) has a period of $\pi$ in the dimensionless form, it is thus reasonable to expect a solution with $\pi$ period as well [42], that is, a micromotion at the rf frequency. To find such a stable periodic solution, we can start from some random initial configuration, time-evolve the system under a weak damping term [a $-\gamma \dot{R}_{i\sigma}$ term on the right-hand side of Eq. (14)], and gradually turn down the damping until the system reaches a stable solution. Similar to the case of a static potential, there can be multiple stable solutions to Eq. (14). Note that the process of gradually reducing the damping term closely mimic the cooling stage of the ions in a real trap. Thus we expect the solution found in this way to reflect the one obtained in the experiment with high probability.
This method works well for a small number of ions, but difficulty appears as the ion number increases: to approach the desired solution, we need to reduce the damping term $\gamma$ , which in turn slows down the convergence and requires smaller step sizes in the time evolution to suppress the numerical errors. This motivates us to consider the solution to Eq. (14) directly without the damping term.
Following Ref. [42], we expand the equilibrium solution with the period of $\pi$ into a Fourier series
$$R_{j\sigma}^{\pi}(t) = \sum_{n=-\infty}^{+\infty} B_{2n,j\sigma} e^{i2nt}.$$
(15)
Note that due to the time-reversal symmetry of Eq. (14), we have $B_{2n,j\sigma} = B_{-2n,j\sigma} = B_{2n,j\sigma}^*$ . Therefore all the expansion coefficients are real.
Since $R_{i\sigma}^{\pi}(t)$ has a period of $\pi$ , so does any function of the coordinates. Therefore, the Coulomb interaction term in Eq. (14) can also be expanded into a Fourier series:
$$D_{i\sigma}^{\pi}(t) \equiv 4 \sum_{j \neq i} \frac{R_{i\sigma}^{\pi}(t) - R_{j\sigma}^{\pi}(t)}{\left\{ \sum_{\rho} \left[ R_{i\rho}^{\pi}(t) - R_{j\rho}^{\pi}(t) \right]^{2} \right\}^{3/2}}$$
$$= \sum_{n = -\infty}^{+\infty} D_{2n,i\sigma} e^{i2nt}. \tag{16}$$
<span id="page-3-0"></span>On the other hand, from the definition, we also have [42]
$$D_{i\sigma}^{\pi}(t) = 4\sum_{i} G_{ij}^{\pi}(t) R_{j\sigma}^{\pi}(t), \tag{17}$$
where
$$G_{ij}^{\pi}(t) \equiv \delta_{ij} \sum_{k \neq i} \frac{1}{\left\{ \sum_{\rho} \left[ R_{i\rho}^{\pi}(t) - R_{k\rho}^{\pi}(t) \right]^{2} \right\}^{3/2}} - (1 - \delta_{ij}) \frac{1}{\left\{ \sum_{\rho} \left[ R_{i\rho}^{\pi}(t) - R_{j\rho}^{\pi}(t) \right]^{2} \right\}^{3/2}} = \sum_{n = -\infty}^{+\infty} G_{2n,ij} e^{i2nt}.$$
(18)
These expansions are used in Ref. [42] to analyze the properties of the micromotion assuming small Mathieu parameters (elements of A and Q matrices). Here we generalize these equations to find the numerical solutions.
Plugging these expansions into Eq. (14) with a suitable division of the Coulomb interaction term into the above two alternative forms, we get a recurrence relation
$$\sum_{\rho} [(A_{\sigma\rho} - 4n^2 \delta_{\sigma\rho}) B_{2n,i\rho} - Q_{\sigma\rho} (B_{2n-2,i\rho} + B_{2n+2,i\rho})] + 4\alpha \sum_{m,j} G_{2n-2m,ij} B_{2m,j\sigma} = (1+\alpha) D_{2n,i\sigma},$$
(19)
where the index m runs over all the orders of Fourier series, while the $\alpha$ -dependent terms on the two sides cancel each other for a periodic solution.
For a desired accuracy of the solution, suppose we can truncate at some finite order of the Fourier series. Then Eq. (19) is a system of linear equations for $\{B_{2n,i\sigma}\}$ and can be solved iteratively: We can use the old solution of $\{B_{2n,i\sigma}\}$ to calculate $\{D_{2n,i\sigma}\}$ and $\{G_{2n,i\sigma}\}$ and then find the new solution of $\{B_{2n,i\sigma}\}$ . The simplest case is to set $\alpha=0$ . Unfortunately, numerically we find that in this case the solution is unstable: if we start from an approximate solution, it will deviate further and further away after iterations. The reason is that for the leading order term $B_{0,i\sigma}$ , we have n=0 and thus its coefficient is a small parameter. When computing the new solution from the old one, we take the inverse of these small parameters and therefore the error gets enlarged.
The above analysis suggests that we need large $\alpha$ for the iterative method to converge. Numerically we find that $\alpha \geqslant 1$ leads to convergence around the periodic solution, if we start from the approximate solution we found with a weak damping term. Note that if in $B_{2n,i\sigma}$ we truncate at $n=\pm M$ , then in $G_{2n,ij}$ we need to truncate at $n=\pm 2M$ .
## B. Normal modes
Having solved the equilibrium trajectories $\{R_{i\sigma}^{\pi}(t)\}$ of the ions, now we consider small perturbation around them and decompose them into collective normal modes. Let us first derive the EOM for a small deviation. Following Ref. [42], we define a matrix function K(t) whose
elements are
$$K_{i\sigma,j\tau}(t) = \begin{cases} -3\frac{(R_{i\sigma}^{\pi} - R_{j\sigma}^{\pi})(R_{i\tau}^{\pi} - R_{j\tau}^{\pi})}{[\sum_{\rho}(R_{i\rho}^{\pi} - R_{j\rho}^{\pi})^{2}]^{5/2}} & (i \neq j, \sigma \neq \tau) \\ \frac{[\sum_{\rho}(R_{i\rho}^{\pi} - R_{j\rho}^{\pi})^{2}]^{-3}(R_{i\sigma}^{\pi} - R_{j\sigma}^{\pi})^{2}}{[\sum_{\rho}(R_{i\rho}^{\pi} - R_{j\rho}^{\pi})^{2}]^{5/2}} & (i \neq j, \sigma = \tau) \\ 3\sum_{k\neq i}\frac{(R_{i\sigma}^{\pi} - R_{k\sigma}^{\pi})(R_{i\tau}^{\pi} - R_{k\tau}^{\pi})}{[\sum_{\rho}(R_{i\rho}^{\pi} - R_{k\rho}^{\pi})^{2}]^{5/2}} & (i = j, \sigma \neq \tau) \\ -\sum_{k\neq i}\frac{[\sum_{\rho}(R_{i\rho}^{\pi} - R_{k\rho}^{\pi})^{2}]^{-3}(R_{i\sigma}^{\pi} - R_{k\sigma}^{\pi})}{[\sum_{\rho}(R_{i\rho}^{\pi} - R_{k\rho}^{\pi})^{2}]^{5/2}} & (i = j, \sigma = \tau) \end{cases}$$
$$(20)$$
as the time-dependent Hessian matrix of the Coulomb interaction. In the above equation, the t dependence of $R^{\pi}_{i\sigma}$ is omitted for simplicity. Now we have the linear EOM for small perturbation $r_{i\sigma}$ around the periodic crystal solution:
$$\ddot{r}_{i\sigma} + \sum_{\rho} (A_{\sigma\rho} - 2Q_{\sigma\rho}\cos 2t)r_{i\rho} + 4\sum_{j\rho} K_{i\sigma,j\rho}(t)r_{j\rho} = 0.$$
(21)
Because K(t) also has a period of $\pi$ , we can expand it as
$$K(t) = K_0 - 2K_2 \cos 2t - 2K_4 \cos 4t - \cdots$$
(22)
If we absorb $K_0$ and $K_2$ into the definition of A and Q matrices and neglect the higher order terms (we will later describe how the higher order terms can be included), Eq. (21) can be written in the vector form (the vectorial Mathieu equation)
$$\ddot{\mathbf{r}} + (\mathbf{A} - 2\mathbf{Q}\cos 2t)\mathbf{r} = 0, \tag{23}$$
where r is a 3N by 1 column vector.
Consider a normal mode at the dimensionless frequency $\beta$ (modulated by micromotion at the RF frequency). Following Ref. [42], such a solution can be expanded as
$$r = \sum_{n=-\infty}^{+\infty} C_{2n} [ce^{i(2n+\beta)t} + c^* e^{-i(2n+\beta)t}].$$
(24)
Here the real 3N by 1 vector $C_{2n}$ is the generalized mode vector and c is a complex amplitude. Now our task is to determine all the mode frequencies $\beta$ 's. An imaginary $\beta$ means instability, while all $\beta$ 's being real corresponds to oscillatory behavior.
We define $\mathbf{R}_{2n} \equiv \mathbf{A} - (2n + \beta)^2 \mathbf{I}$ , where $\mathbf{I}$ is the identity matrix. Plugging these expressions into Eq. (23), we get a recurrence relation
$$QC_{2n-2} = R_{2n}C_{2n} - QC_{2n+2}. (25)$$
Further applying the infinite continued matrix inversion method [43], the normal mode frequencies are finally determined by
$$\det \left[ \mathbf{P}_2(\beta) - \mathbf{Q} \mathbf{P}_1(\beta) \mathbf{Q} \right] = 0, \tag{26}$$
with $C_0$ the eigenvector of $P_2 - QP_1Q$ corresponding to the eigenvalue of zero, while
$$P_1(\beta) \equiv \{R_2 - Q[R_4 - Q(R_6 - \cdots)^{-1}Q]^{-1}Q\}^{-1}$$
(27)
and
$$P_2(\beta) \equiv R_0 - Q[R_{-2} - Q(R_{-4} - \cdots)^{-1}Q]^{-1}Q$$
(28)
<span id="page-4-0"></span>are two matrices dependent on $\beta$ and can be evaluated by truncating at some large value of |n|.
Note that $\det(P_2 - QP_1Q)$ is just a numerical function of $\beta$ . Therefore, to solve all the normal modes, in principle we only need to find all the roots of this function numerically, as done in Refs. [42,43]. However, for large ion number N, the separation between these 3N roots is small and it is difficult to solve all of them without any *a priori* knowledge about their distribution. Moreover, some of the $\beta$ 's may be imaginary for an instable crystal solution, which makes the numerical search even harder. Also note that when writing down Eq. (23), we have neglected higher order terms in Eq. (22). The effect of the $K_4$ term is considered in Ref. [43], but the method is difficult to generalize to higher order terms. Now we describe a new method that can be efficiently applied to a large number of ions and can include arbitrarily high order terms.
In general, we can rewrite Eq. (21) as
$$\ddot{r} + (A - 2O\cos 2t - 2O_4\cos 4t - \cdots)r = 0,$$
(29)
with $Q_{2n} = 4K_{2n}$ ( $n \ge 2$ ) from the Fourier expansion of K(t) [Eq. (22)]. Again we have absorbed $K_0$ and $K_2$ into the definition of A and O.
Using the expansion of Eq. (24), we get a general recurrence relation
$$R_{2n}C_{2n} = Q(C_{2n-2} + C_{2n+2}) + Q_4(C_{2n-4} + C_{2n+4}) + Q_6(C_{2n-6} + C_{2n+6}) + \cdots,$$
(30)
where again $\mathbf{R}_{2n} \equiv \mathbf{A} - (2n + \beta)^2 \mathbf{I}$ .
If we truncate these equations at the order of $\pm n$ , we can assemble them into a matrix form
$$\begin{pmatrix} \mathbf{R}_{-2n} & -\mathbf{Q} & -\mathbf{Q}_{4} & \cdots & 0 & 0 & 0 \\ -\mathbf{Q} & \mathbf{R}_{-2n+2} & -\mathbf{Q} & \cdots & 0 & 0 & 0 \\ -\mathbf{Q}_{4} & -\mathbf{Q} & \mathbf{R}_{-2n+4} & \cdots & 0 & 0 & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots \\ 0 & 0 & 0 & \cdots & \mathbf{R}_{2n-4} & -\mathbf{Q} & -\mathbf{Q}_{4} \\ 0 & 0 & 0 & \cdots & -\mathbf{Q} & \mathbf{R}_{2n-2} & -\mathbf{Q} \\ 0 & 0 & 0 & \cdots & -\mathbf{Q}_{4} & -\mathbf{Q} & \mathbf{R}_{2n} \end{pmatrix} \begin{pmatrix} \mathbf{C}_{-2n} \\ \mathbf{C}_{-2n+2} \\ \mathbf{C}_{-2n+4} \\ \vdots \\ \mathbf{C}_{2n-4} \\ \mathbf{C}_{2n-2} \\ \mathbf{C}_{2n} \end{pmatrix} = 0,$$
(31)
where $Q_{2n}$ 's can be truncated at some different order m, which is not shown explicitly in the above equation. Note that the diagonal blocks $\{R_{2n}\}$ of this matrix depend on $\beta$ . Again a normal mode frequency $\beta$ is a root of the determinant of this matrix, and the mode vector is given by the corresponding eigenvector with the eigenvalue of zero.
The direct search of $\beta$ suffers the same numerical difficulty as mentioned before. Instead, we observe that if we have an approximate mode frequency $\beta$ , the above matrix should have an eigenvalue close to zero. Therefore, we start from an approximate solution and solve the eigenvalue $\Delta$ closest to zero. Note that the diagonal blocks of this matrix $\mathbf{R}_{2n} = \mathbf{A} - (2n+\beta)^2\mathbf{I} = \mathbf{A} - (4n^2+4n\beta)\mathbf{I} - \beta^2\mathbf{I}$ have a common $-\beta^2\mathbf{I}$ term in the diagonal, which can be combined with the small nonzero eigenvalue $\Delta$ . That is, we update $\beta$ by $\sqrt{\beta^2 + \Delta}$ and then repeat the above process. The iterations will quickly converge such that $\Delta \to 0$ . In the case of degeneracy of, say, two normal modes, we can similarly look for the two eigenvalues with the smallest absolute values and the corresponding eigenvectors, and use the desired one for the next iteration.
To efficiently apply the above method, it is desirable to have a complete set of approximate normal modes to start with. Therefore here we describe a simple approximate solution based on Eq. (26). Consider small elements of the A and Q matrices [after absorbing $K_0$ and $K_2$ as in Eq. (23)], and we expect the mode frequencies $\beta$ also to be small. Now we consider the following expansion for $n \neq 0$ :
$$\mathbf{R}_{2n}^{-1} = [\mathbf{A} - (2n+\beta)^2]^{-1} = (\mathbf{A} - 4n^2 - 4n\beta - \beta^2)^{-1}$$
$$\approx -\frac{1}{4n^2} \left( 1 - \frac{\beta}{n} - \frac{\beta^2 - \mathbf{A}}{4n^2} + \frac{\beta^2}{n^2} \right), \tag{32}$$
where we have omitted the identity matrix I for simplicity. We also have
$$P_1 \approx [R_2 - QR_4^{-1}Q]^{-1} \approx R_2^{-1} + R_2^{-1}QR_4^{-1}QR_2^{-1}$$
(33)
and
$$P_{2} \approx R_{0} - Q[R_{-2} - QR_{-4}^{-1}Q]^{-1}Q$$
$$\approx R_{0} - QR_{-2}^{-1}Q - QR_{-2}^{-1}QR_{-4}^{-1}QR_{-2}^{-1}Q.$$
(34)
Therefore,
$$T \equiv P_2 - QP_1Q$$
$$\approx A + \frac{1}{2}Q^2 + \frac{1}{8}QAQ + \frac{1}{128}Q^4 - \beta^2 \left(1 - \frac{3}{8}Q^2\right).$$
(35)
Because $C_0$ satisfies $TC_0 = 0$ , all the normal modes are now given by a generalized eigenvalue problem
$$\left(A + \frac{1}{2}Q^2 + \frac{1}{8}QAQ + \frac{1}{128}Q^4\right)C_0 = \beta^2 \left(1 - \frac{3}{8}Q^2\right)C_0.$$
(36)
To describe the normal modes to the same order of approximation we include oscillations at the multiples of the RF frequency, which are given by
$$C_{\pm 2} = (R_{\pm 2} - QR_{\pm 4}^{-1}Q)^{-1}QC_0 \approx -\frac{1}{4}(1 \mp \beta)QC_0,$$
(37)
$$C_{\pm 4} = R_{\pm 4}^{-1} Q C_{\pm 2} \approx \frac{1}{64} \left( 1 \mp \frac{3}{2} \beta \right) Q^2 C_0.$$
(38)
Finally, we want to mention that we have been considering quadrupole traps in the above derivations (represented by <span id="page-5-0"></span>the A and Q matrices). By exploring symmetries in the trap design, octupole, or even higher-order multipole traps can be achieved, which have been used to trap large ion crystals [49]. These trapping forces oscillating at the multiples of the RF frequency can be treated in a similar way as the nonlinear Coulomb interaction in the above expressions and therefore our method is still applicable.
## C. Quantization of normal modes
Having solved all the 3N normal mode frequencies $\beta_k$ and the mode vectors $C_{2n}^{(k)}$ , finally we want to quantize them to design the entangling gate. In this section, we recover the dimensions of the variables. In analog to the quantum harmonic oscillators, we can decompose the position and momentum operators of the N ions as [8]
$$\hat{\boldsymbol{r}}(t) = \sum_{k} \sqrt{\frac{\hbar}{2m\omega_k}} [\hat{a}_k \boldsymbol{u}^{(k)*}(t) + \hat{a}_k^{\dagger} \boldsymbol{u}^{(k)}(t)], \qquad (39)$$
and
$$\hat{\boldsymbol{p}}(t) = \sum_{k} \sqrt{\frac{\hbar m}{2\omega_{k}}} [\hat{a}_{k} \dot{\boldsymbol{u}}^{(k)*}(t) + \hat{a}_{k}^{\dagger} \dot{\boldsymbol{u}}^{(k)}(t)], \tag{40}$$
where
$$\mathbf{u}^{(k)}(t) = \sum_{n=-\infty}^{+\infty} C_{2n}^{(k)} e^{i(n\omega_{\rm rf} + \omega_k)t}$$
(41)
is a solution to Eq. (21) we get in Sec. III B with the time dimension recovered. $\omega_k = \beta_k \omega_{\rm rf}/2$ is the frequency of the kth mode and $\hat{a}_k$ and $\hat{a}_k^{\dagger}$ are the annihilation and creation operators. What remains to be determined is the normalization of $C_{2n}^{(k)}$ , which is fixed by the commutation relations $[\hat{r}_{i\sigma}(0), \hat{p}_{j\rho}(0)] = i\hbar \delta_{ij} \delta_{\sigma\rho}$ and $[\hat{a}_k, \hat{a}_l^{\dagger}] = \delta_{kl}$ . According to Ref. [43], we need
$$\sum_{n} (2n + \beta_k) C_{2n}^{(k)T} \sum_{m} C_{2m}^{(l)} = \beta_k \delta_{kl}.$$
(42)
Actually, the orthogonal condition is already satisfied from our solution in Sec. III B; here we just need $\sum_{n}(2n + \beta_{k})C_{2n}^{(k)T}\sum_{m}C_{2m}^{(k)} = \beta_{k}$ $(k = 1, 2, \dots, 3N)$ for normalization.
## IV. GATE SCHEME IN 3D
Having solved the equilibrium trajectories and the normal modes of the ions, now we can consider the gate design. Recall that, without micromotion, the optimization of the entangling gate is achieved by minimizing the residual entanglement to the phonon modes [Eq. (6)],
$$\alpha_j^k(\tau) = -\frac{i}{\hbar} \eta_k \int_0^{\tau} b_j^k \chi_j(t) e^{i\omega_k t} dt, \tag{43}$$
while maintaining the desired two-qubit phase $\Theta_{ij} = \pm \pi/4$ [Eq. (7)],
$$\Theta_{ij} = \frac{1}{\hbar^2} \sum_{k} \eta_k^2 \operatorname{Im} \left\{ \int_0^{\tau} dt_1 \int_0^{t_1} dt_2 e^{i\omega_k(t_1 - t_2)} \right.$$
$$\times \left.\left[ b_i^k b_j^{k*} \chi_i(t_1) \chi_j(t_2) + b_j^k b_i^{k*} \chi_j(t_1) \chi_i(t_2) \right] \right\}$$
where we have considered the possibility of a complex mode vector $b_i^k$ for reasons that will become clear later, and
$$\chi_i(t) \equiv \hbar\Omega_i(t)\sin(\mu t + \varphi_i) \tag{45}$$
describes the driving field felt by the ion j.
In Sec. II, we consider piecewise-constant $\Omega_j(t)$ . The advantage is that the time integrations above can be performed analytically on each segment. Then the optimization becomes a generalized eigenvalue problem [Eq. (13)], which can be solved efficiently. Note that, strictly speaking, an analytical expression for the time integral is not necessary in the above process. Given a gate time $\tau$ and the number of segments $n_{\text{seg}}$ , we can also evaluate the integral numerically. However, for the highly oscillatory functions we are considering, such a numerical integration requires very high accuracy and is usually slow. In comparison, if we can derive an analytical expression for the integral, its evaluation becomes much faster, which allows efficient optimization of the gate design. This understanding is important for efficient gate design in the general case.
## A. Effects of micromotion
Now we consider the effects of the micromotion on the gate design. As briefly discussed in Sec. II, it appears in the following three aspects.
## 1. Time-dependent motional phase
As we have shown in Sec. III A, the equilibrium trajectories of the ions are oscillating at the RF frequency. In Eq. (1), it appears as a (classical) oscillating phase in the form of $\Delta k \cdot R_j(t)$ where $R_j(t) = [R_{jx}^{\pi}(t), R_{jy}^{\pi}(t), R_{jz}^{\pi}(t)]^T$ is the equilibrium trajectory of the ion j. We can absorb it into the motional phase $\varphi_j$ for each ion in Eq. (45) with a period of $2\pi/\omega_{\text{rf}}$ . Hence we have the Fourier expansion
$$\varphi_j(t) = \sum_{l=0}^{\infty} \varphi_j^{(l)} \cos l\omega_{\rm rf} t, \tag{46}$$
where the superscript l represents the lth order of expansion. Note that by definition, $\varphi_j(t)$ follows the same time-reversal symmetry as $R^{\pi}_{j\sigma}(t)$ , so in the Fourier series only the cosine terms survive. Also, $\varphi_j(t)$ 's depend not only on the amplitude of the micromotion, but also on its angle with the direction of $\Delta k$ .
#### 2. Time-dependent complex normal modes
The micromotion also leads to high-frequency modulation on each normal mode, as shown in Sec. III B. From Eqs. (2) and (39), we observe that $b_j^k e^{i\omega_k t}$ is now replaced by $\boldsymbol{u}^{(k)}(t)$ , that is,
$$b_j^k \to \sum_{n=-\infty}^{+\infty} \mathbf{m} \cdot \mathbf{C}_{2n,j}^{(k)} e^{in\omega_{\text{rf}}t}, \tag{47}$$
where m is a unit vector along the direction of $\Delta k$ and $C_{2n,j}^{(k)} = [C_{2n,jx}^{(k)}, C_{2n,jy}^{(k)}, C_{2n,jz}^{(k)}]^T$ . This gives a time-dependent multiplicative factor in the integration in $\alpha_j^k$ [Eq. (43)] and $\Theta_{ij}$ [Eq. (44)], but because it is a trigonometric function, an analytical expression is still easy to obtain. Also note that our
<span id="page-6-0"></span>expression for $\Theta_{ij}$ in Sec. II [Eq. (7)] is derived for a real mode vector. For the complex mode vector here, Eq. (44) should be used instead.
#### 3. Time-dependent modulation of laser intensity
If the micromotion has a component perpendicular to the direction of the laser beam, it will also lead to a variation in the laser intensity felt by the ion during the gate. This becomes important if the amplitude of the micromotion is greater than or comparable to the width of the laser beam. Mathematically it is described by a time-dependent effective Rabi frequency $\Omega_i(t)$ in Eq. (45) oscillating at the RF frequency. Given the spatial power distribution of the driving laser and the equilibrium trajectories of the ions, these terms can be computed and again can be expanded into a Fourier series. Therefore again they are multiplicative trigonometric functions and can be treated in the same way as the time-dependent normal modes. We will not consider this effect below for simplicity, which corresponds to a small micromotion amplitude compared with the width of the driving laser beam for individual addressing, or a beam that follows the equilibrium micromotion of the ions.
## B. Series expansion for evaluating highly oscillatory functions
As mentioned above, to efficiently design the gate, we want analytical expressions for Eqs. (43) and (44) with piecewise constant $\Omega_i(t)$ on arbitrary intervals.
The last two effects of micromotion we described are not difficult to treat because for them the integrand is still the product of trigonometric functions, and therefore simple analytical expressions exist. On the other hand, the first effect of a time-dependent motional phase, even if only expanded to the first order, will give us something like $\cos(\varphi^{(1)}\cos\omega_{\rm rf}t)$ whose analytical integral on a general time interval is not known. Without such an analytical expression, we will have to numerically integrate highly oscillating functions, which significantly increases the computational cost.
As hinted by Ref. [50], this problem can be solved by a series expansion of the motional phase. For each expansion term, we can still derive an analytical expression, while the overall errors can be systematically suppressed by considering higher order terms. At the essence of our algorithm is the following formula [51]:
$$\exp(i\varphi\cos\omega t) = J_0(\varphi) + 2\sum_{n=1}^{\infty} i^n J_n(\varphi)\cos(n\omega t). \tag{48}$$
Note that for $0 < \varphi \ll \sqrt{n+1}$ , we have
$$J_n(\varphi) \sim \frac{1}{n!} \left(\frac{\varphi}{2}\right)^n,$$
(49)
thus the high-order terms vanish quickly as n increases, and we can expect a fast convergence.
#### C. Residual spin-phonon coupling
For the $\alpha_j^k$ terms [Eq. (43)], we want to derive an analytical expression for the integral
$$\int dt \sum_{n=-\infty}^{+\infty} C_{2n,j\sigma}^{(k)} e^{in\omega_{\text{rf}}t} \sin\left(\mu t + \sum_{l=0}^{\infty} \varphi_j^{(l)} \cos l\omega_{\text{rf}}t\right) e^{i\omega_k t}.$$
(50)
Because $C_{2n}^{(k)}$ decreases quickly with |n| (for small Mathieu q parameters, that is, elements of the Q matrix), we can truncate the summation over n at small $\pm n_{\rm cut}$ .
Note that we can regard $n\omega_{\rm rf} + \omega_k$ as a new variable $\omega$ in the above expression. Then once we derive an analytical expression as a function of $\omega$ , we immediately get the results for all the orders of n by plugging in the value of $n\omega_{\rm rf} + \omega_k$ . Therefore, we only need to consider
$$\int dt \sin\left(\mu t + \sum_{l=0}^{\infty} \varphi_j^{(l)} \cos l\omega_{\rm rf} t\right) e^{i\omega t}$$
$$= \frac{1}{2i} \int dt \left[ e^{i(\mu t + \varphi_j^{(0)})} \prod_{l=1}^{\infty} e^{i\varphi_j^{(l)} \cos l\omega_{\rm rf} t} - \text{c.c.} \right] e^{i\omega t}. \quad (51)$$
We can now expand $\exp(i\varphi_j^{(l)}\cos l\omega_{rf}t)$ into cosine functions using Eq. (48). Suppose the $\varphi_j^{(1)}$ , $\varphi_j^{(2)}$ , $\cdots$ terms are expanded to the order of $n_1$ , $n_2$ , $\cdots$ , respectively. Then one term of the integral becomes
$$\int dt e^{i(\mu t + \varphi_j^{(0)})} e^{i\omega t} \cos(n_1 \omega_{\rm rf} t) \cos(2n_2 \omega_{\rm rf} t) \cdots, \qquad (52)$$
with the coefficient $\prod_l 2i^{n_l}J_{n_l}(\varphi_j^{(l)})$ (for a term with $n_l=0$ the coefficient is smaller by one half). Then we sum over all possible $\{n_1, n_2, \cdots\}$ to get the total integral. The other half of Eq. (51) for the complex conjugate can be computed similarly. We just need to replace $\mu$ and $\varphi_j^{(0)}$ in Eq. (52) by $-\mu$ and $-\varphi_j^{(0)}$ , and to take the complex conjugate of the corresponding coefficients.
It seems that the number of terms to be evaluated is exponentially large, so that even if we have analytical expressions for Eq. (52) and the evaluation of a single term is fast, the overall time cost is still high. Fortunately, in the small q regime typical for current ion trap quantum computing experiments, the micromotion amplitude decreases quickly with the order of expansion, so that $\varphi_i^{(l)}$ will be close to zero for large l. For such terms, we have $\exp(i\varphi_j^{(l)}\cos l\omega_{\rm rf}t)\approx 1$ , so discarding them has negligible effects on the integrand of Eq. (51). Therefore, we can truncate at $l \leq L$ for some small L in Eq. (52). Even for the remaining $\varphi_j^{(l)}$ terms, the corresponding coefficients $J_{n_l}(\varphi_i^{(l)})$ quickly vanish for large $n_l$ , so the number of terms we need to evaluate is small. Note that all the truncations described above can be performed according to a chosen error tolerance, say, $10^{-8}$ , and the accuracy can be systematically improved by including higher order terms.
What remains is to evaluate Eq. (52) for up to L cosine functions. For a given L, an analytical expression for this integral is possible, but it can be complicated even for moderate L and in particular can be difficult for coding. Therefore we further split each cosine function into two exponential functions using $\cos x = (e^{ix} + e^{-ix})/2$ . In this way, Eq. (52)
<span id="page-7-0"></span>finally turns into at most $2^L$ integrals of exponential functions, whose analytical expressions are simple. Since the truncation L is typically small and we do not need to split for the lth term if $n_l = 0$ , this algorithm gives a good balance between the time cost of programming and that of running.
### D. Two-qubit rotation angle
For the $\Theta_{ij}$ terms [Eq. (44)], we want to derive an analytical expression for
$$\int dt_1 \int dt_2 e^{i\omega_k(t_1 - t_2)} \sum_{n,m = -\infty}^{+\infty} C_{2n,i\rho}^{(k)} e^{in\omega_{rf}t_1} C_{2m,j\sigma}^{(k)} e^{-im\omega_{rf}t_2}$$
$$\times \sin\left(\mu t_1 + \sum_{l_1 = 0}^{\infty} \varphi_i^{(l_1)} \cos l_1 \omega_{rf} t_1\right)$$
$$\times \sin\left(\mu t_2 + \sum_{l_2 = 0}^{\infty} \varphi_j^{(l_2)} \cos l_2 \omega_{rf} t_2\right)$$
(53)
for one term in Eq. (44), and the other term can be obtained by exchanging i and j.
Recall that in Eq. (11), we need two types of integral limits:
$$\int_{(p-1)\tau/n_{\text{seg}}}^{p\tau/n_{\text{seg}}} dt_1 \int_{(q-1)\tau/n_{\text{seg}}}^{q\tau/n_{\text{seg}}} dt_2 \text{ and } \int_{(p-1)\tau/n_{\text{seg}}}^{p\tau/n_{\text{seg}}} dt_1 \int_{(p-1)\tau/n_{\text{seg}}}^{t_1} dt_2.$$
(54)
For the first type, the integrations over $t_1$ and $t_2$ are separable and are exactly what we have solved for the $\alpha_j^k$ terms. The remaining problem is just the second type.
Following the derivations for the $\alpha_j^k$ terms, we define new variables $\omega_1 = \omega_k + n\omega_{\rm rf}$ and $\omega_2 = \omega_k + m\omega_{\rm rf}$ , split the sine function into two exponential functions, and expand $\exp(\pm i\varphi_j^{(l)}\cos l\omega_{\rm rf}t)$ using Eq. (48). Now we want an analytical expression for
$$\int dt_{1} \int dt_{2} e^{\pm i(\mu t_{1} + \varphi_{i}^{(0)})} e^{\pm i(\mu t_{2} + \varphi_{j}^{(0)})} e^{i\omega_{1}t_{1}} e^{-i\omega_{2}t_{2}}$$
$$\times \prod_{l_{1}=1}^{L_{1}} \cos(l_{1}n_{l_{1}}\omega_{rf}t_{1}) \prod_{l_{2}=1}^{L_{2}} \cos(l_{2}m_{l_{2}}\omega_{rf}t_{2}). \tag{55}$$
Again we truncate at large values of $L_1$ , $L_2$ and $n_{l_1}$ , $m_{l_2}$ in the expansions and express the cosine functions as the sum of two exponential functions, then analytical formulas for the remaining integrals are simple.
### V. NUMERICAL RESULTS
Finally, we show a numerical example for the whole process from solving the dynamics of the ions to the gate design. Consider $100^{-171} {\rm Yb}^+$ ions in a trap with trapping parameters ${\pmb a} = (-0.015, -0.015, 0.03)$ and ${\pmb q} = (0.3, -0.3, 0)$ (which correspond to diagonal ${\pmb A}$ and ${\pmb Q}$ matrices), and an RF frequency $\omega_{\rm rf} = 2\pi \times 50\,{\rm MHz}$ . The equilibrium trajectories are plotted in Fig. 1 using the numerical methods of Sec. III A. As we can see, in general the ions have large micromotion amplitudes comparable to their separations.
Using the methods described in Sec. III B, we solve all the collective normal modes of the ion crystal under micromotion.
![](_page_7_Figure_16.jpeg)
FIG. 1. Equilibrium trajectories of 100 ions in a trap with a = (-0.015, -0.015, 0.03) and $\mathbf{q} = (0.3, -0.3, 0)$ . The length dimension is $L_0 = (e^2/4\pi\epsilon_0 m\omega_{\rm rf}^2)^{1/3} = 0.20~\mu{\rm m}$ . The two ions colored in blue (labeled 1) and in green (labeled 2) are used in Fig. 2 to compare the solved normal modes with direct molecular dynamics simulation. The two ions colored in red (labeled 3 and 4) are used in Fig. 3 for entangling gates.
Instead of presenting all the 300 modes, in Fig. 2 we plot the response of a particular ion along a particular direction, when two normal modes, the lowest one at $\beta_1 = 0.001340$ and the highest one at $\beta_{300} = 0.3032$ , are selectively excited. In both cases, we see perfect agreement between the prediction of the normal mode expansion (red curves) and the direct numerical results from molecular dynamics (MD) simulation (blue curves), such that their difference (green dashed lines) stay at zero during the simulated time periods. Note that the full MD simulation results correspond to the periodic equilibrium trajectories plus the normal mode expansions, hence the good agreement in Fig. 2 indicates that both our numerical methods in Secs. III A and III B are of high accuracy.
Next we consider the entangling gate between two ions colored in red (labeled as 3 and 4) in Fig. 1. Similar to Ref. [47], we consider counter-propagating Raman laser beams with a wavelength around $\lambda = 355 \,\mathrm{nm}$ in the x direction, and we assume Doppler temperature $k_BT = \hbar\Gamma/2$ where $\Gamma = 2\pi \times$ 20 MHz is the spontaneous emission rate of the <sup>171</sup>Yb<sup>+</sup> ions. Note that in real experiments we may need the two Raman beams to be at an angle to selectively address individual ions at their intersection. For convenience, we set the static motional phase $\varphi_i^{(0)}$ to zero, which can be realized by a suitable phase shift on the path of the laser beams, and only consider the oscillating motional phase $\varphi_j^{(l)}$ $(l \ge 1)$ due to the micromotion. Suppose we use $n_{\text{seg}} = 15$ segments for a total gate time $\tau = 300 \,\mu s$ . The optimal gate infidelity is shown in Fig. 3 as we scan the laser detuning $\mu$ . Due to the increased computational cost under micromotion and the large range of $\mu$ to be scanned over, first we perform a coarse scan in Fig. 3(a) and then a finer scan in the region with potential high gate fidelity in Fig. 3(b). It seems that higher fidelity is possible in the low-frequency end, but here we purposely avoid this region, which may strongly drive the low-frequency soft modes and
<span id="page-8-0"></span>![](_page_8_Figure_2.jpeg)
FIG. 2. Comparison between the computed normal modes and the numerical results from molecular dynamics simulation. The 100-ion crystal we consider is shown in Fig. [1.](#page-7-0) The length unit is *L*<sup>0</sup> = 0.20 μm and each dimensionless RF period π corresponds to 0.02 μs. (a) Evolution of the *x* coordinate of ion 1 (colored in blue in Fig. [1\)](#page-7-0) over 1000 RF periods for a weak excitation of 0.01 in the lowest mode with β<sup>1</sup> = 0.001340. (b) Evolution of the *y* coordinate of ion 2 (colored green in Fig. [1\)](#page-7-0) over 1000 RF periods for a weak excitation of 0.01 in the highest mode with β<sup>300</sup> = 0.3032. In both plots, the blue curve is from direct molecular dynamics simulation using a fourth-order symplectic integrator (see, e.g., Ref. [\[52\]](#page-14-0)), 1000 steps per RF period and *double* precision, the red curve is computed from the normal mode expansions and the green dashed line is their difference. The blue and the red curves almost coincide with each other and can hardly be distinguished in these plots, which suggests that our computed normal modes are accurate for a wide range of spectra over two orders of magnitude. The equilibrium trajectories *R*π *<sup>i</sup>*<sup>σ</sup> (*t*) oscillating at an amplitude of the order *O*(1) is already subtracted from these curves to highlight the small deviation [Eq. [\(21\)](#page-3-0)].
![](_page_8_Figure_4.jpeg)
FIG. 3. (a) Optimal gate infidelity δ*F* for a scan of the laser detuning μ over the whole spectrum of the normal modes of the crystal. Note that this is a coarse scan and the resolution is not enough to show all the structures of the curve. We then zoom in into a region with potential high fidelity. The calculation is performed for a truncation of *L* = 5 for the equilibrium trajectories and *n*cut = 5 for the high-frequency modulation of the normal modes. (b) A zoomed-in scan for a small range of frequencies at the high-frequency end. (We avoid using the low-frequency end, which may be sensitive to the soft modes, even though it seems to have higher theoretical fidelity.) The blue solid curve is optimized for ions' motions truncated at *L* = 5 and *n*cut = 5. The red dashed curve is what we would have gotten using the same optimized laser sequence if we truncated at *L* = 1 and *n*cut = 1, while the upper green curve is that for *L* = 0 and *n*cut = 0, that is, without considering micromotion.
![](_page_8_Figure_6.jpeg)
FIG. 4. The optimized laser pulse sequence -(*t*) for τ = 300 μs, *n*seg = 15, μ = 2π × 7.3124 MHz.
break down the approximations in the gate scheme. Here we have not yet optimized over gate time τ and segment number *n*seg, but as we can see, a high gate fidelity of 99.9% can already be achieved. In Fig. 4, we further show the optimized Rabi frequency -(*t*) at the detuning μ = 2π × 7.3124 MHz [labelled by a black square in Fig. 3(b)]. Note that we have |-(*t*)| < μ so strong excitation of the phonon modes can be avoided [\[47\]](#page-14-0).
In Fig. 3, we assume that the gate starts right at the beginning of an RF period [*t* = 0 in Eq. [\(14\)](#page-2-0)]. If the laser sequence is not locked to the RF signal or if the time resolution is not high enough, the starting point of the gate can locate anywhere in an RF period, which can be a source of errors. In Fig. 5, we plot the gate infidelity versus the initial time *t*<sup>0</sup> using the optimized gate parameters in Fig. 4. As expected, the gate infidelity varies with *t*<sup>0</sup> and returns to the original value after one RF period. The variation is not significant and on average we still have a fidelity of 99.88%.
In Fig. 3(b), we also show a comparison for different truncations of the micromotion. The blue solid curve is computed for a high-order expansion (truncated at *L* = 5 for the equilibrium trajectories and *n*cut = 5 for the high-
![](_page_8_Figure_11.jpeg)
FIG. 5. Gate infidelity δ*F* versus the starting point *t*<sup>0</sup> of the gate during an RF period, using the optimized gate parameters in Fig. 4.
<span id="page-9-0"></span>frequency modulation of the normal modes), while the red dashed curve is to apply the same optimized gate sequence on a hypothetical ion crystal truncated at L=1 and $n_{\rm cut}=1$ . The high-order calculation is about 50 times slower than the lower-order one, with small but noticeable difference in the gate fidelity. We expect the difference to increase for larger crystals and larger micromotion, for which the high-order computation will be necessary. On the other hand, if we apply the same gate sequence on a hypothetical ion crystal with L=0 and $n_{\rm cut}=0$ , that is, without considering micromotion, then the gate infidelity can differ by two orders of magnitude, as shown by the upper green curve. This clearly reveals the nonnegligible effects of micromotion on the gate performance.
As we can see from Fig. 1, in this example, the micromotion along the z direction is much smaller than those in other directions, so we could have gotten much faster convergence had we applied the laser beams in the z direction. This simplification can be used for practical gate design, while here we just want large micromotion to demonstrate our algorithm. Note that the time cost of the algorithm increases linearly with the number of ions (number of normal modes) and linearly with the number of segments (because the bottleneck of the algorithm is the p = q double integral of the two-qubit rotation angle). Also, the scan of the gate parameters can be performed in parallel, and we can first perform a low-order calculation to help locate the parameter regions with potential high gate fidelity. Therefore, even though the design of the gate with micromotion is much slower than that without micromotion, we can still expect it to work for hundreds of ions and hundreds of pulse segments.
### VI. DISCUSSION AND CONCLUSION
In this paper, we mainly focus on the effects of micromotion on the gate design and we obtain a theoretical gate fidelity of about 99.9% in Fig. 3. This fidelity is mainly limited by the use of small segment number $n_{\rm seg}=15$ to suppress the residual entanglement to all the 3N=300 phonon modes, which also exists in earlier works without considering the micromotion [47]. In Fig. 6, we further increase the segment number and observe that the gate infidelity can be reduced to $2\times10^{-5}$ using $n_{\rm seg}=100$ segments. To save some computational resources, for $n_{\rm seg}=100$ we scan the detuning $\mu$ in a more restricted region which is expected to give high gate fidelity from a coarse scan using low-order truncations. With enough control degrees of freedom, the intrinsic gate design error can be made arbitrarily small compared with the other experimental errors.
The robustness against parameter drifts and noise can be studied in the same way as in previous works [47]. Here we would like to mention that the numerical algorithms we describe in this paper are not restricted to the specific method for gate design in Sec. II and can be easily generalized to take certain robustness conditions against parameter drifts into consideration. For example, in Ref. [53] it has been shown that the robustness of the residual spin-phonon entanglement [Eq. (43)] against drift in trap frequency $\omega_k$ can be enforced by requiring the pulse sequence to be symmetric and the time integral of $\alpha_j^k(t)$ over the whole gate sequence to vanish. We can approximately incorporate this criteria into the gate
![](_page_9_Figure_7.jpeg)
FIG. 6. Optimal gate infidelity $\delta F$ for a scan of the laser detuning $\mu$ in the same range as Fig. 3(b) for $n_{\rm seg}=15$ (blue solid curve), $n_{\rm seg}=30$ (red dashed curve) and $n_{\rm seg}=100$ (green dots). For $n_{\rm seg}=100$ , we only scan around the two regions with the highest fidelity to save the computational resource.
design without increasing the complexity of the algorithm (see details in Appendix B). Similarly, we can enforce the robustness of the two-qubit rotation angle [Eq. (44)]. By replacing the optimization conditions with these robustness requirements, we get the pulse sequence presented in Fig. 7(a) using $n_{\text{seg}} = 100$ segments. It can achieve a fidelity above
![](_page_9_Figure_10.jpeg)
FIG. 7. (a) Pulse sequence of $n_{\rm seg}=100$ segments at $\tau=300~\mu{\rm s}$ and $\mu=2\pi\times7.3374$ MHz computed using the method described in Appendix B. (b) Gate infidelity under the detuning drift $\delta\mu$ of $\pm2\pi\times1$ kHz. (c) Gate infidelity under the gate time drift $\delta\tau$ of $\pm0.1~\mu{\rm s}$ . Small fluctuation may be caused by the high-frequency micromotion. (d) Gate infidelity under the fluctuation of $\Omega(t)$ on each segment. Here we assume that each segment is scaled independently by a factor following a Gaussian distribution $N(1,\sigma^2)$ with $\sigma$ up to 1%. Each data point is averaged over 1000 random samples and the positive and the negative parts are symmetric.
<span id="page-10-0"></span>99.9% for $2\pi \times 0.7$ kHz drift in laser detuning, $0.1~\mu s$ shift in gate time, and 1% random fluctuation of the laser amplitude on each segment. We note that these results are comparable to those in Ref. [47] without considering micromotion effects.
To sum up, we have presented a scheme to design entangling gates between two ions in a general ion crystal. The effect of micromotion can be mathematically described as a time-dependent phase of the driving laser, a high-frequency modulation of the laser intensity, and time-dependent mode vectors of ions' collective motional modes. To generalize the gate scheme from a 1D ion chain, first we solve the equilibrium trajectories of the ions for given trapping parameters and then determine the collective normal modes up to arbitrary orders of micromotion. The time integral of the highly oscillatory functions appearing in the gate design is efficiently treated by a series expansion, whose errors can be systematically suppressed by including higher and higher order terms. Numerical examples are also provided to show the functioning of our algorithm. Our work lays the foundation for direct quantum computing on a large 2D or 3D ion crystal, and can also help to improve the high-fidelity gate design in 1D ion chains when the transverse micromotion is important.
#### ACKNOWLEDGMENTS
This work was supported by the National Key Research and Development Program of China (2016YFA0301902), Frontier Science Center for Quantum Information of the Ministry of Education of China, and Tsinghua University Initiative Scientific Research Program. Y.-K.W. acknowledges support from Shuimu Tsinghua Scholar Program and International Postdoctoral Exchange Fellowship Program (Talent-Introduction Program).
#### APPENDIX A: ALGORITHMS
In this Appendix, we briefly summarize the algorithms used in this paper.
## 1. Periodic equilibrium solutions
To solve the periodic equilibrium solutions satisfying Eq. (14), we take two steps. First we find an approximate solution by introducing a weak damping and then we iteratively improve the accuracy.
Algorithm 1. Approximate periodic equilibrium solutions.
- 1: Choose accuracy target $\epsilon$ and initial damping rate $\gamma$ . Start from random initial positions $R_{i\sigma}$ .
- 2: Simulate time-evolution under Eq. (14) plus a damping force $-\gamma \dot{R}_{i\sigma}$ for $N_1$ RF periods. Get final positions $R'_{i\sigma}$ .
- 3: If $||R_{i\sigma} R'_{i\sigma}|| \ge \epsilon$ , set $R_{i\sigma} \leftarrow R'_{i\sigma}$ and repeat step 2.
- 4: Simulate time-evolution under Eq. (14) without damping force for $N_2$ RF periods. Get final positions $R''_{in}$ .
- 5: If $||R_{i\sigma} R''_{i\sigma}|| \ge \epsilon$ , reduce $\gamma$ and repeat steps 2-4.
**Algorithm 2**. Iteratively approaching periodic equilibrium solutions. **Input:** Approximate periodic solution $R_{i\sigma}(t)$
- 1: Choose truncation order L, accuracy target $\epsilon$ and parameter $\alpha \geqslant 1$ .
- 2: Compute Fourier series $D_{2n,i\sigma}$ up to orders $\pm L$ using Eq. (16) and $G_{2n,ij}$ up to orders $\pm 2L$ using Eq. (18).
- 3: Solve $B_{2n,i\sigma}$ up to orders $\pm L$ using Eq. (19).
- 4: Solve new periodic solution $R'_{i\sigma}(t)$ using Eq. (15).
- 5: If $||R_{i\sigma}(t) R'_{i\sigma}(t)|| \ge \epsilon$ , set $R_{i\sigma}(t) \leftarrow R'_{i\sigma}(t)$ and repeat steps 2–4.
#### 2. Normal modes
To solve all the normal modes satisfying Eq. (23) or, more generally, Eq. (29), we expand the solution into the form of Eq. (24).
Algorithm 3. Compute normal modes.
- 1: Choose the accuracy target $\epsilon$ .
- 2: Compute approximate mode frequencies $\beta_k$ and mode vectors $C_0^{(k)}$ using Eq. (36). Compute $C_{\pm 2}^{(k)}$ using Eq. (37) and $C_{\pm 4}^{(k)}$ using Eq. (38). Use them to construct the approximate vectorial solution $C^{(k)}$ in Eq. (31).
- 3: For each mode k, use $\beta_k$ to compute the matrix in Eq. (31). Compute its eigenvector $C^{(k)'}$ with the corresponding eigenvalue $\Delta$ closest to zero, using $C^{(k)}$ as the initial solution.
- 4: Compute $\beta'_k = \sqrt{\beta_k^2 + \Delta}$ .
- 5: If $|\beta_k \beta_k'| \ge \epsilon$ , set $\beta_k \leftarrow \beta_k'$ and $C^{(k)} \leftarrow C^{(k)'}$ . Repeat steps 3 and 4.
- 6: Repeat steps 3–5 for all the modes.
In the case of degeneracy or near degeneracy of n modes, we can resolve them by solving n eigenvalues closest to zero in step 3. Then we order them as $\Delta_1 \leqslant \Delta_2 \leqslant \cdots \leqslant \Delta_n$ with corresponding eigenvectors $\boldsymbol{C}^{(k_1)}, \boldsymbol{C}^{(k_2)}, \cdots, \boldsymbol{C}^{(k_n)}$ . For the ith mode, we need to keep using $\Delta_i$ and $\boldsymbol{C}^{(k_i)}$ in the iterations from steps 3–5.
Finally, we can verify that the solved normal modes satisfy the orthonormal condition of Eq. (42).
#### 3. Gate design
To design the entangling gate, we need to evaluate integrals in Eqs. (43) and (44) with $\chi_j(t)$ given by Eq. (45), $\varphi_j(t)$ given by Eq. (46), $b_j^k$ replaced by Eq. (47), and $\Omega_j(t)$ being constant on each segment. Actually, for the specific method of amplitude modulation with piecewise constant $\Omega_j(t)$ , we only need to integrate Eqs. (43) and (44) for unit $\Omega_j(t)$ on each segment to obtain the row vector $A_j^k$ in Eq. (10) and the matrix $\gamma'(p,q)$ in Eq. (11). Then the remaining part of the gate design follows that in Ref. [47] as we review in Sec. II.
Now for each element in the row vector $A_i^k$ , we have
$$A_j^k(n) = -i\eta_k \sum_{\sigma} m_{\sigma} \times \text{Eq. (50)}, \tag{A1}$$
where $m_{\sigma}$ is the $\sigma=x,\ y,\ z$ component of the unit vector $\boldsymbol{m}$ of the direction of the Raman laser beams $\Delta \boldsymbol{k}$ and the time integral in Eq. (50) is on the interval $[(n-1)\tau/n_{\rm seg},\ n\tau/n_{\rm seg}]$ . Our evaluation of Eq. (50) is based on the following two functions through depth-first search.
```
1: function SINGLE_INTEGRAL(t_1, t_2, \mu, \omega, \omega_{rf}, L, {\varphi(l)},
\{nk(l)\}, k, c_0\}
\triangleright Evaluation of Eq. (51)
Preset precision \epsilon and cutoff n_{\text{max}}
3:
If |c_0| < \epsilon then return 0
4.
end if
5:
if k > L then return [c_0 \times \text{prod\_cos}(t_1, t_2, \mu, \omega, \omega_{\text{rf}}, L,
\{nk(l)\}, 1\} - c_0^* \times \text{prod\_cos}(t_1, t_2, \mu, \omega, \omega_{\text{rf}}, L, \{nk(l)\}, 1)]/2i
else
6:
7:
nk(k) \leftarrow 0
8:
v \leftarrow \text{single\_integral}(t_1, t_2, \mu, \omega, \omega_{\text{rf}}, L, \{\varphi(l)\}, \{nk(l)\},
k+1, c_0 \times J_0(\varphi(k))
for n \leftarrow 1, n_{\text{max}} do
9:
10:
c \leftarrow 2i^n J_n(\varphi(k))
11:
if n > |\varphi(k)| and |c_0 \times c| < \epsilon then break
end if
12:
13.
nk(k) \leftarrow n
14:
v \leftarrow v + \text{single\_integral}(t_1, t_2, \mu, \omega, \omega_{\text{rf}}, L, \{\varphi(l)\},
\{nk(l)\}, k + 1, c_0 \times c\}
15:
end for
16:
return v
17:
end if
18:
end function
```
```
1: function PROD_COS(t_1, t_2, \mu, \omega, \omega_{\text{rf}}, L, \{nk(l)\}, k) \rhd Evaluation of Eq. (52)
```
- 2: **if** k > L **then return** $[e^{i(\mu+\omega)t_2} e^{i(\mu+\omega)t_1}]/[i(\mu+\omega)]$
- **3: end if**
- 4: **if** nk(k) = 0 **then return** $prod_cos(t_1, t_2, \mu, \omega, \omega_{rf}, L, \{nk(l)\}, k + 1)$
- 5: else
- 6: **return** $\frac{1}{2}$ prod\_cos( $t_1$ , $t_2$ , $\mu$ , $\omega k \times nk(k) \times \omega_{rf}$ , $\omega_{rf}$ , L, {nk(l)}, k + 1) + $\frac{1}{2}$ prod\_cos( $t_1$ , $t_2$ , $\mu$ , $\omega + k \times nk(k) \times \omega_{rf}$ , $\omega_{rf}$ , L, {nk(l)}, k + 1)
- 7: end if
- 8: end function
The evaluation of Eq. (50) is now given by
**Algorithm 4.** Evaluation of Eq. (50) for ion j, mode k and spatial direction $\sigma$ on the time interval $[t_1, t_2]$ .
1: Preset precision $\epsilon$ and cutoff $n_{\text{max}}$
$2: v \leftarrow 0$
$3: \{nk(l)\} \leftarrow 0$
4: **for** $n \leftarrow 0, \pm 1, \cdots, \pm n_{\text{max}}$ **do**
5:
$$c_0 \leftarrow \sqrt{\sum_k |C_{2n,j\sigma}^{(k)}|^2}$$
6: **if** $|c_0| < \epsilon$ then break
7: **end if**
8: $v \leftarrow v + C_{2n,j\sigma}^{(k)}/c_0 \times \text{single\_integral}(t_1, t_2, \mu, \omega_k + n\omega_{\text{rf}}, \omega_{\text{rf}}, L, \{\varphi(l)\}, \{nk(l)\}, 1, c_0)$
9: end for
For the (p, q) element of the matrix $\gamma'$ , we have
$$\mathbf{\gamma}'(p,q) = \sum_{k\rho\sigma} \eta_k^2 m_\rho m_\sigma \times \text{Im}[\text{Eq. (53)} + \text{Exch}_{ij} \text{Eq. (53)}],$$
(A2)
where $\operatorname{Exch}_{ij}$ means exchanging the indices i and j in the following expression. For p > q, the double integral in Eq. (53) becomes separable and reduces to
Eq.
$$(53)_{ip,jq}$$
= Eq. $(50)_{ip} \times$ Eq. $(50)_{jq}^*$ , (A3)
where the subscript ip means the terms related to the ion i is integrated over the segment p and similarly for the subscript jq. The superscript \* represents the standard complex conjugate.
To evaluate Eq. (53) for p = q, again we use depth-first search by defining the following functions.
```
1: function DOUBLE_INTEGRAL(t_1, t_2, \mu, \omega_1, \omega_2, \omega_{\rm rf}, L, \{\varphi_1(l)\}, \{\varphi_2(l)\}, \{nk_1(l)\}, \{nk_2(l)\}, k, c_1, c_2)
```
2: Preset precision $\epsilon$ and cutoff $n_{\text{max}}$
3: **if** $|c_1c_2| < \epsilon$ **then return** 0
4: end if
5: if k > L then return
```
[c_1c_2 \times \text{prod\_cos\_plus}(t_1, t_2, \mu, \omega_1, \omega_2, \omega_{\text{rf}}, L,
\{nk_1(l)\}, \{nk_2(l)\}, 1\}
-c_1c_2^* \times \text{prod\_cos\_minus}(t_1, t_2, \mu, \omega_1, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_2, \omega_{\text{rf}}, L, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2
\{nk_1(l)\}, \{nk_2(l)\}, 1\}
-c_1^*c_2 \times \text{prod\_cos\_minus}(t_1, t_2, -\mu, \omega_1, \omega_2, \omega_{\text{rf}}, L,
\{nk_1(l)\}, \{nk_2(l)\}, 1\}
+c_1^*c_2^*\times \operatorname{prod\_cos\_plus}(t_1, t_2, -\mu, \omega_1, \omega_2, \omega_{\operatorname{rf}}, L, \{nk_1(l)\},
\{nk_2(l)\}, 1)]/(-4)
else
7:
v \leftarrow 0
for n_1 \leftarrow 0, n_{\text{max}} do
8:
if n_1 = 0 then
9:
10:
c_1' \leftarrow J_0(\varphi_1(k))
```
11: **els**
#### (Continued.)
```
12:
c_1' \leftarrow 2i^{n_1}J_{n_1}(\varphi_1(k))
13:
14:
if n_1 > |\varphi_1(k)| and |c_1c_2c_1'| < \epsilon then break
15:
16:
nk_1(k) \leftarrow n_1
for n_2 \leftarrow 0, n_{\text{max}} do
17:
if n_2 = 0 then
18
c_2' \leftarrow J_0(\varphi_2(k))
19:
20:
else
c_2' \leftarrow 2i^{n_2}J_{n_2}(\varphi_2(k))
21:
22:
if n_2 > |\varphi_2(k)| and |c_1c_2c_1'c_2'| < \epsilon then break
23:
end if
24:
```
$v \leftarrow v + \text{double\_integral}(t_1, t_2, \mu, \omega_1, \omega_2, \omega_{\text{rf}}, L, \{\varphi_1(l)\},$
$\{\varphi_2(l)\}, \{nk_1(l)\}, \{nk_2(l)\}, k+1, c_1c'_1, c_2c'_2\}$ 27: end for
28: end for
29: return v30: end if
$nk_2(k) \leftarrow n_2$
31: end function
25:
26
```
1: function PROD_COS_PLUS(t_1, t_2, \mu, \omega_1, \omega_2, \omega_{rf}, L,
\{nk_1(l)\}, \{nk_2(l)\}, k\}
\triangleright Evaluation of Eq. (55)
2:
if k > L then return integral_plus(t_1, t_2, \mu, \omega_1, \omega_2)
3:
4:
if nk_1(k) = 0 and nk_2(k) = 0 then
return prod_cos_plus(t_1, t_2, \mu, \omega_1, \omega_2, \omega_{rf}, L,
\{nk_1(l)\}, \{nk_2(l)\}, k+1\}
end if
6:
if nk_1(k) = 0 then return
7:
\frac{1}{2}prod_cos_plus(t_1, t_2, \mu, \omega_1, \omega_2 - k \times nk_2(k) \times \omega_{rf}, \omega_{rf}, L,
\{nk_1(l)\}, \{nk_2(l)\}, k+1\} + \frac{1}{2} \text{prod\_cos\_plus}(t_1, t_2, \mu, \omega_1, \mu, \omega_1, \mu, \omega_2, \mu, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2, \omega_2
\omega_2 + k \times nk_2(k) \times \omega_{\rm rf}, \, \omega_{\rm rf}, \, \bar{L}, \{nk_1(l)\}, \{nk_2(l)\}, k+1)
end if
if nk_2(k) = 0 then return
\frac{1}{2}prod_cos_plus(t_1, t_2, \mu, \omega_1 - k \times nk_1(k) \times \omega_{rf}, \omega_2, \omega_{rf}, L,
\{nk_1(l)\}, \{nk_2(l)\}, k+1\} + \frac{1}{2}\operatorname{prod\_cos\_plus}(t_1, t_2, \mu,
\omega_1 + k \times nk_1(k) \times \omega_{\rm rf}, \, \omega_2, \, \omega_{\rm rf}, \, L, \, \{nk_1(l)\}, \, \{nk_2(l)\}, \, k+1)
```
(Continued.)
10: **end if**11: **return** $\frac{1}{4}\text{prod\_cos\_plus}(t_1, t_2, \mu, \omega_1 - k \times nk_1(k) \times \omega_{\text{rf}}, \omega_2 - k \times nk_2(k) \times \omega_{\text{rf}}, \omega_{\text{rf}}, L, \{nk_1(l)\}, \{nk_2(l)\}, k + 1)$ $+ \frac{1}{4} \text{prod\_cos\_plus}(t_1, t_2, \mu, \omega_1 + k \times nk_1(k) \times \omega_{\text{rf}}, \omega_2 - k \times nk_2(k) \times \omega_{\text{rf}}, \omega_{\text{rf}}, L, \{nk_1(l)\}, \{nk_2(l)\}, k + 1)$ $+ \frac{1}{4} \text{prod\_cos\_plus}(t_1, t_2, \mu, \omega_1 - k \times nk_1(k) \times \omega_{\text{rf}}, \omega_2 + k \times nk_2(k) \times \omega_{\text{rf}}, \omega_{\text{rf}}, L, \{nk_1(l)\}, \{nk_2(l)\}, k + 1)$ $+ \frac{1}{4} \text{prod\_cos\_plus}(t_1, t_2, \mu, \omega_1 + k \times nk_1(k) \times \omega_{\text{rf}}, \omega_2 + k \times nk_2(k) \times \omega_{\text{rf}}, \omega_{\text{rf}}, L, \{nk_1(l)\}, \{nk_2(l)\}, k + 1)$ 12: **end function**
In the above functions, integral\_plus is an analytical expression for
$$\int_{t_1}^{t_2} dt \int_{t_1}^{t} dt' e^{i\mu t} e^{i\mu t'} e^{i\omega_1 t} e^{-i\omega_2 t'}.$$
(A4)
The function prod\_cos\_minus is defined by making a suitable substitution for prod\_cos\_plus and similarly we define integral\_minus as an analytical expression for
$$\int_{t_1}^{t_2} dt \int_{t_1}^{t} dt' e^{i\mu t} e^{-i\mu t'} e^{i\omega_1 t} e^{-i\omega_2 t'}.$$
(A5)
These analytical expressions can be computed easily and here we do not present the detailed expressions for simplicity.
Finally, we can evaluate Eq. (53) for p = q as
```
Algorithm 5. Evaluation of Eq. (53) for ions i and j, mode k and
spatial directions \rho and \sigma on the time interval [t_1, t_2].
1: Preset precision \epsilon and cutoff n_{\text{max}}
2: v \leftarrow 0
3: \{nk_1(l)\} \leftarrow 0, \{nk_2(l)\} \leftarrow 0
4: for n_1 \leftarrow 0, \pm 1, \cdots, \pm n_{\text{max}} do
for n_2 \leftarrow 0, \pm 1, \cdots, \pm n_{\text{max}} do
c_1 \leftarrow \sqrt{\sum_k |C_{2n_1,i\rho}^{(k)}|^2}
6:
c_2 \leftarrow \sqrt{\sum_{k} |C_{2n_2, i\sigma}^{(k)}|^2}
7:
if |c_1c_2| < \epsilon then break
8:
9:
v \leftarrow v + C_{2n_1,i\rho}^{(k)} C_{2n_2,j\sigma}^{(k)} / (c_1 c_2) \times \text{double\_integral}(t_1, t_2, \mu,
\omega_k + n_1 \omega_{\rm rf}, \omega_k + n_2 \omega_{\rm rf}, \omega_{\rm rf}, L, \{\varphi_1(l)\}, \{\varphi_2(l)\},
\{nk_1(l)\}, \{nk_2(l)\}, 1, c_1, c_2\}
```
11:
12: end for
end for
## <span id="page-13-0"></span>APPENDIX B: ROBUSTNESS AGAINST TRAP FREQUENCY DRIFT
It has been shown in Ref. [53] that robustness of the residual spin-phonon entanglement $\alpha_i^k(\tau)$ against the trap frequency drift $\omega_k$ can be achieved by requiring $\int_0^{\tau} \alpha_i^k(t) dt = 0$ . One can easily check that this condition still holds with the existence of micromotion for Eq. (43). Similarly, one can check that the robustness of the two-qubit phase $\Theta_{ii}(\tau)$ is ensured by taking the real part rather than the imaginary part in Eq. (44) (this comes from the partial derivative with respect to $\omega_k$ which gives us a factor of i) and then requiring the time integral to vanish. Evaluating these integrals are again numerically intense. Fortunately, for the numerical algorithms described in the main text and summarized in Appendix A, we already get the desired integral on each segment. From these results, not only can we obtain $\alpha_i^k(\tau)$ and $\Theta_{ij}(\tau)$ but also their values [for $\Theta_{ij}(\tau)$ , we need to keep the complex values before taking the imaginary part] at the time points $n\tau/n_{\rm seg}$ $(n = 0, 1, \dots, n_{seg})$ , from which we can approximate the their time integral.
Specifically, after computing the row vector
$$A_j^k \equiv [A_j^k(1), A_j^k(2), \cdots, A_j^k(n_{\text{seg}})]$$
(B1)
as described in Appendix A, we can construct a new row vector
$$\tilde{A}_{j}^{k} \equiv \left[ n_{\text{seg}} A_{j}^{k}(1), (n_{\text{seg}} - 1) A_{j}^{k}(2), \cdots, A_{j}^{k}(n_{\text{seg}}) \right],$$
(B2)
such that $\tilde{A}_{j}^{k}\Omega$ is proportional to the approximate time integral of $\alpha_{j}^{k}(t)$ . Similarly, after evaluating all the elements $\gamma'(p,q)$ of the $\gamma'$ matrix (we denote the matrix before taking the imaginary part by $\Gamma'$ such that $\text{Im}[\Gamma'] = \gamma'$ ), we can define a new matrix $\tilde{\gamma}'$ whose (p,q) element is $(n_{\text{seg}} - p + 1)\text{Re}[\Gamma'(p,q)]$ $(1 \le q \le p \le n_{\text{seg}})$ . Then $\Omega^T \tilde{\gamma}'\Omega$ is proportional to the desired time integral for the robustness of $\Theta_{ij}(\tau)$ . For the small segment number considered in this paper, we are not able to set all these expressions to zeros. Instead, we replace the optimization condition by minimizing
$$\mathbf{\Omega}^T \tilde{\mathbf{M}}' \mathbf{\Omega} + (\mathbf{\Omega}^T \tilde{\mathbf{\gamma}}' \mathbf{\Omega})^2$$
(B3)
under the constraint $\Omega^T \gamma' \Omega = \pm \pi/4$ , where $\tilde{M}' \equiv \sum_{jk} \tilde{A}_j^k \tilde{A}_j^k (2\bar{n}_k + 1)$ . We further require the pulse sequence to be symmetric [53], namely, $\Omega(n) = \Omega(n_{\text{seg}} - n + 1)$ . This gives us the pulse sequence presented in Fig. 7 in the main text. Note that now the cost function is nonlinear and we can no longer solve it as an eigenvalue problem. However, this cost function is still simple enough with the Jacobian and the Hessian matrix computable, thus the time cost to find an optimal gate design is still negligible compared with the cost for numerical integration.
- [1] M. Nielsen and I. Chuang, *Quantum Computation and Quantum Information* (Cambridge University Press, New York, 2000).
- [2] D. P. DiVincenzo, Fortschr. Phys. 48, 771 (2000).
- [3] I. M. Georgescu, S. Ashhab, and F. Nori, Rev. Mod. Phys. 86, 153 (2014).
- [4] E. Farhi, J. Goldstone, and S. Gutmann, arXiv:1411.4028.
- [5] J. R. McClean, J. Romero, R. Babbush, and A. Aspuru-Guzik, New J. Phys. 18, 023023 (2016).
- [6] V. Giovannetti, S. Lloyd, and L. Maccone, Science 306, 1330 (2004).
- [7] J. I. Cirac and P. Zoller, Phys. Rev. Lett. **74**, 4091 (1995).
- [8] D. Leibfried, R. Blatt, C. Monroe, and D. Wineland, Rev. Mod. Phys. 75, 281 (2003).
- [9] R. Blatt and D. Wineland, Nature 453, 1008 (2008).
- [10] C. Monroe and J. Kim, Science 339, 1164 (2013).
- [11] F. Mintert and C. Wunderlich, Phys. Rev. Lett. **87**, 257904 (2001).
- [12] A. Khromova, C. Piltz, B. Scharfenberger, T. F. Gloger, M. Johanning, A. F. Varón, and C. Wunderlich, Phys. Rev. Lett. 108, 220502 (2012).
- [13] C. Ospelkaus, C. E. Langer, J. M. Amini, K. R. Brown, D. Leibfried, and D. J. Wineland, Phys. Rev. Lett. 101, 090502 (2008).
- [14] C. Ospelkaus, U. Warring, Y. Colombe, K. Brown, J. Amini, D. Leibfried, and D. J. Wineland, Nature 476, 181 (2011).
- [15] A. Sørensen and K. Mølmer, Phys. Rev. Lett. 82, 1971 (1999).
- [16] J. J. García-Ripoll, P. Zoller, and J. I. Cirac, Phys. Rev. A 71, 062309 (2005).
- [17] S.-L. Zhu, C. Monroe, and L.-M. Duan, Phys. Rev. Lett. 97, 050505 (2006).
- [18] Shi-Liang Zhu, C. Monroe, and L.-M. Duan, Europhys. Lett. **73**, 485 (2006).
- [19] T. J. Green and M. J. Biercuk, Phys. Rev. Lett. 114, 120502 (2015).
- [20] P. H. Leung and K. R. Brown, Phys. Rev. A 98, 032318 (2018).
- [21] C. A. Sackett, D. Kielpinski, B. E. King, C. Langer, V. Meyer, C. J. Myatt, M. Rowe, Q. Turchette, W. M. Itano, D. J. Wineland et al., Nature 404, 256 (2000).
- [22] D. Leibfried, B. DeMarco, V. Meyer, D. Lucas, M. Barrett, J. Britton, W. M. Itano, B. Jelenković, C. Langer, T. Rosenband *et al.*, Nature **422**, 412 (2003).
- [23] T. Monz, P. Schindler, J. T. Barreiro, M. Chwalla, D. Nigg, W. A. Coish, M. Harlander, W. Hänsel, M. Hennrich, and R. Blatt, Phys. Rev. Lett. 106, 130506 (2011).
- [24] T. Choi, S. Debnath, T. A. Manning, C. Figgatt, Z.-X. Gong, L.-M. Duan, and C. Monroe, Phys. Rev. Lett. 112, 190502 (2014).
- [25] C. J. Ballance, T. P. Harty, N. M. Linke, M. A. Sepiol, and D. M. Lucas, Phys. Rev. Lett. 117, 060504 (2016).
- [26] T. Monz, D. Nigg, E. A. Martinez, M. F. Brandl, P. Schindler, R. Rines, S. X. Wang, I. L. Chuang, and R. Blatt, Science 351, 1068 (2016).
- [27] K. Wright, K. Beck, S. Debnath, J. Amini, Y. Nam, N. Grzesiak, J.-S. Chen, N. Pisenti, M. Chmielewski, C. Collins *et al.*, Nat. Commun. **10**, 1 (2019).
- [28] D. J. Wineland, C. Monroe, W. M. Itano, D. Leibfried, B. E. King, and D. M. Meekhof, J. Res. Natl. Inst. Stand. Technol. 103, 259 (1998).
- <span id="page-14-0"></span>[29] R. J. Hughes, D. F. V. James, E. H. Knill, R. Laflamme, and A. G. Petschek, [Phys. Rev. Lett.](https://doi.org/10.1103/PhysRevLett.77.3240) **77**, 3240 (1996).
- [30] R. Clark, in *Proceedings of the 1st International Conference on Experimental Implementation of Quantum Computation: Sydney, Australia, 16-19 January 2001* (Rinton Press, Paramus, 2001).
- [31] [D. Kielpinski, C. Monroe, and D. J. Wineland,](https://doi.org/10.1038/nature00784) Nature **417**, 709 (2002).
- [32] L.-M. Duan, B. B. Blinov, D. L. Moehring, and C. Monroe, Quantum Info. Comput. **4**, 165 (2004).
- [33] L.-M. Duan and C. Monroe, [Rev. Mod. Phys.](https://doi.org/10.1103/RevModPhys.82.1209) **82**, 1209 (2010).
- [34] C. Monroe, R. Raussendorf, A. Ruthven, K. R. Brown, P. [Maunz, L.-M. Duan, and J. Kim,](https://doi.org/10.1103/PhysRevA.89.022317) Phys. Rev. A **89**, 022317 (2014).
- [35] [A. Mortensen, E. Nielsen, T. Matthey, and M. Drewsen,](https://doi.org/10.1103/PhysRevLett.96.103001) Phys. Rev. Lett. **96**, 103001 (2006).
- [36] B. Szymanski, R. Dubessy, B. Dubost, S. Guibal, J.-P. [Likforman, and L. Guidoni,](https://doi.org/10.1063/1.4705153) Appl. Phys. Lett. **100**, 171110 (2012).
- [37] C. Shen and L.-M. Duan, Phys. Rev. A **90**[, 022332 \(2014\).](https://doi.org/10.1103/PhysRevA.90.022332)
- [38] S.-T. Wang, C. Shen, and L.-M. Duan, Sci. Rep. **5**[, 8555 \(2015\).](https://doi.org/10.1038/srep08555)
- [39] A. Bermudez, P. Schindler, T. Monz, R. Blatt, and M. Müller, New J. Phys. **19**[, 113038 \(2017\).](https://doi.org/10.1088/1367-2630/aa86eb)
- [40] P. Richerme, Phys. Rev. A **94**[, 032320 \(2016\).](https://doi.org/10.1103/PhysRevA.94.032320)
- [41] Q. A. Turchette, C. S. Wood, B. E. King, C. J. Myatt, D. [Leibfried, W. M. Itano, C. Monroe, and D. J. Wineland,](https://doi.org/10.1103/PhysRevLett.81.3631) Phys. Rev. Lett. **81**, 3631 (1998).
- [42] [H. Landa, M. Drewsen, B. Reznik, and A. Retzker,](https://doi.org/10.1088/1367-2630/14/9/093023) New J. Phys. **14**, 093023 (2012).
- [43] [H. Landa, M. Drewsen, B. Reznik, and A. Retzker,](https://doi.org/10.1088/1751-8113/45/45/455305) J. Phys. A: Math. Theor. **45**, 455305 (2012).
- [44] H. Kaufmann, S. Ulm, G. Jacob, U. Poschinger, H. Landa, A. [Retzker, M. B. Plenio, and F. Schmidt-Kaler,](https://doi.org/10.1103/PhysRevLett.109.263003) Phys. Rev. Lett. **109**, 263003 (2012).
- [45] K. Arnold, E. Hajiyev, E. Paez, C. H. Lee, M. D. Barrett, and J. Bollinger, Phys. Rev. A **92**[, 032108 \(2015\).](https://doi.org/10.1103/PhysRevA.92.032108)
- [46] [H. Landa, A. Retzker, T. Schaetz, and B. Reznik,](https://doi.org/10.1103/PhysRevLett.113.053001) Phys. Rev. Lett. **113**, 053001 (2014).
- [47] [Y. Wu, S.-T. Wang, and L.-M. Duan,](https://doi.org/10.1103/PhysRevA.97.062325) Phys. Rev. A **97**, 062325 (2018).
- [48] P. J. Lee, K.-A. Brickman, L. Deslauriers, P. C. Haljan, L.-M. Duan, and C. Monroe, [J. Opt. B: Quantum Semiclass. Opt.](https://doi.org/10.1088/1464-4266/7/10/025) **7**, S371 (2005).
- [49] K. Okada, T. Takayanagi, M. Wada, S. Ohtani, and H. A. Schuessler, Phys. Rev. A **80**[, 043405 \(2009\).](https://doi.org/10.1103/PhysRevA.80.043405)
- [50] [M. Condon, A. Deaño, and A. Iserles,](https://doi.org/10.1051/m2an/2009024) ESAIM: M2AN **43**, 785 (2009).
- [51] G. B. Arfken, H.-J. Weber, and F. E. Harris, *Mathematical Methods for Physicists: A Comprehensive Guide*, 7th ed. (Academic Press, Waltham, 2013).
- [52] J. Thijssen, *Computational Physics*, 2nd ed. (Cambridge University Press, New York, 2007).
- [53] P. H. Leung, K. A. Landsman, C. Figgatt, N. M. Linke, C. Monroe, and K. R. Brown, Phys. Rev. Lett. **120**[, 020501 \(2018\).](https://doi.org/10.1103/PhysRevLett.120.020501)