Skip to content

Stage 1: generic two-center model (overlap S = I + 2C)#5

Open
cortner wants to merge 11 commits into
mainfrom
stage1-overlap
Open

Stage 1: generic two-center model (overlap S = I + 2C)#5
cortner wants to merge 11 commits into
mainfrom
stage1-overlap

Conversation

@cortner

@cortner cortner commented Jun 9, 2026

Copy link
Copy Markdown
Member

Stage 1 of the linear 2-center model (plan in agents/plan_lin2c.md, design §8). Base: main (#4 merged).

What this adds

  • src/linear2c/blocks.jlOrbitalBasis (per-species shell lists) and global matrix block bookkeeping (OrbitalLayout, shell_range, species_norb, maxL).
  • src/linear2c/twocenter.jlTwoCenterModel + assemble: a generic linear bond-only two-center model (a generalized Slater–Koster table), of which the overlap matrix is the first instantiation:
    • Purely off-site assembly: for each ordered shell pair and admissible Λ, bond harmonics φ^b_{nΛ}(r_ji) = R^b_{nΛ}(r) Y_{Λ}(r̂) are contracted with learnable per-(species-pair, shell-pair, Λ) coefficients and recoupled to the (m,m') block via transform_Λ (Stage 0). Callers add their own on-site term — overlap: S = I + assemble(model, …).
    • Only even-parity (l+l'+Λ) channels contribute — complete for any single-bond quantity.
    • Hermiticity via post-hoc X ← ½(X+Xᵀ).
    • Graph input + PBC (plan §3.3): graph(model, sys) / assemble(model, G::ETGraph, W) via ET.Atoms.interaction_graph (NeighbourLists-backed). Periodic-image bonds — including self-images — accumulate into the same block (Γ-point convention). A brute-force bondlist is retained as the free-cluster cross-check.
  • Bond radial basis from ACEpotentials.Models.ace_learnable_Rnlrzz (the decided dependency; species as Int atomic numbers); angular basis from Polynomials4ML real spherical harmonics.
  • New direct deps: NeighbourLists, Unitful (both already in the dependency tree); test extras AtomsBase, AtomsBuilder.

Notes / decisions in play

  • Design revision (2026-07-06): S and H are separate, independent models — no single model producing the pair (H, S). The initial focus is experimentation with possibly unrelated forms of S and H, and S is much cheaper; they share building blocks only (agents/plan_lin2c.md §3.6, docs/src/twocenter.md §§1, 8, 10, 11, 14).
  • Rename (this PR): OverlapModel/assemble_S → generic TwoCenterModel/assemble; on-site handling moved to the caller.
  • Bond basis is evaluated per edge directly rather than through ET.EdgeEmbed (whose pooled layout targets the env basis) — recorded as a deviation in the plan. Lux-layer glue is Stage-5 scope.
  • Parameter layout is multi-species from the start (indexed by ordered species-pair and shell-pair), though the cheapest tests use single-species Si.
  • Verified the Polynomials4ML real-SH ordering (degree-l block at (l²+1):(l+1)², ascending m) is equivariant with O3.D_from_angles(·,real), consistent with the coupling from Stage 0.

Tests (351 total)

§12 suite restricted to the 2C model: rotational equivariance, inversion equivariance + parity signs, Hermiticity, permutation equivariance, cutoff smoothness ( envelope, vanishing beyond r_cut), plus the new graph + PBC set: free-cluster graph path ≡ brute-force bondlist, PBC Hermiticity (self-image bonds), translation invariance under wrap, rotational equivariance with rotated cell.

🤖 Generated with Claude Code

Implements the linear two-center overlap model end-to-end:
- blocks.jl: OrbitalBasis (per-species shells) and global matrix block
  bookkeeping (OrbitalLayout, shell_range).
- overlap.jl: OverlapModel + assemble_S. On-site S_ii = identity; off-site
  S_ij is a bond-harmonic expansion recoupled via transform_Λ, summing only
  proper-parity (l+l'+Λ even) channels since a single bond vector is a proper
  tensor. Hermiticity by post-hoc symmetrization ½(S+Sᵀ).
- Bond radial basis via ACEpotentials.Models.ace_learnable_Rnlrzz; angular
  basis via Polynomials4ML real spherical harmonics.

Adds ACEpotentials / Polynomials4ML / Random deps and the §12 symmetry suite
restricted to S: rotation, inversion (+parity), Hermiticity, permutation,
cutoff smoothness (311 tests total).
cortner added 6 commits June 8, 2026 21:42
A single bond vector supplies only even-(l+l'+Λ) channels, which is complete for
a two-center quantity (the count matches Slater-Koster). Reword the comments
accordingly; :proper -> :even. No behaviour change.
Follow-up to the BlockCoupling refactor on #4: the parities field is gone, so
the overlap model computes the even-(l+l'+L) check via channel_parity at the
point it selects channels.
Base automatically changed from stage0-coupling to main June 11, 2026 18:26
cortner added 4 commits June 11, 2026 11:29
Design revision: the overlap and Hamiltonian models are independent
structs with independent hypers, parameters, and forward passes.
Rationale: initial focus is experimentation with possibly unrelated
forms of S and H, and S is much cheaper than H. Shared building blocks
(coupling, embeddings, block bookkeeping) remain at the code level.
Stage 1's OverlapModel already follows this design.
- Rename overlap.jl -> twocenter.jl, OverlapModel -> TwoCenterModel,
  assemble_S -> assemble: the model is a generic linear bond-only
  two-center model (generalized Slater-Koster table), not overlap-
  specific. It now assembles the purely off-site matrix; callers add
  their on-site term (overlap: S = I + assemble(model, ...)).
- Graph input per plan sec 3.3: graph(model, sys) and
  assemble(model, G::ETGraph, W) via ET.Atoms.interaction_graph
  (NeighbourLists-backed, PBC incl. self-image bonds, Gamma-point).
  bondlist retained as the brute-force free-cluster cross-check.
- New deps: NeighbourLists, Unitful (both already in the dep tree);
  test extras AtomsBase, AtomsBuilder.
- Tests: renamed to test_twocenter.jl; new graph+PBC testset (free-
  cluster cross-check, PBC Hermiticity, translation-with-wrap,
  rotation of positions and cell). Plan/design docs updated.
@cortner cortner changed the title Stage 1: two-center overlap model S Stage 1: generic two-center model (overlap S = I + 2C) Jul 6, 2026
@cortner

cortner commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

On hold. This staged implementation has become hard to review and will be restarted from scratch. The PR stays open for reference, but it should not be merged or updated for now.

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.

1 participant