+1 vote
asked by (270 points)

Hi all,

is it possible to overcome the limit of 4 quantum numbers in the QN objects? In particular, in the Julia version or, alternatively, in C++.

Thank you very much.


2 Answers

0 votes
answered by (14.1k points)

Yes, you can increase the number of QNs, the value is hardcoded here: https://github.com/ITensor/ITensors.jl/blob/v0.2.8/src/qn/qn.jl#L62.

You could check out the package for development (https://itensor.github.io/ITensors.jl/stable/AdvancedUsageGuide.html#Developing-ITensors.jl ) and change that line to a larger number.

What is your use case for needing more QNs? We would definitely consider increasing it (we would want to check that it doesn't cause any performance problems), but we haven't had any requests for it being larger so far.

0 votes
answered by (70.1k points)

Hi Giuseppe,
I had drafted a similar answer to Matt's – including it in case the extra details are helpful. We are discussing whether it's a good idea to make the amount of QNs changeable in a simpler way, though it could lead to some errors if not done at the very beginning of a program.

Here's my answer:
If you change the variable "maxQNs" to be greater than 4, then you will be able to use any amount of QNs you want that way, and the rest of the code should continue to work. To make this change, you will need to do the following steps:

  1. change the ITensors package to be in "dev" mode if you haven't already: in the package manager (type ] to enter package mode) run the command "dev ITensors"

  2. navigate in your shell to the folder ~/.julia/dev/ITensors/src/qn/

  3. edit the file qn.jl by changing the maxQNs variable on line 62

Now if you restart any running Julia session or run a new one, you should be able to use more QNs.

Finally, note that after switching to dev mode, you will not get updates of version of ITensors.jl in the usual way (i.e. your version will be pinned to the current one unless you manually pull the code from Github). So to update your ITensor library code you'll need to revert any code edits you made, then do "free ITensors" in the Julia package manager.

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.