# ms_phases_multitone

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/ions/ms_phases_multitone

```python
ions.ms_phases_multitone(drives, lamb_dicke_parameters, relative_detunings, sample_times=None, *, name=None)
```

Calculate the relative phases for all pairs of ions described by a
Mølmer–Sørensen-type interaction where the ions are being addressed by
a multitone global beam.

Use this function to calculate the acquired phases for all ion pairs
at the final time of the drives, or at the sample times that you provide.

### Parameters
* **drives** (*list* *[*[*Pwc*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Pwc.md#boulderopal.graph.Pwc) *]*) – The piecewise-constant drives, $\{\gamma_j\}$,
  one for each of the $M$ tones of the global beam.
  Drive values must be in rad/s and durations must be in seconds.
  All drives must have the same total duration, but can have different segmentations.
* **lamb_dicke_parameters** (*np.ndarray*) – The laser-ion coupling strength, $\{\eta_{\xi jkl}\}$.
  Its shape must be `(M, 3, N, N)`, where the dimensions indicate,
  respectively, tone of the global beam, axis, collective mode, and ion.
* **relative_detunings** (*np.ndarray*) – The difference $\{\delta_{\xi jk} = \nu_{jk} - \delta_\xi \}$ (in Hz) between
  each motional mode frequency and the laser detunings for each tone from the qubit
  transition frequency $\omega_0$. Its shape must be `(M, 3, N)`, where the
  dimensions indicate, respectively, tone of the global beam, axis, and collective mode.
* **sample_times** (*np.ndarray* *or* *None* *,* *optional*) – The times (in seconds) at which to calculate the relative phases, $\{t_i\}$.
  If you provide it, it must be 1D, ordered, and contain at least one element.
  If you omit it, the phases are only calculated at the final time of the drives.
* **name** (*str* *or* *None* *,* *optional*) – The name of the node.
### Returns
Acquired phases $\{\phi_{jk}(t_i) + \phi_{kj}(t_i)\}$ for all ion pairs.
If you provide sample_times, the shape of the returned value is `(T, N, N)`,
where the first dimension indicates time, and the second and third dimensions indicate
ions. Otherwise, the shape is `(N, N)`, with the outer time dimension removed.
The relative phases are stored as a strictly lower triangular matrix.
See the notes part for details.
### Return type
[Tensor](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)(real)

### SEE ALSO
[`Graph.ions.ms_infidelity`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/ions/ms_infidelity.md#boulderopal.graph.ions.ms_infidelity)
: Final operational infidelity of a Mølmer–Sørensen gate.

[`Graph.ions.ms_phases`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/ions/ms_phases.md#boulderopal.graph.ions.ms_phases)
: Corresponding operation for single-tone individually-addressed beams.

[`boulderopal.ions.obtain_ion_chain_properties`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/ions/obtain_ion_chain_properties.md#boulderopal.ions.obtain_ion_chain_properties)
: Function to calculate the properties of an ion chain.

## Notes

The interaction Hamiltonian for Mølmer–Sørensen-type
operations in the rotating frame for a multitone global beam is

$$
H_I(t) = i\hbar \sum_{\xi=1}^M \sum_{j=1}^{3} \sum_{k=1}^{N} \sum_{l=1}^N \sigma_{x,l}
    \left(-\beta_{\xi jkl}^*(t)a_{jk} + \beta_{\xi jkl}(t) a_{jk}^\dagger\right) ,
$$

where $\sigma_{x,l}$ is the Pauli $X$ operator for the ion $l$ and

$$
\beta_{\xi jkl}(t) = \eta_{\xi jkl} \frac{\gamma_\xi(t)}{2}
    \exp(i 2 \pi \delta_{\xi jk} t)
$$

indicates the coupling between ion $l$ and motional mode $(\xi,j,k)$.

The corresponding unitary operation is given by

$$
U(t) = \exp\left[ \sum_{l=1}^N \sigma_{x,l} B_l(t)
        + i\sum_{l=1}^N \sum_{n=1}^{l-1} (\phi_{ln}(t) + \phi_{nl}(t))
        \sigma_{x,l} \sigma_{x,n} \right] ,
$$

where

$$
B_l(t) \equiv \sum_{\xi=1}^M \sum_{j=1}^{3} \sum_{k=1}^{N}
    \left(\eta_{\xi jkl}\alpha_{\xi jkl}(t)a_{jk}^\dagger
    - \eta_{\xi jkl}^{\ast}\alpha_{\xi jkl}^\ast(t)a_{jk} \right) ,
$$
\phi_{ln}(t) \equiv \mathrm{Im} \left[
    \sum_{\xi=1}^M \sum_{\chi=1}^M \sum_{j=1}^{3} \sum_{k=1}^{N}
    \int_{0}^{t} d \tau_1 \int_{0}^{\tau_1} d \tau_2
    \beta_{\xi jkl}(\tau_1)\beta_{\chi jkn}^{\ast}(\tau_2) \right] ,
$$
\alpha_{\xi jkl}(t) \equiv \int_0^t d\tau \frac{\gamma_\xi(\tau)}{2}
    \exp(i 2 \pi \delta_{\xi jk} \tau).
$$

This function calculates the relative phases for all ions pairs
at sample times $\{t_i\}$,

$$
\Phi_{ln}(t_i) = \phi_{ln}(t_i) + \phi_{nl}(t_i),
$$

and stores them in a strictly lower triangular matrix.
That is, $\Phi_{ln}(t_i)$ with $l > n$
gives the relative phase between ions $l$ and $n$,
while $\Phi_{ln}(t_i) = 0$ for $l \leq n$.
