From f762459ac6428939f5e268cab3a6cccb1c81d3cf Mon Sep 17 00:00:00 2001 From: lkdvos Date: Mon, 22 Jun 2026 09:45:03 -0400 Subject: [PATCH 1/3] Fix FiniteExcited docstring energy penalty sign Co-Authored-By: Claude Opus 4.8 (1M context) --- src/algorithms/excitation/dmrgexcitation.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/excitation/dmrgexcitation.jl b/src/algorithms/excitation/dmrgexcitation.jl index 57fdd8440..c3bcf6c07 100644 --- a/src/algorithms/excitation/dmrgexcitation.jl +++ b/src/algorithms/excitation/dmrgexcitation.jl @@ -4,7 +4,7 @@ $(TYPEDEF) Variational optimization algorithm for excitations of finite MPS by minimizing the energy of ```math -H - λᵢ |ψᵢ⟩⟨ψᵢ| +H + λᵢ |ψᵢ⟩⟨ψᵢ| ``` ## Fields From 794d1937ea1643fed93738a6b20e7d31f7be18d8 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Mon, 22 Jun 2026 09:45:12 -0400 Subject: [PATCH 2/3] Return FiniteExcited excitations in ascending energy order Co-Authored-By: Claude Opus 4.8 (1M context) --- src/algorithms/excitation/dmrgexcitation.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/excitation/dmrgexcitation.jl b/src/algorithms/excitation/dmrgexcitation.jl index c3bcf6c07..cae12b607 100644 --- a/src/algorithms/excitation/dmrgexcitation.jl +++ b/src/algorithms/excitation/dmrgexcitation.jl @@ -37,8 +37,8 @@ function excitations( nstates = (states..., ne) ens, excis = excitations(H, alg, nstates; init = init, num = num - 1) - push!(ens, expectation_value(ne, H)) - push!(excis, ne) + pushfirst!(ens, expectation_value(ne, H)) + pushfirst!(excis, ne) return ens, excis end From 8ed417ced6ecf45415107a64de29beabadeb7b66 Mon Sep 17 00:00:00 2001 From: lkdvos Date: Mon, 22 Jun 2026 09:49:29 -0400 Subject: [PATCH 3/3] add test --- test/algorithms/excitations.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/algorithms/excitations.jl b/test/algorithms/excitations.jl index d2d65b52c..26322f85f 100644 --- a/test/algorithms/excitations.jl +++ b/test/algorithms/excitations.jl @@ -74,8 +74,9 @@ verbosity_conv = 1 DMRG(; verbosity, tol = 1.0e-6), DMRG2(; verbosity, tol = 1.0e-6, trscheme = trunctol(; atol = 1.0e-4)), ) - energies_dm, _ = @testinferred excitations(H, FiniteExcited(; gsalg), ψ) + energies_dm, _ = @testinferred excitations(H, FiniteExcited(; gsalg), ψ; num = 3) @test energies_dm[1] ≈ energies_QP[1] + expectation_value(ψ, H, envs) atol = 1.0e-4 + @test issorted(real.(energies_dm)) end # find energy with Chepiga ansatz