Error while trying to simulate circuit with Pulse-Level SImulation

19 views
Skip to first unread message

Karthik Venkatesh Nagaraj

unread,
Jan 15, 2025, 11:27:29 AM1/15/25
to QuTiP: Quantum Toolbox in Python
First off a warning, I am a beginner at QuTiP and pretty much Quantum Computing in general. 

I am currently trying to implement the BBPSSW entanglement purification protocol in QuTiP, and I have this circuit designed as follows:

#create circuit that generates source
qc = QubitCircuit(4)
qc.add_gate("X", targets=[1])
qc.add_gate("QASMU", targets=[0], arg_value=[F_to_theta(fidelity_val), pi, 0])
qc.add_gate("CNOT", controls=[0], targets=[1])
qc.add_gate("X", targets=[3])
qc.add_gate("QASMU", targets=[2], arg_value=[F_to_theta(fidelity_val), pi, 0])
qc.add_gate("CNOT", controls=[2], targets=[3])
# qc.draw("matplotlib", dpi=150)

#generate werner state from source using random bilateral rotations
rand_int = np.random.randint(12)
bilateral_rotation(qc, control_qubits, rand_int)
bilateral_rotation(qc, target_qubits, rand_int)
# qc.draw("matplotlib", dpi=150)

#bbpssw protocol steps  
qc.add_gate("Y", targets=[0])
qc.add_gate("Y", targets=[2])
qc.add_gate("CNOT", controls=[0], targets=[2])
qc.add_gate("CNOT", controls=[1], targets=[3])
qc.add_measurement("M0", targets=[2], classical_store=[0])
qc.add_measurement("M0", targets=[3], classical_store=[1])

# qc.draw("matplotlib", dpi=150)


And inorder to simulate this circuit, I use Pulse-Level circuit simulation and try to incorporate Lindblad noise into this simulation. I have the following code (that I got from the qutip-qip documentation page): 

tlist = np.linspace(0, 30., 100)
coeff = tlist * 0.01
noise = DecoherenceNoise(
    sigmam(), targets=0,
    coeff=coeff, tlist=tlist)
processor = LinearSpinChain(1)
processor.add_noise(noise)
processor.load_circuit(qc)
tlist = np.linspace(0, 20, 300)
result = processor.run_state(init_state, tlist=tlist)

And I get this error: 
NotImplementedError: Gate QASMU cannot be resolved. 

Any help will be extremely appreciated, I'm happy to answer any follow up questions you have for me. Thanks!

William Aguilar

unread,
Jan 15, 2025, 11:34:16 AM1/15/25
to qu...@googlegroups.com
Hello, I think one of the problems you are having is that the gate you are specifying does not exist:

"QASMU", I attach in the link the gates available in qutip-qip

this are the gates are available:
__all__ = ['rx', 'ry', 'rz', 'sqrtnot', 'snot', 'phasegate', 'cphase', 'cnot',
           'csign', 'berkeley', 'swapalpha', 'swap', 'iswap', 'sqrtswap',
           'sqrtiswap', 'fredkin', 'toffoli', 'rotation', 'controlled_gate',
           'globalphase', 'hadamard_transform', 'gate_sequence_product',
           'gate_expand_1toN', 'gate_expand_2toN', 'gate_expand_3toN',
           'qubit_clifford_group']

Here is the documentation that can help you: https://qutip.org/docs/4.0.2/modules/qutip/qip/gates.html

Cheers, 

William

Karthik Venkatesh Nagaraj

unread,
Jan 15, 2025, 11:41:57 AM1/15/25
to QuTiP: Quantum Toolbox in Python
Thank you for the prompt response William.

Sorry, I should have been more clear. I am using the qutip-qip which (as described on its website), used to be a module qutip.qip under QuTiP (Quantum Toolbox in Python). From QuTiP 5.0, the community has decided to decrease the size of the core QuTiP package by reducing the external dependencies, in order to simplify maintenance. Hence a few modules are separated from the core QuTiP and will become QuTiP family packages. They are still maintained by the QuTiP team but hosted under different repositories in the QuTiP organization.

And under this, QASMU seems to be a valid gate.  

Karthik Venkatesh Nagaraj

unread,
Jan 15, 2025, 11:49:03 AM1/15/25
to QuTiP: Quantum Toolbox in Python
I've attached the screenshot of the QASMU gate from the qutip-qip documents. 
Screenshot 2025-01-15 204738.png
Reply all
Reply to author
Forward
0 new messages