-
Notifications
You must be signed in to change notification settings - Fork 11
Add lattice tutorial #32
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
Add lattice tutorial #32
Conversation
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.
In general very good, just remove unnecessary tests, validations and try excepts as commented.
docs/source/tutorials/lattice.ipynb
Outdated
"# Environment info for reproducibility\n", | ||
"import sys, platform\n", | ||
"\n", | ||
"try:\n", |
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.
no need so many try
, just import and print
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.
and tc.about()
one line can give all the information
"id": "b3f40e81", | ||
"metadata": {}, | ||
"source": [ | ||
"## Quick Start Guide\n", |
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.
the first line of a jupyter must be H1, namely # Title
, you can move the quick start part below the title
docs/source/tutorials/lattice.ipynb
Outdated
"id": "9a7ff355", | ||
"metadata": {}, | ||
"source": [ | ||
"# Lattice Geometries in TensorCircuit\n", |
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.
this is the title, which should be the first line
docs/source/tutorials/lattice.ipynb
Outdated
"\n", | ||
"This tutorial introduces the unified and extensible **Lattice API** in TensorCircuit, a powerful framework for defining and working with quantum systems on various geometric structures.\n", | ||
"\n", | ||
"## Prerequisites\n", |
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.
Prerequisites -> Setup
docs/source/tutorials/lattice.ipynb
Outdated
"except Exception:\n", | ||
" K = tc.set_backend(\"numpy\")\n", | ||
" # Set precision to float64 for better numerical accuracy\n", | ||
" tc.set_dtype(\"float64\")\n", |
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.
In tc, we in general set dtype as complex128
docs/source/tutorials/lattice.ipynb
Outdated
"id": "63118376", | ||
"metadata": {}, | ||
"source": [ | ||
"## 2. Custom geometry: Kagome fragment\n", |
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.
this is not a kagome lattice but a triangular lattice
docs/source/tutorials/lattice.ipynb
Outdated
} | ||
], | ||
"source": [ | ||
"# Validation: Rydberg Hamiltonian on 2-site chain (mirrors tests)\n", |
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.
no need to include the test validation in the tutorial
docs/source/tutorials/lattice.ipynb
Outdated
} | ||
], | ||
"source": [ | ||
"# Heisenberg 2-site chain (isotropic) validation\n", |
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.
no need for these validations
Thanks for your review The following are the main changes I have changed the title. And removed unnecessary condition checks and changed the text and comments accordingly. Deleted test validations. Other detial changes according to the comment |
LGTM now |
@all-contributors please add @Stellogic for tutorials |
I've put up a pull request to add @Stellogic! 🎉 |
Summary
Add tutorial lattice.ipynb that demonstrates the new Lattice API: building lattices (Square/Chain/Customize), neighbor queries, Hamiltonian builders (Heisenberg/Rydberg), gate-layer scheduling, and a differentiable Lennard-Jones optimization example. The notebook also includes test-backed validation snippets reused from existing tests/examples.