qdk_chemistry.data._spin_channels module
Internal per-spin-channel helpers over symmetry-blocked data.
These helpers are not part of the public API. User code should read
symmetry-blocked tensors and index sets through their primitive accessors
(SymmetryBlockedTensor.block([...]) and
SymmetryBlockedIndexSet.indices(SymmetryLabel([...]))) with explicit
SymmetryLabel values.
They exist only for internal library and test use, where they additionally encapsulate the trivial (spin-free) vs spin-resolved label selection so the same call works for restricted, unrestricted, and model (symmetry-free) orbitals.
- qdk_chemistry.data._spin_channels.spin_channel_indices(index_set: qdk_chemistry.data.symmetry.SymmetryBlockedIndexSet, channel: qdk_chemistry.data.symmetry.SpinValue) list[int]
Indices for a single spin channel of a SymmetryBlockedIndexSet as a flat list. Pass the channel explicitly, e.g. axes.alpha() or axes.beta(); for a spin-free set the sole trivial-label segment serves every channel. Returns an empty list when ‘index_set’ is None.
- qdk_chemistry.data._spin_channels.spin_channel_matrix(coefficients, channel)[source]
Per-spin dense block of a rank-2 (coefficient-like) SymmetryBlockedTensor.
Returns the block for
channel; for a restricted (spin-equivalent) tensor the alpha and beta blocks share storage, so either channel selection succeeds.- Parameters:
coefficients (SymmetryBlockedTensorRank2) – A rank-2 SymmetryBlockedTensor (e.g. orbital coefficients).
channel (SpinValue) – The spin channel to select, e.g.
axes.alpha()oraxes.beta().
- Returns:
The requested spin channel’s dense block as a NumPy array.
- qdk_chemistry.data._spin_channels.spin_channel_vector(energies, channel)[source]
Per-spin dense block of a rank-1 (energy-like) SymmetryBlockedTensor.
Returns the block for
channel; for a restricted (spin-equivalent) tensor the alpha and beta blocks share storage, so either channel selection succeeds.- Parameters:
energies (SymmetryBlockedTensorRank1) – A rank-1 SymmetryBlockedTensor (e.g. orbital energies).
channel (SpinValue) – The spin channel to select, e.g.
axes.alpha()oraxes.beta().
- Returns:
The requested spin channel’s dense block as a NumPy array.