Skip to content

mbpt: handle bare-Tensor summands in ref_av#571

Merged
ajay-mk merged 1 commit into
masterfrom
ajay/fix/refav-bare-tensor-summand
Jul 6, 2026
Merged

mbpt: handle bare-Tensor summands in ref_av#571
ajay-mk merged 1 commit into
masterfrom
ajay/fix/refav-bare-tensor-summand

Conversation

@ajay-mk

@ajay-mk ajay-mk commented Jul 5, 2026

Copy link
Copy Markdown
Member
  • tensor::ref_av asserted every post-Wick summand is a Product.
  • A one-body operator in product form (h * a†_p * a_q) produces a fully-contracted core-trace term h^O_O that simplify() folds into a bare Tensor, tripping the assert.
  • See the new unit test to reproduce.

/cc @shivupa

project_rdm_indices_to_target() assumed every summand of the expanded
post-Wick sum is a Product and asserted it. A one-body operator in
non-normal-ordered product form (e.g. h * a+_p * a_q) yields a
fully-contracted core-trace term (h^O_O) that simplify() folds into a
bare Tensor with unit coefficient, tripping
SEQUANT_ASSERT(is<Product>()).
Wrap non-Product summands so they are handled uniformly.

Add a regression test in the MRSO section: ref_av of such an operator
now returns h^O_O + γ^u_v h^v_u instead of aborting.
@ajay-mk
ajay-mk merged commit 473f88b into master Jul 6, 2026
16 checks passed
@ajay-mk
ajay-mk deleted the ajay/fix/refav-bare-tensor-summand branch July 6, 2026 03:16
@shivupa

shivupa commented Jul 6, 2026

Copy link
Copy Markdown

Awesome thanks for the rapid response. This fixes it for me with Apple clang 21. On Arch/gcc16 I still have some issues but that is separate from this.

@ajay-mk

ajay-mk commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@shivupa Could you please open an issue about the GCC issues?

@ajay-mk ajay-mk added the bug Something isn't working label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants