# How do I perform an two-qubit erasure error in stim?

I try to simulate two-qubit erasure error by using CORRELATED_ERROR, ELSE_CORRELATED_ERROR, and an ancilla which is mentioned in How do I perform an erasure error in stim?. Then I simulate two-qubit erasure error in surface code by following codes.

pro = [0.00625, 0.006289308176100629, 0.006329113924050633, 0.006369426751592357, 0.006410256410256411, 0.006451612903225807, 0.006493506493506495, 0.006535947712418302, 0.006578947368421053, 0.006622516556291391, 0.006666666666666667, 0.006711409395973155, 0.006756756756756757, 0.006802721088435375, 0.006849315068493151, 0.006896551724137932]

circuit = stim.Circuit(f"""
R 1 2 999
E({pro[0]}) X999
ELSE_CORRELATED_ERROR({pro[1]}) X2 X999
ELSE_CORRELATED_ERROR({pro[2]}) Y2 X999
ELSE_CORRELATED_ERROR({pro[3]}) Z2 X999
ELSE_CORRELATED_ERROR({pro[4]}) X1 X999
ELSE_CORRELATED_ERROR({pro[5]}) X1 X2 X999
ELSE_CORRELATED_ERROR({pro[6]}) X1 Y2 X999
ELSE_CORRELATED_ERROR({pro[7]}) X1 Z2 X999
ELSE_CORRELATED_ERROR({pro[8]}) Y1 X999
ELSE_CORRELATED_ERROR({pro[9]}) Y1 X2 X999
ELSE_CORRELATED_ERROR({pro[10]}) Y1 Y2 X999
ELSE_CORRELATED_ERROR({pro[11]}) Y1 Z2 X999
ELSE_CORRELATED_ERROR({pro[12]}) Z1 X999
ELSE_CORRELATED_ERROR({pro[13]}) Z1 X2 X999
ELSE_CORRELATED_ERROR({pro[14]}) Z1 Y2 X999
ELSE_CORRELATED_ERROR({pro[15]}) Z1 Z2 X999
M 999
DETECTOR rec[-1]
""")


The pro array is chosen to ensure that the probability of each error mode is 0.00625. And I replace DEPOLARIZE2 error with the noise described in code and expect I will get a higher threshold because it gives information on the specific gate where the loss occurred. However, the result is that I get a lower threshold.

Is there a feasible way to simulate a two-qubit erasure error?

• Can you define what a two qubit erasure is? Commented Mar 12 at 4:45
• Following a two-qubit gate in which an erasure error occurs, both atoms are replaced with fresh ancilla atoms in a mixed state I/2 . We model this in the simulations by applying a Pauli error chosen uniformly at random from {I, X, Y, Z}⊗{I, X, Y, Z}. Simulation results about two-qubit erasure error is mentioned in paper (arXiv:2201.03540v1) Commented Mar 12 at 5:02
• Your implementation looks correct to me. You could try sampling the circuit and confirming the statistics make sense. The most likely place where things might be failing is if your decoder does not understand the heralding relationship between the herald detector and other detection events, after this has been converted into a detector error model. Commented Mar 12 at 5:16
• Is there any decoder which can understand the heralding relationship between the herald detector and other detection events in stim? Commented Mar 12 at 7:25
• I assumed you had a decoder with that property if you were trying to use the erasures. I don't know any open source ones that do it automatically. Commented Mar 12 at 7:32