MesoHOPS 1.8.0 - #8
Open
alexiahartzell wants to merge 1 commit into
Open
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
Highlights of v1.8.0 (vs. mesohops 1.7.0):
Tensor-network HOPS (TadHOPS):
- src/mesohops/tensor/: new subpackage representing the hierarchy
wavefunction as an MPS rather than a flat auxiliary-enumerated vector.
hops_tensor_wavefunction.py holds MPS storage, normalization, operator
application, and bond-dimension control; hops_tensor_eom.py and
tensor_eom_functions.py evaluate the EOM directly on the MPS;
mpo_constructors.py builds the Hamiltonian, dipole, and state-number
MPOs. Hierarchy depth lives in the MPS core dimensions (k_max + 1 per
mode), so n_hier, n_hmodes, and ADAPTIVE_H do not apply on this path.
Representation selected by method: 'number' (ground state implicit as
the all-zero MPS configuration) or 'fullstate'.
- src/mesohops/tensor/tdvp.py: one- and two-site TDVP following Paeckel
et al. (2019), in mixed canonical form over bare lists of np.ndarray.
Local update solvers: Arnoldi, Lanczos, solve_ivp.
- src/mesohops/trajectory/hops_tensor_trajectory.py: user-facing driver.
INTEGRATOR accepts 'TDVP1' and 'TDVP2' alongside 'RUNGE_KUTTA';
TDVP_UPDATE_TYPE selects the local update scheme (default 'krylov').
- src/mesohops/integrator/tensor_integrator.py: MPS-aware RK4 path.
- src/mesohops/util/tensor_operations.py: core MPS arithmetic (add,
compress via Oseledets rounding, extraction, contraction).
- Adaptivity is NOT supported for tensor HOPS in this release. The
adaptive paths (hops_tensor_basis.update_basis,
tensor_functions_adaptive.py, HopsTensorTrajectory.make_adaptive) are
present but unfinished, and are not blocked at runtime. Non-adaptive
tensor HOPS is unaffected. list_permanent_sites raises
NotImplementedError, since HopsTensorBasis never reads it and would
otherwise ignore it silently.
Hierarchy:
- src/mesohops/basis/hops_hierarchy.py: add TRUNCATION_METHOD
('triangular', the default and prior behavior, or 'rectangular').
define_rectangular_hierarchy() admits every per-mode depth combination
in [0, MAXHIER]^n_hmodes, matching the MPS core structure. Rectangular
truncation raises NotImplementedError for adaptive calculations: the
vector adaptive flux filters enforce the MAXHIER boundary through total
auxiliary depth, which is inherently triangular.
- src/mesohops/basis/hops_hierarchy.py: add_connections no longer
short-circuits the k+1 loop on total depth, required for rectangular
hierarchies whose per-mode depths may sum above MAXHIER.
- src/mesohops/basis/hops_hierarchy.py: a negative _count_by_modes entry
now raises ValueError rather than printing and continuing; the
MAXHIER > 255 notice moves from print to warnings.warn; remove the
private static method _const_aux_edge().
Spectroscopy:
- src/mesohops/util/nondyadic_spectroscopy.py: new dispatch on trajectory
type, tensor method, and Hilbert-space convention (embedded, vacuum,
excited_only).
System and storage:
- src/mesohops/basis/hops_system.py: add flag_nearest_neighbor_ham,
True when all non-zero Hamiltonian elements satisfy |row - col| <= 1.
Explicit stored zeros are eliminated first so padded sparse input is
not misclassified.
- src/mesohops/storage/hops_storage.py: add psi_g_traj storage option
capturing <0,...,0|psi> per step, needed by the vacuum-convention
spectroscopy path because extract_psi sees only excited-state slots.
- src/mesohops/storage/storage_functions.py: add tensor-aware
save_phi_traj_tensor, save_phi_norm_tensor, save_max_tensor_complexity.
Integration:
- src/mesohops/integrator/integrator_rk.py -> integrator.py: module
rename. Imports of runge_kutta_step and runge_kutta_variables must be
updated.
- src/mesohops/trajectory/hops_trajectory.py: move integrator setup into
an overridable _setup_integrator() hook so subclasses can register
additional integrators.
- src/mesohops/trajectory/hops_trajectory.py: add STORE_STEP_TIMING
integration parameter (default False). When enabled,
storage.metadata["LIST_PROPAGATION_TIME"] holds (t, elapsed) tuples per
step rather than one total-elapsed float per propagate() call.
Coverage:
- .github/workflows/coverage.yml: also run on pushes to master, so
Codecov has a base report to diff against; upgrade codecov-action from
the sunset v3 uploader to v5; rename the deprecated file: input to
files:; set fail_ci_if_error to true. Uploads had been failing silently
since the workflow was introduced, leaving every job green and Codecov
empty.
- .github/workflows/coverage.yml: run the coverage suite at --level 3,
overriding the --level=1 in pytest.ini addopts. At level 1 the level-2
and level-3 tests are deselected and contribute nothing, understating
measured coverage.
- README.md: add coverage badge.
Cleanup:
- tests/test_hierarchy_class.py -> test_hops_hierarchy.py: rename to
match its subject.
- tests/test_eom_hops_ksuper.py: correct a stale library name in a docstring.
- .gitignore: expand from a single *.pyc line to a full Python ignore set,
so coverage and build artifacts stop appearing as untracked noise.
- style_guide.md: document when to annotate docstring units, including
the [units: dimensionless] convention and bracket contents for
heterogeneous container types.
- .github/CODEOWNERS: add, gating master merges on approval from a listed
owner. Takes effect only where branch protection enables
require_code_owner_reviews.
Test results: level-1 suite passes 780/780 (2 xfailed, 93 deselected).
alexiahartzell
force-pushed
the
release-v1.8.0
branch
from
September 1, 2026 16:41
8e387d2 to
ec39c5c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MesoHOPS 1.8.0
This commit introduces tensor-network HOPS, a Matrix Product State representation of the hierarchy wavefunction, and adds rectangular hierarchy truncation, nondyadic spectroscopy, and per-step timing instrumentation.
Key improvements and features:
Tensor-network HOPS: The new
mesohops.tensorsubpackage represents the hierarchy wavefunction as a Matrix Product State rather than a flat auxiliary-enumerated vector.HopsTensorWavefunctionhandles MPS storage, normalization, operator application, and bond-dimension control;HopsTensorEOMevaluates the equation of motion directly on the MPS; andmpo_constructors.pybuilds the Hamiltonian, dipole, and state-number MPOs. Hierarchy depth is encoded in the MPS core dimensions (k_max + 1per mode) rather than through explicit auxiliary-vector enumeration, son_hier,n_hmodes, andADAPTIVE_Hdo not apply on this path. Two representations are available viamethod:'number', in which the ground state is implicit as the all-zero MPS configuration, and'fullstate'. Tensor adaptivity is not supported in this release — see the note below.Rectangular hierarchy truncation:
HopsHierarchygains aTRUNCATION_METHODparameter ('triangular', the default and prior behavior, or'rectangular').define_rectangular_hierarchy()admits every per-mode depth combination in[0, MAXHIER]^n_hmodes, matching the MPS core structure used by tensor HOPS. Rectangular truncation is unsupported for adaptive calculations and raisesNotImplementedError, because the vector adaptive flux filters enforce theMAXHIERboundary through total auxiliary depth, which is inherently triangular. Relatedly,add_connectionsno longer short-circuits the k+1 loop on total depth, which rectangular hierarchies require since their per-mode depths may sum aboveMAXHIER.Nondyadic spectroscopy:
util/nondyadic_spectroscopy.pydispatches on trajectory type, tensor method, and Hilbert-space convention:embedded, where the ground state occupies an explicit basis slot;vacuum, where it is the implicit all-zero MPS configuration; andexcited_only.Nearest-neighbor Hamiltonian detection:
HopsSystemexposesflag_nearest_neighbor_ham, computed at construction, indicating whether all non-zero Hamiltonian elements satisfy|row - col| <= 1. Explicit stored zeros are eliminated first so that a user-supplied sparse matrix with padded off-diagonals is not misclassified.Per-step timing and storage additions: A new
STORE_STEP_TIMINGintegration parameter (defaultFalse) records wall-clock time for each integration step. When enabled,storage.metadata["LIST_PROPAGATION_TIME"]holds(t, elapsed)tuples per step rather than a single total-elapsed float perpropagate()call; the default is unchanged. Apsi_g_trajstorage option captures<0,...,0|psi>per step, which the vacuum-convention spectroscopy path requires becauseextract_psisees only the excited-state slots.Integrator rename and hierarchy error handling:
mesohops.integrator.integrator_rkis renamed tomesohops.integrator.integrator, so code importingrunge_kutta_steporrunge_kutta_variablesmust update the import path. Integrator setup moved into an overridableHopsTrajectory._setup_integrator()hook so subclasses can register additional integrators.Warning
NOTE — this release breaks existing scripts that import the Runge-Kutta integrator.
mesohops.integrator.integrator_rkis renamed tomesohops.integrator.integrator, with no backwards-compatible alias, so any script importing from the old path fails immediately withModuleNotFoundError:Warning
NOTE — adaptivity is not supported for tensor HOPS in this release. The adaptive code paths (
HopsTensorBasis.update_basis,tensor_functions_adaptive.py, andHopsTensorTrajectory.make_adaptive) are present in the source but are not finished. Callingmake_adaptive()on aHopsTensorTrajectoryis not blocked at runtime, so do not use tensor adaptivity for production results. Non-adaptive tensor HOPS is unaffected.These enhancements extend MesoHOPS beyond vector HOPS into tensor-network territory, broadening the range of system sizes and bath structures the library can reach.