0 votes
asked by (550 points)
edited by

Hi, evergyone.

who knows how set the maximal number states in the TEBD evolution?

the codes as follow

using ITensors

let
N = 100
cutoff = 1E-8
tau = 0.1
ttotal = 5.0

# Compute the number of steps to do
Nsteps = Int(ttotal/tau)

# Make an array of 'site' indices
s = siteinds("S=1/2",N;conserve_qns=true)

# Make gates (1,2),(2,3),(3,4),...
gates = ITensor[]
for j=1:N-1
s1 = s[j]
s2 = s[j+1]
hj = op("Sz",s1) * op("Sz",s2) +
1/2 * op("S+",s1) * op("S-",s2) +
1/2 * op("S-",s1) * op("S+",s2)
Gj = exp(-1.0im * tau/2 * hj)
push!(gates,Gj)
end
# Include gates in reverse order too
# (N,N-1),(N-1,N-2),...
append!(gates,reverse(gates))

# Initialize psi to be a product state (alternating up and down)
psi = productMPS(s, n -> isodd(n) ? "Up" : "Dn")

c = div(N,2) # center site

# Compute and print initial value on site c
t = 0.0
Sz = expect(psi,"Sz";site_range=c:c)
println("$t $Sz")

# Do the time evolution by applying the gates
# for Nsteps steps and printing on site c
for step=1:Nsteps
psi = apply(gates, psi; cutoff=cutoff)
t += tau
Sz = expect(psi,"Sz";site_range=c:c)
println("$t $Sz")
end

return
end

1 Answer

0 votes
answered by (14.1k points)

You should be able to use the keyword maxdim.

commented by (550 points)
edited by
Thanks a lot.
 more question :  the system has 'conserve_qns=true'. I want to overlap the psi with another state $\psi_f=(|00>+|11>)_{1,2}(|00>+|11>)_{3,4}......(|00>+|11>)_{99,100}$.  
  s1=removeqns(s)
  psif=randomMPS(s1,linkdims=2)
.....

inner(psi,psif)

ERROR: LoadError: Indices must have the same spaces to be replaced.
commented by (14.1k points)
You could try:

    psi_dense = removeqns(psi)
    inner(psi_dense, psif)

So that you take the inner product of two states without qns.
commented by (550 points)
another error :   LoadError: MethodError: no method matching removeqns(::MPS)
commented by (14.1k points)
Sorry about that, try `psi_dense = dense(psi)` instead.

`removeqns` should be defined, that's a bug. I'll raise an issue about it.
commented by (550 points)
Thank you again. The code can be executed. Another method  we change
s = siteinds("S=1/2",N;conserve_qns=true)  to  s = siteinds("S=1/2",N;conserve_qns=false).
The evolution of system will need more time  and more memory.
Best wishes
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...