Skip to content

Change defaults for mbpt::lst and op::vac_av/op::ref_av - #584

Open
ajay-mk wants to merge 6 commits into
masterfrom
ajay/flip-lst-defaults
Open

Change defaults for mbpt::lst and op::vac_av/op::ref_av#584
ajay-mk wants to merge 6 commits into
masterfrom
ajay/flip-lst-defaults

Conversation

@ajay-mk

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

Copy link
Copy Markdown
Member

Two MBPT defaults assumed the caller knew about operator connectivity:

  • mbpt::lst now uses explicit commutators, [A,B] = AB - BA by default. Can be switched to the cheaper connected form with an option in LSTOptions
  • op::vac_av/op::ref_av no longer default to default_op_connections(). They connect nothing unless asked.

Note

This will cause some changes in Manuscript examples, I will update them accordingly.

The CC class is unaffected: it passes its connectivity and its lst form explicitly.

The change:

Keep the old behavior by asking for it:

auto hbar = lst(H(), T(2), 4, {.use_connected_form = true});
auto eqs = ref_av(P(2) * hbar, {.connect = default_op_connections()});

Or take the new default and drop the connectivity:

auto hbar = lst(H(), T(2), 4);
auto eqs = ref_av(P(2) * hbar);

Both will give the same equations.

Documentation on mbpt::lst is moved out of the CC class file and LSTOptions are now documented.

ajay-mk added 5 commits July 30, 2026 16:33
The connected-product form of a commutator, (AB)_c, is only equal to
AB - BA if the caller connects the operators when taking the expectation
value. Making it the default meant that anyone who did not pass
OpConnections got a wrong answer with no diagnostic.

LSTOptions::use_commutators is replaced by use_connected_form, a plain
bool defaulting to false. The flag no longer tracks the unitary flag
through a std::optional, and the call sites that depart from the default
now read as a positive statement of what they want.

The CC class supplies connectivity on the traditional path, so its lst
calls ask for the connected-product form explicitly, which keeps its
equations unchanged.
Defaulting to default_op_connections() silently imposed a Hamiltonian to
cluster-operator connection on every caller. A reader who has not asked
for any connectivity does not expect one, and now that lst writes
explicit commutators the connections are redundant for its output.

Callers that build connected products must now pass
{.connect = default_op_connections()} themselves. The CC class already
passes its connectivity explicitly, so its equations are unchanged.
Adapts the tests to the two new defaults without changing what any of
them checks. Expressions written as connected products now ask for that
form with use_connected_form = true, and the sites that relied on the
implicit default_op_connections() now pass it.
Documents all three LSTOptions fields, explains when explicit
commutators and connected products each apply, and warns against mixing
them. Records the new vac_av/ref_av default in the operator guide and
updates its example, which builds a connected product, to pass the
connections it needs.
lst is no longer part of the CC class. It transforms any expression
built from mbpt::Operator, so it belongs next to vac_av/ref_av in the
operator guide. The CC page keeps a pointer to it where it discusses
truncating the commutator expansion.
@ajay-mk
ajay-mk force-pushed the ajay/flip-lst-defaults branch from f2011d2 to 902cd07 Compare July 30, 2026 20:36
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