-
Notifications
You must be signed in to change notification settings - Fork 12
VQE example for the Toric Code Model #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This module implements VQE optimization for finding ground states of the generalized 2D toric code Hamiltonian with open boundary conditions and provides comparison among different ansätze: FLDC, GLDC, and FDC.
| Build the generalized 2D toric code Hamiltonian with open boundary conditions. | ||
|
|
||
| The Hamiltonian is: H = -(1-h)∑A_v - (1-h)∑B_p - h∑(hx*X_i + hz*Z_i) | ||
| where A_v are vertex operators (X products) and B_p are plaquette operators (Z products). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more elaboration on how plaquette operators is defined at the boundary
| circuit.RZ(q1, theta=params[7]) | ||
| circuit.RY(q2, theta=params[8]) | ||
| circuit.RZ(q1, theta=params[9]) | ||
| circuit.RZ(q2, theta=params[10]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how this is su4 gate as su4 gate has 15 parameters? though it is ok for demonstration here, the latest version of tc has native c.su4(i, i+1, theta=vec_15).
| c: tc.Circuit, h: float, hx: float, hz: float, Lx: int, Ly: int | ||
| ) -> float: | ||
| """Calculate toric code energy for a given circuit state.""" | ||
| H = build_toric_hamiltonian(Lx=Lx, Ly=Ly, h=h, hx=hx, hz=hz) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then H is built every iteration? a bad design
|
In general looks good, but some changes are required as comments |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
This module implements VQE optimization for finding ground states of the generalized 2D toric code Hamiltonian with open boundary conditions and provides comparison among different ansätze: FLDC, GLDC, and FDC. The new example demonstrates how to build the model, configure ansätze, run optimization, and compare energies and convergence behavior.