asing
August 30, 2024, 7:54am
1
Hi!
I started to migrate my code with ITensorMPS and I encountered an error while running the following example from the libraray:
using ITensors, ITensorMPS
function ITensors.op(::OpName"expτSS", ::SiteType"S=1/2", s1::Index, s2::Index; τ)
h =
1 / 2 * op("S+", s1) * op("S-", s2) +
1 / 2 * op("S-", s1) * op("S+", s2) +
op("Sz", s1) * op("Sz", s2)
return exp(τ * h)
end
function main(; N=10, cutoff=1E-8, δt=0.1, ttotal=5.0)
# Compute the number of steps to do
Nsteps = Int(ttotal / δt)
# Make an array of 'site' indices
s = siteinds("S=1/2", N; conserve_qns=true)
# Make gates (1,2),(2,3),(3,4),...
gates = ops([("expτSS", (n, n + 1), (τ=-δt * im / 2,)) for n in 1:(N - 1)], s)
This file has been truncated. show original
WARNING: both ITensorMPS and ITensors export “ops”; uses of it in module Main must be qualified
ERROR: LoadError: UndefVarError: ops
not defined
This error doesn’t appear while only using ITensors library, however, the inner function throws an error in that case.
Is there a way to define these gates with ITensorMPS library?
If you change the line to gates = ITensors.ops(...
things should work
For the warning, the line should be @show inner(psi', rho, psi)
, the inner is missing a prime.
(also it would be helpful if you wanted to open a PR on github to fix these!)
That looks like a bug, the code in your original post should work. I’ll take a look.
The fix is being registered in ITensorMPS.jl v0.2.5, please update your packages and let us know if that fixes your original issue.
asing
September 2, 2024, 1:58am
6
Thank you for fixing the bug quickly.
However, I am having trouble with updating to v.0.2.5.
I removed the current version and tried to install it again, I am getting the following error:
(@v1.9 ) pkg> add ITensorMPS@v0.2.5
Resolving package versions…
ERROR: Unsatisfiable requirements detected for package ITensorMPS [0d1a4710]:
ITensorMPS [0d1a4710] log:
├─possible versions are: 0.1.0-0.2.4 or uninstalled
└─restricted to versions 0.2.5 by an explicit requirement — no versions left
Please try again, I’m able to update to ITensorMPS v0.2.5. You may have just tried too quickly and the registration process hadn’t completed.