From b48527fa6db6021b94e683aba479ab20da9bcde3 Mon Sep 17 00:00:00 2001 From: Shuhei OHNO Date: Tue, 6 Oct 2026 12:31:07 +0900 Subject: [PATCH] Fix QTT dependency API and deuteron documentation example --- Project.toml | 2 +- docs/src/GEM.md | 2 +- ext/TwoBodyQTTExt.jl | 38 +++++++++++++++++++------------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Project.toml b/Project.toml index 123775f..0db784a 100644 --- a/Project.toml +++ b/Project.toml @@ -37,6 +37,6 @@ Optimisers = "0.2, 0.3, 0.4" QuadGK = "2.11" SpecialFunctions = "2.3.1" Subscripts = "0.1.3" -TensorTrainNumerics = "1.1.4" +TensorTrainNumerics = "1.1.6" Zygote = "0.6, 0.7" julia = "1.10" diff --git a/docs/src/GEM.md b/docs/src/GEM.md index 1e23ddd..db43b54 100644 --- a/docs/src/GEM.md +++ b/docs/src/GEM.md @@ -131,7 +131,7 @@ using TwoBody ℏ²c²m⁻¹ = 41.471 H = Hamiltonian( - Laplacian(coefficient = -ℏ²c²m⁻¹), + TwoBody.Laplacian(coefficient = -ℏ²c²m⁻¹), Gaussian(coefficient = 200.0, exponent = 1.487), Gaussian(coefficient = -178.0, exponent = 0.639), ) diff --git a/ext/TwoBodyQTTExt.jl b/ext/TwoBodyQTTExt.jl index 1ed692e..a0ec54e 100644 --- a/ext/TwoBodyQTTExt.jl +++ b/ext/TwoBodyQTTExt.jl @@ -1,7 +1,6 @@ module TwoBodyQTTExt using TwoBody -import Logging import TensorTrainNumerics import TwoBody: PotentialTerm, V, matrix @@ -52,9 +51,10 @@ function _qttvector(f::Function, method::QuanticsTensorTrainMethod) algorithm = TensorTrainNumerics.MaxVol( tol=method.tolerance, - rmax=method.maxbonddim, - maxiter=method.maxiter, - verbose=false, + max_bond=method.maxbonddim, + max_sweeps=method.maxiter, + verbosity=0, + show_progress=false, ) return TensorTrainNumerics.tt_cross( evaluate, @@ -70,7 +70,7 @@ function _compress_vector(vector::QTTVector, method::QuanticsTensorTrainMethod) TensorTrainNumerics.tt_compress!( compressed, method.maxbonddim; - truncerr=method.tolerance, + trunc_tol=method.tolerance, ) return compressed end @@ -80,7 +80,7 @@ function _compress_operator(operator::QTTMatrix, method::QuanticsTensorTrainMeth TensorTrainNumerics.tt_compress!( fused, method.maxoperatorbonddim; - truncerr=method.tolerance, + trunc_tol=method.tolerance, ) return TensorTrainNumerics.ttv_to_tto(fused) end @@ -124,19 +124,19 @@ _ttdot(left::QTTVector, right::QTTVector) = TensorTrainNumerics.dot(left, right) function _dmrg_groundstate(operator::QTTMatrix, guess::QTTVector, method::QuanticsTensorTrainMethod) normalized_guess = guess / _ttnorm(guess) - history, state, rank_history = Logging.with_logger(Logging.NullLogger()) do - TensorTrainNumerics.dmrg_eigsolve( - operator, - normalized_guess; - N=2, - tol=method.tolerance, - sweep_schedule=[method.sweeps], - rmax_schedule=[method.maxbonddim], - it_solver=true, - linsolv_maxiter=method.maxiter, - linsolv_tol=max(sqrt(method.tolerance), 1e-8), - ) - end + history, state, rank_history = TensorTrainNumerics.dmrg_eigsolve( + operator, + normalized_guess; + nsites=2, + trunc_tol=method.tolerance, + max_sweeps=method.sweeps, + max_bond=method.maxbonddim, + local_solver=:iterative, + local_maxiter=method.maxiter, + local_tol=max(sqrt(method.tolerance), 1e-8), + verbosity=0, + show_progress=false, + ) state = state / _ttnorm(state) return last(history), state, history, rank_history end