Skip to content

windowhamiltonian poc#417

Open
maartenvd wants to merge 4 commits intomainfrom
mvd/windowham
Open

windowhamiltonian poc#417
maartenvd wants to merge 4 commits intomainfrom
mvd/windowham

Conversation

@maartenvd
Copy link
Copy Markdown
Collaborator

draft pr for a windowhamiltonian type, resolving some pain points from #411

It wasn't possible in the past to correctly create a windowmps environments. The window uses a finitehamiltonian, but then the boundaries require an infinite hamiltonian. This new windowhamiltonian would keep track of the "bath" hamiltonian, and the finite hamiltonian for the window.

Misses full support for the abstractmpo interface, and I think a propagator+window test would be nice to have.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Your PR no longer requires formatting changes. Thank you for your contribution!

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/operators/windowhamiltonian.jl 0.00% 10 Missing ⚠️
src/algorithms/expval.jl 0.00% 2 Missing ⚠️
src/environments/finite_envs.jl 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/MPSKit.jl 100.00% <ø> (ø)
src/algorithms/propagator/corvector.jl 0.00% <ø> (-95.41%) ⬇️
src/environments/finite_envs.jl 0.00% <0.00%> (-100.00%) ⬇️
src/algorithms/expval.jl 0.00% <0.00%> (-92.60%) ⬇️
src/operators/windowhamiltonian.jl 0.00% <0.00%> (ø)

... and 77 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maartenvd maartenvd marked this pull request as ready for review April 29, 2026 08:08
Copy link
Copy Markdown
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I left some minor comments but otherwise I'm happy to merge this and go from there


function propagator(
A::AbstractFiniteMPS, z, H::FiniteMPOHamiltonian,
A::AbstractFiniteMPS, z, H,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A::AbstractFiniteMPS, z, H,
A::AbstractFiniteMPS, z::Number, H,

Doesnt matter too much but then it is consistent between the two flavors

Comment on lines +20 to +21
left_edge = (interval.start - 1) % length(ham)
left_ham = InfiniteMPOHamiltonian([ham[i] for i in (left_edge - length(ham) + 1):left_edge])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
left_edge = (interval.start - 1) % length(ham)
left_ham = InfiniteMPOHamiltonian([ham[i] for i in (left_edge - length(ham) + 1):left_edge])
left_edge = (interval.start - 1) % length(ham)
left_ham = circshift(ham, left_edge)

Should we just define circshift by itself on hamiltonians? It's probably as easy as InfiniteMPOHamiltonian(circshift(parent(copy(ham)), i))

right_edge = (interval.stop + 1) % length(ham)
right_ham = InfiniteMPOHamiltonian([ham[i] for i in right_edge:(right_edge + length(ham) - 1)])

finite_ham = FiniteMPOHamiltonian([ham[i] for i in interval])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
finite_ham = FiniteMPOHamiltonian([ham[i] for i in interval])
finite_ham = FiniteMPOHamiltonian(ham[interval])

Does this also work?

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.

2 participants