55generalized 2D toric code Hamiltonian with open boundary conditions and provides comparison
66among different ansätze: FLDC, GLDC, and FDC.
77
8+ Reference:
9+ - [arXiv:2311.01393](https://arxiv.org/pdf/2311.01393)
810"""
911
1012from itertools import product
@@ -29,24 +31,40 @@ def build_toric_hamiltonian(
2931 The Hamiltonian is: H = - (1 - h) \sum A_v - (1 - h) \sum B_p - h \sum (hx * X_i + hz * Z_i)
3032 where A_v are vertex operators (X products) and B_p are plaquette operators (Z products).
3133
32- Plaquette Operators at Boundaries:
34+ **Operator Definitions with Open Boundaries:**
3335
34- In the toric code with open boundary conditions, each plaquette operator B_p acts on the
35- four edges surrounding a single plaquette. For interior plaquettes, all four edges exist.
36- However, at the boundaries, the treatment remains consistent:
36+ In this model, qubits reside on the edges of the lattice.
3737
38- - Each plaquette (i,j) is defined for i in [0, Lx-1] and j in [0, Ly-1]
39- - The four edges (top, bottom, left, right) are always well-defined within the lattice
40- - Boundary plaquettes still have four edges, but some of these edges may be at the physical boundary
41- - No special weighting is applied to boundary plaquettes (unlike vertex operators, which are weighted as 0.5 or 0.75)
38+ Vertex Operators (A_v):
39+
40+ * Vertex operators are defined on each **vertex** (i,j), where
41+ `i` in [0, Lx] and `j` in [0, Ly]. There are `(Lx + 1) * (Ly + 1)` vertices.
42+ * **Boundary Terms:** Vertices on the physical boundary connect to fewer edges:
43+ * **Bulk vertices** (interior) connect to 4 edges. (Weight 1.0)
44+ * **Edge vertices** (non-corner) connect to 3 edges. (Weight 0.75)
45+ * **Corner vertices** connect to 2 edges. (Weight 0.5)
46+ * The code correctly identifies these and applies the corresponding 2, 3, or 4-body
47+ 'X' operators with the specified weights.
48+
49+ Plaquette Operators (B_p):
50+
51+ * Plaquette operators are defined on each **plaquette** (or face) (i,j), where
52+ `i` in [0, Lx-1] and `j` in [0, Ly-1]. There are `Lx * Ly` plaquettes.
53+ * **No Boundary Terms:** In this lattice definition, *every* plaquette,
54+ including those at the physical boundary, is surrounded by exactly four edges
55+ (top, bottom, left, right).
56+ * Therefore, all `B_p` operators are 4-body 'Z' terms, and no special
57+ boundary weighting is applied.
58+
59+ **Qubit Indexing:**
4260
4361 The qubit indices for each edge are calculated as:
44- - Horizontal edges: indexed sequentially along rows
45- - Vertical edges: indexed after all horizontal edges
46- - Top edge: i * Ly + j
47- - Bottom edge: (i + 1) * Ly + j
48- - Left edge: num_horizontal + i * (Ly + 1) + j
49- - Right edge: left + 1
62+ - Horizontal edges: indexed sequentially along rows (0 to num_horizontal - 1)
63+ - Vertical edges: indexed after all horizontal edges (num_horizontal to num_qubits - 1)
64+ - Top edge of plaquette (i,j) : i * Ly + j
65+ - Bottom edge of plaquette (i,j) : (i + 1) * Ly + j
66+ - Left edge of plaquette (i,j) : num_horizontal + i * (Ly + 1) + j
67+ - Right edge of plaquette (i,j) : left + 1
5068
5169 :param Lx: Number of plaquettes in x-direction
5270 :type Lx: int
@@ -164,34 +182,6 @@ def get_plaquette_qubits(i: int, j: int, Lx: int, Ly: int) -> Dict[str, int]:
164182 }
165183
166184
167- def building_block (circuit : tc .Circuit , params : tf .Variable , q1 : int , q2 : int ) -> None :
168- """
169- Apply a parameterized two-qubit gate sequence.
170-
171- Gate sequence: RZ-RY-RZ-RZ-RXX-RYY-RZZ-RZ-RY-RZ-RZ
172-
173- :param circuit: Quantum circuit
174- :type circuit: tc.Circuit
175- :param params: 11 parameters for the gate sequence
176- :type params: tf.Variable
177- :param q1: Qubit index 1
178- :type q1: int
179- :param q2: Qubit index 2
180- :type q2: int
181- """
182- circuit .RZ (q1 , theta = params [0 ])
183- circuit .RY (q2 , theta = params [1 ])
184- circuit .RZ (q1 , theta = params [2 ])
185- circuit .RZ (q2 , theta = params [3 ])
186- circuit .RXX (q1 , q2 , theta = params [4 ])
187- circuit .RYY (q1 , q2 , theta = params [5 ])
188- circuit .RZZ (q1 , q2 , theta = params [6 ])
189- circuit .RZ (q1 , theta = params [7 ])
190- circuit .RY (q2 , theta = params [8 ])
191- circuit .RZ (q1 , theta = params [9 ])
192- circuit .RZ (q2 , theta = params [10 ])
193-
194-
195185def building_block_su4 (
196186 circuit : tc .Circuit , params : tf .Variable , q1 : int , q2 : int
197187) -> None :
@@ -208,8 +198,6 @@ def building_block_su4(
208198 :type q2: int
209199 """
210200 circuit .SU4 (q1 , q2 , theta = params )
211- # su4_gate = tc.gates.su4_gate(params)
212- # circuit.any(su4_gate, q1, q2)
213201
214202
215203def fldc_claw_ansatz (
0 commit comments