ITensors.jl: Custom SiteTypes

Hello,

I have been tweaking around with ITensors.jl package (GitHub - ITensor/ITensors.jl: A Julia library for efficient tensor computations and tensor network calculations) to create custom SitesTypes. I have tried the following and I am stuck with TagType (though this is included in the ITensors.jl file):

julia> using ITensors

julia> const SpinHalfSite = Union{TagType"S=1/2", TagType"SpinHalf"}
ERROR: LoadError: UndefVarError: @TagType_str not defined
in expression starting at REPL[2]:1

julia> import ITensors: TagType

julia> const SpinHalfSite = Union{TagType"S=1/2", TagType"SpinHalf"}
ERROR: LoadError: UndefVarError: @TagType_str not defined
in expression starting at REPL[4]:1

Though creating a new sitetype.jl file and including it in ITensors.jl works fine, is there a way to actually create new SiteTypes on the fly without tweaking the source?

Thanks!

PS: I am aware that the package in context is not production ready and in the preview stages, but any insight on the above issue would be great. Also, I did not want to open an issue as this seemed to be more like a trivial issue. Finally, it would be great to know if there are some pointers on which one can contribute to the above package (for this I have scanned through the Issues on github but did not find any good for beginners tags, so any insight on this would also be helpful).

Hi, co-developer of ITensors.jl here. (I was just checking for the first time to see if there had been any ITensor related questions on this forum.) We have our own discussion board where you can post ITensor-specific questions here: ITensor Support Q&A . Also feel free to email us a support@itensor.org

To briefly answer your question, I recently posted some extensive code examples about this feature here:
http://itensor.org/docs.cgi?vers=julia&page=formulas/tagtype

We are also working right now to make this process even simpler, but the current approach above will still work after those updates. Of course please email us if you have more questions.

Best regards,
Miles

I guess the issue was addressed in one of the latest commit: Export @TagType_str macro for making custom TagTypes outside of libra… · ITensor/ITensors.jl@740196c · GitHub

Thanks! I will get back to you if I have any questions.

Best,
Amit.

1 Like