Skip to content

Conversation

Stellogic
Copy link
Contributor

@Stellogic Stellogic commented Aug 17, 2025

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.

Copy link
Member

@refraction-ray refraction-ray left a 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.

"# Environment info for reproducibility\n",
"import sys, platform\n",
"\n",
"try:\n",
Copy link
Member

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

Copy link
Member

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",
Copy link
Member

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

"id": "9a7ff355",
"metadata": {},
"source": [
"# Lattice Geometries in TensorCircuit\n",
Copy link
Member

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

"\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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prerequisites -> Setup

"except Exception:\n",
" K = tc.set_backend(\"numpy\")\n",
" # Set precision to float64 for better numerical accuracy\n",
" tc.set_dtype(\"float64\")\n",
Copy link
Member

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

"id": "63118376",
"metadata": {},
"source": [
"## 2. Custom geometry: Kagome fragment\n",
Copy link
Member

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

}
],
"source": [
"# Validation: Rydberg Hamiltonian on 2-site chain (mirrors tests)\n",
Copy link
Member

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

}
],
"source": [
"# Heisenberg 2-site chain (isotropic) validation\n",
Copy link
Member

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

@Stellogic
Copy link
Contributor Author

Stellogic commented Aug 18, 2025

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

@refraction-ray
Copy link
Member

LGTM now

@refraction-ray refraction-ray merged commit ed1f631 into tensorcircuit:master Aug 18, 2025
1 check passed
@refraction-ray
Copy link
Member

@all-contributors please add @Stellogic for tutorials

Copy link
Contributor

@refraction-ray

I've put up a pull request to add @Stellogic! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants