From 4d288f5ed98c1f14d9331b5f2e8ea1ed1e0a7e7f Mon Sep 17 00:00:00 2001 From: mtfishman Date: Wed, 23 Jul 2025 15:42:08 -0400 Subject: [PATCH 1/2] Delete noise from TDVP --- Project.toml | 2 +- src/solvers/sweep_update.jl | 15 --------------- test/base/test_dmrg.jl | 29 ++++++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Project.toml b/Project.toml index e28bc99..93d763c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorMPS" uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" authors = ["Matthew Fishman ", "Miles Stoudenmire "] -version = "0.3.18" +version = "0.3.19" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/solvers/sweep_update.jl b/src/solvers/sweep_update.jl index ac6cc24..d89c433 100644 --- a/src/solvers/sweep_update.jl +++ b/src/solvers/sweep_update.jl @@ -77,7 +77,6 @@ function sub_sweep_update( maxdim=default_maxdim(), mindim=default_mindim(), cutoff=default_cutoff(ITensors.scalartype(state)), - noise=default_noise(), ) reduced_operator = copy(reduced_operator) state = copy(state) @@ -117,7 +116,6 @@ function sub_sweep_update( time_step, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -176,7 +174,6 @@ function region_update!( time_step, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -197,7 +194,6 @@ function region_update!( time_step, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -220,7 +216,6 @@ function region_update!( time_step, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -265,7 +260,6 @@ function region_update!( time_step, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -332,7 +326,6 @@ function region_update!( outputlevel, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -357,9 +350,6 @@ function region_update!( spec = nothing ortho = isforward(direction) ? "left" : "right" drho = nothing - if noise > 0.0 && isforward(direction) - drho = noise * noiseterm(reduced_operator, reduced_state, ortho) - end spec = replacebond!( state, b, @@ -390,7 +380,6 @@ function region_update!( outputlevel, normalize, direction, - noise, which_decomp, svd_alg, cutoff, @@ -413,9 +402,6 @@ function region_update!( spec = nothing ortho = isforward(direction) ? "left" : "right" drho = nothing - if noise > 0.0 && isforward(direction) - drho = noise * noiseterm(reduced_operator, phi, ortho) - end spec = replacebond!( state, b, @@ -462,7 +448,6 @@ function region_!( time_step, normalize, direction, - noise, which_decomp, svd_alg, cutoff, diff --git a/test/base/test_dmrg.jl b/test/base/test_dmrg.jl index 28affb7..ecbafa0 100644 --- a/test/base/test_dmrg.jl +++ b/test/base/test_dmrg.jl @@ -1,5 +1,32 @@ using ITensors, Test, Random -using ITensorMPS: dmrg, nsite, set_nsite!, siteinds, site_range +using ITensorMPS: + DMRGObserver, + MPO, + MPS, + OpSum, + ProjMPO, + ProjMPOSum, + Sweeps, + add!, + cutoff!, + dmrg, + energies, + linkdim, + maxdim!, + measurements, + mindim!, + noise!, + nsite, + op, + orthogonalize!, + position!, + random_mps, + rproj, + set_nsite!, + siteind, + siteinds, + site_range, + truncerrors @testset "Basic DMRG" begin @testset "Spin-one Heisenberg" begin From 4064a623211d0624e7cf2404c2ebbe3db30fac10 Mon Sep 17 00:00:00 2001 From: mtfishman Date: Wed, 23 Jul 2025 16:29:41 -0400 Subject: [PATCH 2/2] Bring back noise but disable in tdvp --- src/solvers/sweep_update.jl | 15 +++++++++++++++ src/solvers/tdvp.jl | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/src/solvers/sweep_update.jl b/src/solvers/sweep_update.jl index d89c433..9fc0100 100644 --- a/src/solvers/sweep_update.jl +++ b/src/solvers/sweep_update.jl @@ -77,6 +77,7 @@ function sub_sweep_update( maxdim=default_maxdim(), mindim=default_mindim(), cutoff=default_cutoff(ITensors.scalartype(state)), + noise=default_noise(), ) reduced_operator = copy(reduced_operator) state = copy(state) @@ -116,6 +117,7 @@ function sub_sweep_update( time_step, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -174,6 +176,7 @@ function region_update!( time_step, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -194,6 +197,7 @@ function region_update!( time_step, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -216,6 +220,7 @@ function region_update!( time_step, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -260,6 +265,7 @@ function region_update!( time_step, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -326,6 +332,7 @@ function region_update!( outputlevel, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -350,6 +357,9 @@ function region_update!( spec = nothing ortho = isforward(direction) ? "left" : "right" drho = nothing + if noise > 0.0 && isforward(direction) + drho = noise * noiseterm(reduced_operator, reduced_state, ortho) + end spec = replacebond!( state, b, @@ -380,6 +390,7 @@ function region_update!( outputlevel, normalize, direction, + noise, which_decomp, svd_alg, cutoff, @@ -402,6 +413,9 @@ function region_update!( spec = nothing ortho = isforward(direction) ? "left" : "right" drho = nothing + if noise > 0.0 && isforward(direction) + drho = noise * noiseterm(reduced_operator, reduced_state, ortho) + end spec = replacebond!( state, b, @@ -448,6 +462,7 @@ function region_!( time_step, normalize, direction, + noise, which_decomp, svd_alg, cutoff, diff --git a/src/solvers/tdvp.jl b/src/solvers/tdvp.jl index 02d8c5c..7510e26 100644 --- a/src/solvers/tdvp.jl +++ b/src/solvers/tdvp.jl @@ -80,8 +80,12 @@ function tdvp( nsteps=nsweeps, (step_observer!)=default_sweep_observer(), (sweep_observer!)=(step_observer!), + noise=nothing, kwargs..., ) + if !isnothing(noise) + error("`noise` is not supported in `tdvp` right now.") + end time_step, nsteps = time_step_and_nsteps(t, time_step, nsteps) return alternating_update( operator,