Alice 0.1.6 — MPS Initialization for Odd Chains
Release Date: June 10, 2026
Version 0.1.6 extends init_mps with explicit quantum-number targeting, fixes a silent
zero-MPS bug for odd-L random initializations, and upgrades the warning system to use
Python's standard logging module. No breaking changes.
🔢 init_mps: target_qn Parameter
- New keyword argument
target_qnoninit_mps: specifies the desired right-boundary
chargeQ[L]— the total quantum number of the chain. WhenNone(default) the target
isQ_vac(half-filling), preserving existing behavior for even-L even-filling cases. - Both modes honor
target_qn:- Product state (
bond_dim=1):_auto_configtargetstarget_qn; the resulting
bond charge pathQ[0..L]must end attarget_qn. The right boundary is always
Q[L](rigid, determined by the charge path). - Random MPS (
bond_dim>1):_auto_configtargetstarget_qnto obtain a
physically appropriate center-bond charge; the right boundary index is then pinned
explicitly totarget_qn, decoupling the boundary from the path.
- Product state (
- When an explicit
target_qnis given and the auto-config cannot reach it (e.g.
target_qn=0for odd-L spin-½),init_mpsraises aValueErrorin both modes
rather than silently constructing an MPS in the wrong sector.
🔧 Odd-L Random MPS Fix
- Bug fixed: for odd chain lengths with the default
target_qn=None,_random_mps
previously pinned both boundary indices toOp['vac'](chargeQ_vac). Because no
site configuration can return the bond charge toQ_vacin an odd number of fusion
steps, every charge block of the last tensor was forbidden, and the MPS canonicalized
to zero. - The right boundary index is now constructed with
effective_right = Q[L](the actual
charge at the end of the auto-config path) whentarget_qnwas not given explicitly.
For even L this is stillQ_vac; for odd L it is the correct non-vacuum charge,
producing a non-zero MPS with the expected sector. - The
Opparameter of_random_mpshas been removed (internal cleanup); the left
boundary is now built fromQ[0]and the right boundary fromtarget_qnor
effective_right.
🔔 Warning System Upgrade
init_mpsno longer callswarnings.warn(UserWarning)when the auto-config cannot
close toQ_vac(e.g. odd L). The message is now emitted via
logging.getLogger(__name__).warning(...), consistent with Alice's structured logging
infrastructure. The message text recommends passingtarget_qnexplicitly.- The module-level
import warningsis replaced byimport loggingand a
logger = logging.getLogger(__name__)instance.
♻️ _auto_config Generalization
_auto_config(L, Spc, group, Q_vac, target_qn)— the function now accepts a
target_qnparameter (previously hardcoded toQ_vac). All three internal strategies
(single-sector fill, period-2 alternation, greedy fallback) targettarget_qnrather
thanQ_vac.- The period-2 alternation strategy no longer applies a per-period shortcut; the full
length-L path is checked againsttarget_qnfor correctness with any target, not just
Q_vac. - The greedy fallback minimizes
_charge_dist(Q_next, target_qn)instead of
_charge_dist(Q_next, Q_vac). For Abelian 2-sector spaces this reachestarget_qn
exactly when it is achievable. _auto_configis now a pure helper with no side effects; the single warning site is
init_mps.
📖 Documentation
docs/api/network/init-mps.mdgains three new sections:- Logic Overview — ASCII decision diagram showing how
target_qn,config,
Q[L], andbond_diminteract insideinit_mps. - Odd-chain lengths — explains the default WARNING behavior, the
target_qn
fix path, and theValueErrorguard; includes a runnable spin-½ example. - Updated Bond Sectors in Random Mode — clarifies that BFS is seeded from the
center-bond chargeQ_c = Q[L//2]of the targeted auto-config, not fromQ_vac.
- Logic Overview — ASCII decision diagram showing how
- The Charge Conventions section is updated to note that the center-bond charge is
zero only for even L with a balanced auto-config.
📊 Statistics
- 814 tests across 23 test modules (up from ~795 / 23 modules in v0.1.5)
- 5 commits since v0.1.5
- 4 files changed, 423 insertions, 89 deletions
- 22 source modules in three subpackages:
alice.network,alice.physics,
alice.algorithm.dmrg
✅ Compatibility
Breaking Changes: None — fully backward compatible with v0.1.5. All import paths,
function signatures (except the internal _random_mps and _auto_config), TOML
configuration keys, and geometry APIs are unchanged. Existing calls to init_mps
without target_qn behave identically to v0.1.5 for even-L chains; odd-L chains no
longer silently produce a zero random MPS.
Requirements:
- Python ≥ 3.11
- PyTorch ≥ 2.5
- Nicole ≥ 0.3.7
📝 Notes
The zero-MPS bug for odd-L random initialization was a silent correctness issue: no
exception was raised, DMRG would accept the zero state, and all energies would be
numerically zero or NaN after the first sweep. The fix is unconditional — the right
boundary is always set to the charge that the auto-config actually reaches.
The target_qn parameter also matters for even-L systems with non-half-filling targets
(e.g. a doped chain) or any case where the desired sector differs from Q_vac. Before
this release, such cases required passing an explicit config; target_qn now provides
a higher-level interface that delegates sector arithmetic to _auto_config.