Is there a method that gives the quantum number flux of a particular element in an ITensor

+1 vote
edited

http://itensor.org/support/2799/are-there-methods-for-returning-value-for-mps-or-flux-for-mpo

I realized that one can use the "flux" function to get the quantum number flux of an ITensor. However I wonder if there is a method to get the quantum number flux for a particular element in an ITensor?

commented by (51.6k points)
Hi Chia-Min,
Is your original goal still the same? To generate a random ITensor with a certain flux? If so I can answer about that because we already have a function to do that.

Regarding your exact question above, there is not exactly a function to do what you are asking, the reason being that all non-zero elements of a QN ITensor are required by construction to have the same flux. So even if such a function existed, it would always give the same answer as calling flux on the whole ITensor. (Or it might throw an error if called on an element which is not allowed to be non-zero.)

Miles
commented by (51.6k points)
Based on the earlier version of  your question, I have added a new docs page finally documenting the version of randomITensor which accepts an QN argument, and makes a QN ITensor which has the requested flux and all elements set to random numbers which are compatible with the flux:

http://itensor.org/docs.cgi?vers=cppv3&page=classes/qnitensor
commented by (400 points)
Hi Miles. Thank you for the comments. Yes I still has that purpose, but I found that using the member function ".generate" with a random number generator seems will do the job and therefore I removed that part.

I have another reason for the flux function for a particular element but it is more complicated as follows. Given an MPS |psi> with no particle number QN, the overall goal is to 1) project |psi> to a particular particle number, and 2) cast the MPS to have particle-number QN. In the process, I need to cast an ITensor that does not have QN structure but should have a well defined QN, to an ITensor having QN structure. In this step I want to copy the elements based on checking the QN flux of the QN ITensor. I have implemented it by reading the QNs from the indices, but I think it would be very useful if there is a build-in function that gives the QN flux of a particular position. Since when assigning element to a QN ITensor, the code will check the flux for the proposed position, I thought there is already such a function there.

Of course if you have any comment about how to cast an MPS to having QN, it is also very helpful, but I think it would be kind of beyond this question.