Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the user documentation for model Hamiltonian workflows by adding a new LatticeGraph data-class page, substantially enhancing the Model Hamiltonians guide, and updating example scripts used by the docs.
Changes:
- Added comprehensive
LatticeGraphdocumentation and linked it into the data-class index. - Expanded
model_hamiltonians.rstwith sections for Hückel/Hubbard/PPP and Heisenberg/Ising models, plus parameter flexibility and new examples. - Updated/added Python and C++ example scripts for the new documentation; adjusted a test helper to use
QubitHamiltonian.get_real_coefficients().
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tests/test_model_hamiltonians.py | Simplifies Pauli-term extraction in tests via get_real_coefficients(). |
| docs/source/user/comprehensive/model_hamiltonians.rst | Major doc expansion: overview, model definitions, potentials, and usage examples. |
| docs/source/user/comprehensive/data/lattice_graph.rst | New documentation page for LatticeGraph with usage and serialization examples. |
| docs/source/user/comprehensive/data/index.rst | Adds LatticeGraph into the data-class quick reference and toctree. |
| docs/source/_static/examples/python/model_hamiltonians.py | New/expanded Python example script referenced by the docs. |
| docs/source/_static/examples/python/lattice_graph.py | New Python example script for lattice creation/querying/serialization. |
| docs/source/_static/examples/python/basis_set.py | Adds cleanup of example output files after serialization snippet. |
| docs/source/_static/examples/cpp/model_hamiltonians.cpp | New C++ examples for model Hamiltonians (currently has API/include issues). |
| docs/source/_static/examples/cpp/lattice_graph.cpp | New C++ examples for lattice graphs (currently has include issues). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📊 Coverage Summary
Detailed Coverage ReportsC++ Coverage DetailsPython Coverage DetailsPybind11 Coverage Details |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
cpp/include/qdk/chemistry/utils/model_hamiltonians.hpp:309
- In
_build_ppp_integrals,V_ijwas changed toV(i, j)(removing the previous0.5), but the nested loop still iterates over all ordered pairsi != jand each iteration updates bothh1_dense(i,i)andh1_dense(j,j)and also incrementsenergy_offset. This now double-counts the one-body corrections andenergy_offset(e.g., core energy and diagonal shifts become 2× larger than the PPP formula / current unit tests expect). To match the stated convention (“two-body integrals stored without the 1/2 prefactor”) without double counting, either (a) iterate only over unique pairs (e.g.,for (int j = i + 1; j < n; ++j)) while updating both diagonals and the offset once per pair and explicitly writing both(ii|jj)and(jj|ii)entries, or (b) keep thei != jloop but update only theidiagonal per iteration and apply a0.5factor to the scalar/one-body corrections (not the stored two-body integrals).
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) continue;
double V_ij = V(i, j);
if (V_ij == 0.0) continue;
// two-body: (ii|jj) = V_ij for both orderings
h2[{i, i, j, j}] += V_ij;
// one-body correction: -sum_{j!=i} V_ij z_j applied to h_ii
h1_dense(i, i) -= V_ij * z(j);
h1_dense(j, j) -= V_ij * z(i);
// scalar offset: 1/2 sum_{i!=j} V_ij z_i z_j = sum_{i<j} V_ij z_i z_j
energy_offset += V_ij * z(i) * z(j);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…odel-hamiltonians-examples-docs
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR adds docs for: