Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ authors:
orcid: "https://orcid.org/0000-0002-0858-291X"

title: "MPSKit"
version: 0.13.13
version: 0.14.0
doi: 10.5281/zenodo.10654900
date-released: 2026-06-09
date-released: 2026-10-05
url: "https://github.com/QuantumKitHub/MPSKit.jl"

references:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "MPSKit"
uuid = "bb1c41ca-d63c-52ed-829e-0820dda26502"
version = "0.13.13"
version = "0.14.0"
authors = "Lukas Devos, Maarten Van Damme and contributors"

[workspace]
Expand Down
3 changes: 2 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ DocumenterVitepress = "4710194d-e776-4893-9690-8d956a29c365"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502"
MPSKitModels = "ca635005-6f8c-4cd1-b51d-8491250ef2ab"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
TensorKitTensors = "41b62e7d-e9d1-4e23-942c-79a97adf954b"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"

[sources]
Expand All @@ -23,3 +23,4 @@ Documenter = "1.11"
DocumenterCitations = "1.5"
DocumenterInterLinks = "1"
DocumenterVitepress = "0.3.7"
TensorKitTensors = "0.3.1"
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ using DocumenterVitepress
using DocumenterCitations
using DocumenterInterLinks
include("overrides.jl")
include("src/assets/models.jl")

# examples
example_dir = joinpath(@__DIR__, "src", "examples")
Expand Down Expand Up @@ -48,8 +49,7 @@ links = InterLinks(
"TensorOperations" => "https://quantumkithub.github.io/TensorOperations.jl/stable/",
"KrylovKit" => "https://jutho.github.io/KrylovKit.jl/stable/",
"BlockTensorKit" => "https://quantumkithub.github.io/BlockTensorKit.jl/dev/",
"MatrixAlgebraKit" => "https://quantumkithub.github.io/MatrixAlgebraKit.jl/stable/",
"MPSKitModels" => "https://quantumkithub.github.io/MPSKitModels.jl/dev/"
"MatrixAlgebraKit" => "https://quantumkithub.github.io/MatrixAlgebraKit.jl/stable/"
)

# include MPSKit in all doctests
Expand Down
104 changes: 104 additions & 0 deletions docs/src/assets/models.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Model constructors for the MPSKit documentation and examples.
# Adapted from MPSKitModels.jl v0.4.7, src/models/{hamiltonians,transfermatrices}.jl:
# https://github.com/QuantumKitHub/MPSKitModels.jl/tree/v0.4.7/src/models
# Operators come from TensorKitTensors; chain assembly uses MPSKit directly.
#
# MIT License
# Copyright (c) 2021 Maarten Van Damme
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

module ExampleModels

using MPSKit, TensorKit
using TensorKitTensors: SpinOperators, BosonOperators, HubbardOperators

export chain_hamiltonian, transverse_field_ising, heisenberg_XXX
export hubbard_model, bose_hubbard_model, hard_hexagon

# L specifies an open finite chain; otherwise unitcell specifies an infinite chain.
function chain_hamiltonian(twosite, onesite = nothing; L = nothing, unitcell::Integer = 1)
nsites = isnothing(L) ? unitcell : L
nsites isa Integer && nsites > 0 || throw(ArgumentError("chain length must be a positive integer"))
nbonds = isnothing(L) ? nsites : nsites - 1
terms = Pair[(i, i + 1) => twosite for i in 1:nbonds]
if !isnothing(onesite)
append!(terms, [i => onesite for i in 1:nsites])
end
spaces = fill(space(twosite, 1), nsites)
constructor = isnothing(L) ? InfiniteMPOHamiltonian : FiniteMPOHamiltonian
return constructor(spaces, terms)
end

# H = -J sum(σz_i σz_{i+1} + g σx_i).
function transverse_field_ising(
T::Type{<:Number} = ComplexF64, symmetry::Type{<:Sector} = Trivial;
J = 1.0, g = 1.0, kwargs...
)
ZZ = 4 * SpinOperators.S_z_S_z(T, symmetry; spin = 1 // 2)
X = SpinOperators.σˣ(T, symmetry)
return chain_hamiltonian(-J * ZZ, -J * g * X; kwargs...)
end
transverse_field_ising(symmetry::Type{<:Sector}; kwargs...) =
transverse_field_ising(ComplexF64, symmetry; kwargs...)

# H = J sum(S_i ⋅ S_{i+1}); preserve the examples' spin-1 default.
function heisenberg_XXX(
T::Type{<:Number} = ComplexF64, symmetry::Type{<:Sector} = Trivial;
J = 1.0, spin = 1, kwargs...
)
term = J * SpinOperators.S_exchange(T, symmetry; spin)
return chain_hamiltonian(term; kwargs...)
end
heisenberg_XXX(symmetry::Type{<:Sector}; kwargs...) =
heisenberg_XXX(ComplexF64, symmetry; kwargs...)

# H = -t sum(e⁺_i e⁻_{i+1} + h.c.) + U sum(n↑ n↓) - mu sum(n).
function hubbard_model(
T::Type{<:Number} = ComplexF64, particle_symmetry::Type{<:Sector} = Trivial,
spin_symmetry::Type{<:Sector} = Trivial;
t = 1.0, U = 1.0, mu = 0.0, kwargs...
)
# e_hopping includes the fermionic reordering sign and is Hermitian.
hopping = HubbardOperators.e_hopping(T, particle_symmetry, spin_symmetry)
interaction = HubbardOperators.ud_num(T, particle_symmetry, spin_symmetry)
N = HubbardOperators.e_num(T, particle_symmetry, spin_symmetry)
return chain_hamiltonian(-t * hopping, U * interaction - mu * N; kwargs...)
end

# H = -t sum(b⁺_i b⁻_{i+1} + h.c.) + U/2 sum(n(n-1)) - mu sum(n).
function bose_hubbard_model(
T::Type{<:Number} = ComplexF64, symmetry::Type{<:Sector} = Trivial;
cutoff::Integer = 5, t = 1.0, U = 1.0, mu = 0.0, kwargs...
)
hopping = BosonOperators.b_plus_b_min(T, symmetry; cutoff) +
BosonOperators.b_min_b_plus(T, symmetry; cutoff)
N = BosonOperators.b_num(T, symmetry; cutoff)
interaction = N * (N - id(domain(N)))
return chain_hamiltonian(-t * hopping, U / 2 * interaction - mu * N; kwargs...)
end

function hard_hexagon(T::Type{<:Number} = ComplexF64)
P = Vect[FibonacciAnyon](:τ => 1)
O = ones(T, P ⊗ P ← P ⊗ P)
block(O, FibonacciAnyon(:I)) .*= 0
return InfiniteMPO([O])
end

end
Loading
Loading