# What are the available compilers for Trapped-Ion Quantum Computing Architecture?

I am looking for a compiler to compile a high-level quantum circuit for the Trapped-Ion Quantum Computing architecture, i.e. a compiler that can translate a high-level circuit to native gates of the TI hardware (single-qubit rotations and 2-qubit MS gate) in an optimized manner.

You can compile gates to native trapped ion gates via cirq.ion.ConvertToIonGates. For example:

import cirq

q0, q1 = cirq.LineQubit.range(2)

circuit = cirq.Circuit(
cirq.H(q0),
cirq.CNOT(q0, q1),
cirq.measure(q0, key='m')
)

print("Circuit:")
print(circuit)
# Prints
# Circuit:
# 0: ───H───@───M('m')───
#           │
# 1: ───────X────────────

ion_circuit = cirq.ion.ConvertToIonGates().convert_circuit(circuit)
print("Ion Circuit:")
print(ion_circuit)
# Prints
# Ion Circuit:
# 0: ───PhX(1)───────────MS(0.25π)───PhX(-0.5)^0.5───S^-1───M('m')───
#                        │
# 1: ────────────────────MS(0.25π)───PhX(1)^0.5──────────────────────



I believe that you can do this actually can be done with Qiskit as well. You just need to specify the basis gates sets you want to use under the transpile function.

For example: If I have the following circuit

which can be generated with Qiskit as:

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from numpy import pi

qreg_q = QuantumRegister(2, 'q')
creg_c = ClassicalRegister(2, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)

circuit.h(qreg_q[0])
circuit.x(qreg_q[1])
circuit.cx(qreg_q[0], qreg_q[1])
circuit.measure(qreg_q[0], creg_c[0])
circuit.measure(qreg_q[1], creg_c[1])
circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= True, initial_state = True, scale = 1)


Now, if I am targeting a Trapped-ion system then instead of using CNOT as part of the native gate, we use Mølmer–Sørensen gate but this gate is equivalent to $$R_{XX}$$ gate when using two qubits. So I can transpile my circuit using this $$R_{XX}$$ gate and single qubit rotation as my native gates. We can do that as follow:

from qiskit import QuantumCircuit, transpile
trans_qc = transpile(circuit, backend = None, basis_gates = ['rx', 'ry', 'rz', 'rxx'])


the transpiled circuit, tans_qc, is now have the form:

Furthermore, if you want to actually simulate this on a trapped-ion hardware and potentially running on one then I would suggest you to sign-up for a free account with AQT (Alpine Quantum Technologies). Now you can actually set your backend using AQT system and transpile your circuit based on that.

from qiskit_aqt_provider import AQTProvider
aqt = AQTProvider('***********************')
AQT_backend = aqt.backends.aqt_qasm_simulator

trans_qc = transpile(circuit, backend = AQT_backend,  optimization_level = 3)
trans_qc.draw( 'mpl',style={'name': 'bw'}, plot_barriers= True, initial_state = True, scale = 1)


Which will output:

Use this documentation here for more details.