Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions models/model_moire_c4.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,18 @@ def build_moire_c4(
twobody.report(warn_frac)
logger.info("")

# AutoMPO repeatedly compresses the running operator sum. At production
# sizes, the interaction-map order contains long sequences that decay to
# ~1e-10 and then jump back to ~1e-2 at the next index family. Adding in
# that order can make the repeated norm redistribution ill-conditioned
# and eventually feed non-finite values to an SVD. Magnitude ordering is
# algebraically neutral, deterministic (Python's sort is stable), and
# keeps each partial sum well scaled. Zero terms naturally move last and
# remain filtered by build_hamiltonian.
interactions.sort(key=lambda interaction: abs(interaction.cpl), reverse=True)
logger.info(" Ordered interactions by descending |coupling| for stable AutoMPO accumulation")
logger.info("")

# Attach coefficient tables on the ops dict for tests / inspection.
ops['_moire_B'] = B
ops['_moire_V'] = Vtable
Expand Down
2 changes: 1 addition & 1 deletion registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ categories:
- name: model_moire_c4
file: models/model_moire_c4.py
description: LLL-projected C4 moire model builder for Alice
sha256: a4c3b224270fdf73b9f57ee7221756f6a3de990a3467c7126c4d87c858902554
sha256: 809fa874fe7b1972ab3f38c89e9b1a591227acf667820c029c8effc41df03baa

intrcmaps:
description: Interaction maps for Alice
Expand Down
Loading