# ITensors.jl: Custom SiteTypes

**URL:** <https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717>\
**Category:** Numerics\
**Tags:** package, physics\
**Created:** [May 18, 2020, 8:18pm UTC](https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717 "2020-05-18T20:18:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amitjamadagni](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amitjamadagni/32/3570_2.png) [@amitjamadagni](https://discourse.julialang.org/u/amitjamadagni)\
**Post date:** [May 18, 2020, 8:18pm UTC](https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717/1 "2020-05-18T20:18:21Z")

</div>

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](https://github.com/ITensor/ITensors.jl)) 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
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).

---

<div class="post-metadata">

**Author:** ![miles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles/32/29112_2.png) [@miles](https://discourse.julialang.org/u/miles)\
**Post date:** [June 8, 2020, 6:00pm UTC](https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717/2 "2020-06-08T18:00:14Z")

</div>

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](http://itensor.org/support/) . Also feel free to email us a [support@itensor.org](mailto: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](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

---

<div class="post-metadata">

**Author:** ![amitjamadagni](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amitjamadagni/32/3570_2.png) [@amitjamadagni](https://discourse.julialang.org/u/amitjamadagni)\
**Post date:** [June 8, 2020, 6:14pm UTC](https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717/3 "2020-06-08T18:14:14Z")

</div>

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](https://github.com/ITensor/ITensors.jl/commit/740196c0d280be3c26dbfcce11fe67cfced2efcd)

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

Best,  
Amit.
