# Qutrit Control for Bucket Brigade RAM Using Transmon Systems
## Appendix B  
In this appendix, we give some sample code to demonstrate how the simulation and population dynamics can be retrieved using [PERSON]'s dynamics library for the case of single-qutrit operations. Listing A1 shows how to construct a simple 5-level Duffing oscillator. The _static_term_ variable describes the Hamiltonian of the system when no interactionsare present, while the _drive_term_ corresponds to the Hamiltonian term that describes the interaction with the pulse. For simplicity, the coupling to the second qutrit is omitted; this is obtained by forming the appropriate Kronecker products of the operators and summing two static terms and the coupling term which equals to \(2*np.pi*\)\(((a0+a0\_tag)@(a1+a1\_tag))\). The coupling will introduce a shift to the energy levels of the transmons; while this will produce different values for the pulse parameters, the calibration process will be the same.  
**Listing A1.** Single-qutrit model.  
```
#Transmonparameters v_0=4.86 r_0=0.22 dt=1/22.
#dimensionality dim=5
#Anharmonicityofttherransmon anharm_0=-0.32 I=np.eye(dim,dtype=complex) a=np.diag(np.sqrt(np.arange(1,dim)),1) a_dag=np.diag(np.sqrt(np.arange(1, dim)),-1) N_op=np.diag(np.arange(dim)) static_term=2*np.pi*v_0*N_op+np.pi*anharm_0*N_op*(N_op-I) drive_term=2*np.pi*r_0*(a+a_dag)
```  
Listing A2: The construction of constant pulses for the \(0\to 2\) transition.  
Pulses are built using the Pulse module of Qiskit. Listing A2 showcases the construction of a pulse that drives the qutrit from the ground to the \(|2\rangle\) state. This pulse consists of two pulses performed in sequence, one that drives the qutrit to state \(|1\rangle\) and a second one that waits for the first one to complete and then drives the qutrit to state \(|2\rangle\).  
```
withpulse.build(name=\"$X_{01}$schedule\")asx_01: pulse.play(pulse.Constant(duration_01,amp_01),pulse.DriveChannel(0)) withpulse.build(name=\"$X_{12}$schedule\")asx_12: pulse.delay(duration_01,pulse.DriveChannel(0)) pulse.play(pulse.Constant(duration_02,amp_02),pulse.DriveChannel(0))
```  
Listing A3: Note how the second uses a carrier frequency modified by the anharmonicity of the transmon to construct the second signal.  
```
mixer_01=InstructionToSignals(dt,carriers={\"d0\":v_0}) mixer_12=InstructionToSignals(dt,carriers={\"d0\":v_0+anharm}) signal_01= mixer_01.get_signals(sX_01) signal_12= mixer_12.get_signals(sX_12) signals=signal_01+signal_12
```  
**Listing 13** Pulse to signal conversion.  
The solver parameters are depicted in Listing 14. While the channel carrier frequency is the one of the driving channel, the second signal will have a modulation frequency that is offset by the anharmonicity; that will drive the \(1\to 2\) transition, instead of having the qutrit return to state \(|0\rangle\) as would be the case of a typical Rabi experiment with a constant resonant frequency.  
```
solver=Solver( static_hamiltonian=static_term, hamiltonian_operators=[drive_term], rotating_frame=static_term, rwa_cutoff_freq=2*5.0, hamiltonian_channels=['d0'], channel_carrier_freq={'d0':v_0}, dt=dt )
```  
**Listing 14** Solver parameters.