Skip to content

Commit

Permalink
Start using ITensorMPS.jl (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored May 10, 2024
1 parent be9d201 commit 444c720
Show file tree
Hide file tree
Showing 30 changed files with 46 additions and 44 deletions.
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ version = "0.1.0"
[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66"

[compat]
Compat = "3, 4"
HDF5 = "0.15, 0.16"
ITensors = "0.3.48"
HDF5 = "0.15, 0.16, 0.17"
ITensorMPS = "0.1"
ITensors = "0.3.48, 0.4, 0.5, 0.6"
Infinities = "0.1"
IterTools = "1"
KrylovKit = "0.5, 0.6"
KrylovKit = "0.5, 0.6, 0.7"
OffsetArrays = "1"
QuadGK = "2"
Requires = "1"
SplitApplyCombine = "1.2.2"
julia = "1.6"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ julia> using Pkg; Pkg.add(url="https://github.com/mtfishman/ITensorInfiniteMPS.j

This package is a work in progress. Here are some examples of the interface:
```julia
julia> using ITensors, ITensorInfiniteMPS
julia> using ITensors, ITensorMPS, ITensorInfiniteMPS

julia> s = siteinds("S=1/2", 3)
3-element Array{Index{Int64},1}:
Expand Down
2 changes: 1 addition & 1 deletion examples/development/finite_mps_to_infinite_mps.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

# H = -J Σⱼ XⱼXⱼ₊₁ - h Σⱼ Zⱼ
Expand Down
2 changes: 1 addition & 1 deletion examples/development/orthogonalize_infinitemps.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Random

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/development/vumps/vumps_from_dmrg.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Random

Expand Down
2 changes: 1 addition & 1 deletion examples/development/vumps/vumps_ising_noncontiguous.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/development/vumps/vumps_localham.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Random

Expand Down
2 changes: 1 addition & 1 deletion examples/development/vumps/vumps_localham_qns.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Random

Expand Down
2 changes: 1 addition & 1 deletion examples/development/vumps/vumps_mpo.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Random

Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/src/entropy.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

# calculate -\sum_i rho_i log(rho_i)
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/src/vumps_subspace_expansion.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

# Alternate steps of running TDVP and increasing the bond dimension.
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/transfer_matrix_spectrum.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

include(
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/vumps_2d_heisenberg.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ITensorInfiniteMPS
using ITensors
using ITensors, ITensorMPS

include(
joinpath(
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/vumps_heisenberg.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

include(
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/vumps_hubbard_extended.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

base_path = joinpath(pkgdir(ITensorInfiniteMPS), "examples", "vumps", "src")
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/vumps_ising.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

base_path = joinpath(pkgdir(ITensorInfiniteMPS), "examples", "vumps", "src")
Expand Down
2 changes: 1 addition & 1 deletion examples/vumps/vumps_ising_extended.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS

include(
Expand Down
11 changes: 1 addition & 10 deletions src/ITensorInfiniteMPS.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
module ITensorInfiniteMPS

# For `only`, which was introduced in Julia v1.4
using Compat
using ITensors
# For optional ITensorsVisualization dependency.
using Requires
using ITensors, ITensorMPS
# For using ∞ as lengths, ranges, etc.
using Infinities
# For functions like `isdiag`
Expand Down Expand Up @@ -85,10 +82,4 @@ export Cell,
,
,
×

function __init__()
# This is used for debugging using visualizations
@require ITensorsVisualization = "f2aed53d-2f32-47c3-a7b9-1ee253853786" @eval using ITensorsVisualization
end

end
6 changes: 4 additions & 2 deletions src/ITensors.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using ITensorMPS: MPS
using ITensors.NDTensors: NDTensors, tensor
using ITensors: ITensors, IndexSet, QN, Tag, TagSet, dag, inds, isdiag, sim
using LinearAlgebra: LinearAlgebra, eigen

############################################################################
# imports.jl
Expand Down Expand Up @@ -131,8 +135,6 @@ ITensors.noncommoninds(is::IndexSet) = is
# itensor.jl
#

using ITensors.NDTensors

# Helpful for making sure the ITensor doesn't contract
ITensors.sim(A::ITensor) = ITensors.setinds(A, sim(inds(A)))

Expand Down
11 changes: 9 additions & 2 deletions src/vumps_generic.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
using ITensorMPS: ITensorMPS, linkinds, tdvp
using ITensors: δ, dag, noprime, prime
using ITensors.NDTensors: denseblocks
using KrylovKit: exponentiate

struct Hᶜ{T}
∑h::InfiniteSum{T}
Hᴸ::InfiniteMPS
Expand Down Expand Up @@ -151,7 +156,7 @@ function tdvp_iteration(args...; multisite_update_alg="sequential", kwargs...)
end
end

function tdvp(
function ITensorMPS.tdvp(
solver::Function,
∑h,
ψ;
Expand Down Expand Up @@ -232,7 +237,9 @@ function vumps(
)
end

function tdvp(args...; time_step, solver_tol=(x -> x / 100), eager=true, kwargs...)
function ITensorMPS.tdvp(
args...; time_step, solver_tol=(x -> x / 100), eager=true, kwargs...
)
solver = if !isinf(time_step)
println("Using TDVP solver with time step $time_step")
flush(stdout)
Expand Down
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[deps]
ITensorInfiniteMPS = "1dc1fb26-a137-4954-ae60-1bd4106e95ad"
ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
2 changes: 1 addition & 1 deletion test/test_iMPOConversions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test

Expand Down
2 changes: 1 addition & 1 deletion test/test_itensormap.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test
using Random
Expand Down
2 changes: 1 addition & 1 deletion test/test_readwrite.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using ITensorInfiniteMPS.HDF5
using Test
Expand Down
2 changes: 1 addition & 1 deletion test/test_unitcell_qns.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test
using Random
Expand Down
2 changes: 1 addition & 1 deletion test/test_vumps.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test
using Random
Expand Down
2 changes: 1 addition & 1 deletion test/test_vumps_extendedising.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test
using Random
Expand Down
2 changes: 1 addition & 1 deletion test/test_vumpsmpo.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test
using Random
Expand Down
2 changes: 1 addition & 1 deletion test/test_vumpsmpo_fqhe.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors
using ITensors, ITensorMPS
using ITensorInfiniteMPS
using Test
using Random
Expand Down

0 comments on commit 444c720

Please sign in to comment.