qdk_chemistry.migrate._sbt module

Build SymmetryBlockedTensor JSON from dense spin-channel arrays.

Legacy serializations stored integrals and orbital coefficients as plain dense arrays; the current schema stores them as SymmetryBlockedTensor documents. These helpers rebuild the tensor JSON using only the live qdk_chemistry.data.symmetry bindings and serializing the result, so the migration never hand-writes the symmetry-blocked JSON layout.

qdk_chemistry.migrate._sbt.rank2_dict(alpha, beta=None)[source]

Rank-2 spin-diagonal SBT JSON (e.g. one-body integrals, MO coefficients).

alpha may be rectangular (AO x MO); the per-slot extents are taken from its shape. beta is None builds a spin-restricted tensor.

Return type:

dict

Parameters:

beta (ndarray | None)

qdk_chemistry.migrate._sbt.rank1_dict(alpha, beta=None)[source]

Rank-1 spin-diagonal SBT JSON (e.g. orbital energies).

Return type:

dict

Parameters:

beta (ndarray | None)

qdk_chemistry.migrate._sbt.rank4_dict(aaaa, aabb=None, bbbb=None)[source]

Rank-4 spin-diagonal SBT JSON for two-body integrals.

aabb and bbbb is None build a spin-restricted tensor: a single underlying block aliased to all four (aaaa, aabb, bbbb, bbaa) spin keys, matching the canonical restricted layout produced by the C++ core.

Return type:

dict

Parameters:
qdk_chemistry.migrate._sbt.rank3_three_center_dict(aa, bb=None)[source]

Rank-3 SBT JSON for Cholesky three-center MO integrals.

Each spin block is the dense [norb**2, naux] matrix (row index p*norb+q) over two spin-orbital axes and a trivial-symmetry auxiliary axis. bb is None builds the restricted form (the beta block aliases alpha).

Return type:

dict

Parameters:

bb (ndarray | None)

qdk_chemistry.migrate._sbt.sparse_rank4_dict(entries, norb)[source]

Restricted rank-4 SymmetryBlockedSparseMap JSON from [p, q, r, s, v] entries.

Return type:

dict

Parameters:

norb (int)

qdk_chemistry.migrate._sbt.rank4_rdm_dict(aaaa, aabb, bbbb=None)[source]

Rank-4 SBT JSON for a spin-dependent active 2-RDM.

Unlike two-body integrals (where the restricted channels are equal), the same-spin (aaaa) and opposite-spin (aabb) 2-RDM channels differ. bbbb is None builds the restricted form: two distinct blocks aliased by the restricted spin orbit (bbbb from aaaa, bbaa from aabb).

Return type:

dict

Parameters:

bbbb (ndarray | None)