+1 vote
asked by (280 points)
edited by


I am trying to use the WriteM of the idmrg but it shows an error message.

For example, I used the idmrg.cc file in the sample folder and add an input arg {"WriteM",10} such that the environment tensor of the dmrg can be written on disk when MaxM>10.

However, it prints the follow error message

Wrong number of IndexVals passed to real/cplx (expected 1, got 0)
Abort trap: 6

It seems like the problem is in the localmpo.h file. In the setRHlim and setLHlim function, I saw

if(LHlim_ < 1) 
    //Set to null tensor and return
    PH_.at(LHlim_) = Tensor();


 if(RHlim_ > Op_->N()) 
    //Set to null tensor and return
    PH_.at(RHlim_) = Tensor();


These two line works for finite size DMRG because in the finite size dmrg, there is no PH[0] and PH[N+1], where N = Op_->N(). You can set it as a empty tensor. But for the idmrg, there are edge tensor to terminate the finite state machine. If we set it to be empty tensor, we will get the error.

I think one can add a private member like

bool Infinite_ = arg.getbool("Infinite",false).

The "Infinite" argument should have been defined in the idmrg.cc file.
And change the previous line to something like

if(RHlim_ > Op_->N() && !Infinite_) 
    //Set to null tensor and return
    PH_.at(RHlim_) = Tensor();

to avoid the problem.

1 Answer

0 votes
answered by (31.7k points)

Hi Ze-Pai,
Basically I think the answer to your question is that WriteM is currently not intended to be used with the idmrg algorithm. This can certainly be fixed, but I would currently view this as not a supported feature. We should add it to the list of new features to add to ITensor.

One question back to you though: are you sure that you need idmrg for your project? Perhaps you could use finite DMRG just as well?

Finally, thanks a lot for looking into the code to diagnose the problem. Maybe it is a simple fix after all like you are suggesting. Do you want to test your fix out on your own code branch then submit a pull request if it does work?


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.