# WriteM argument for idmrg

+1 vote
edited

Hi,

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();
return;
}


and

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


respectively.

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();
return;
}


to avoid the problem.