I'm attempting to adapt Sujay Kazi's work in

https://www.itensor.org/support/2212/modify-dmrg-optimize-over-different-number-sites-time-julia?show=2219#a2219

(On github: https://github.com/sujay-kazi/ITensors.jl/blob/master/src/mps/dmrg.jl)

using the dmrg.cc file in the tutorials

https://github.com/ITensor/ITensor/blob/v3/tutorial/06_DMRG/dmrg.cc ,

but I'm getting an error that the effective Hamiltonian and effective state have different dimensions.

I set up the Hamiltonian, called H using the autoMPO, then have an initial state guess psi0, and which to find the ground state and energy (psig, energyg). Then also set up the sweeps for the DMRG in the usual way. The problem I have is in the Davidson step where Heff and psig have different sizes. Heff is too small, but how do I grow Heff to encompass the length needed for the multi-site DMRG?

```
auto Heff = LocalMPO(H);
int dmrgStepSize = 3;
int finalLatticeSiteIndex = PhysicalLatticeLength;
float energyg;
auto psig = psi0
//Loop over sweeps
for(auto sweepIteration : range1(sweeps.nsweep()))
{
//Loop over bonds
for(int bondIndex = 1, subsweepIndex = 1; subsweepIndex <= dmrgStepSize; sweepnext(bondIndex,subsweepIndex,finalLatticeSiteIndex))
{
printfln("Sweep=%d, HS=%d, Bond=(%d,%d)",sweepIteration,subsweepIndex,bondIndex,bondIndex+dmrgStepSize);
//Grow effective H
psig.position(bondIndex);
Heff.position(bondIndex,psig);
// Form state for effective eigenvalue problem for this set of bonds
auto phig = psig(bondIndex);
for(int stepsFromEdge : range1(dmrgStepSize-1) ){
phig *= psig(bondIndex+stepsFromEdge) ;
}
std::cout << " Makes it to davidson algorithm. \n" ;
//Solve effective eigenvalue problem
energyg = davidson(Heff,phig);
//Update accuracy parameters
//to pass to svd
auto args = Args("Cutoff",sweeps.cutoff(sweepIteration),
"MaxDim",sweeps.maxdim(sweepIteration),
"MinDim",sweeps.mindim(sweepIteration));
//Add code:
//
// SVD phi and store results
//
auto spec = psig.svdBond(bondIndex,phig,(subsweepIndex==1?Fromleft:Fromright), Heff, args) ;
} // for loop over bondIndex
} // for loop over sweepIteration
```