+1 vote
asked by (350 points)

Hello ITensors team !

I'm trying to construct an ferrimagnetic model with three magnetic centers (1/2- 5/2 - 1/2) which interact through the Heisenberg Hamiltonian. I know its possibile to implement the S=5/2 operators, but i'm facing some errors when try to construct the siteinds like this :

site = siteinds(n->isodd(n) ? "S=1/2" : "S=5/2" : "S=1/2", N; conserve_qns=true)

With the following error :

"
ERROR: MethodError: no method matching zero(::String)
Closest candidates are:
zero(!Matched::Union{Type{P}, P}) where P<:Dates.Period at /buildworker/worker/packagelinux64/build/usr/share/julia/stdlib/v1.6/Dates/src/periods.jl:53
zero(!Matched::AbstractIrrational) at irrationals.jl:148
zero(!Matched::T) where T<:Dates.TimeType at /buildworker/worker/package
linux64/build/usr/share/julia/stdlib/v1.6/Dates/src/types.jl:423 "

So my question is, in general how can us construct an general unit-cell(more than 2 spins, mixed spins types) to construct an MPO correctly them perform an dmrg calculation ?

Thanks for any help !

1 Answer

+1 vote
answered by (70.1k points)

Hi, thanks for the question. So I think the main problem is that

isodd(n) ? "S=1/2" : "S=5/2" : "S=1/2"

is not valid Julia syntax. Did you mean

isodd(n) ? "S=1/2" : "S=5/2"

instead?

commented by (350 points)
Hi Miles, thank you for the reply.

Yes, works only with 2 spins in an unit-cell. But i'm asking about an system with three spins in magnetic cell, i mean [ ...(s-S-s)-(s-S-s)...] structure. This is why i tried use three elements in siteinds syntax.
Using only two spins( isodd(n) ? "S=1/2" : "S=5/2") i can reproduce any cell, even with more then 2 elements of spins s=1/2 or S=5/2 ?

Again, Thank you !
commented by (70.1k points)
Hi Luis,
I see, thanks for clarifying - so what you need then is a function which will return various values based on a 3-site periodicity, and so using an inline if-else (? : ) type approach is going to be cumbersome.

Here is one solution that ought to work (I'd also suggest you double-check me and write a loop over n and print out the value of site_type(n) to verify and test it before using it inside of siteinds as I do below):


function site_type(n::Int)
       if mod(n,3)==2
         return "S=5/2"
       else
         return "S=1/2"
       end
end

site = siteinds(n -> site_type(n), N; conserve_qns=true)


Hope that gives you what you need!

Best,
Miles
commented by (350 points)
Hello Miles,

yes works using this function structure, thank you !
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

...