"Embedding" state in a larger lattice

Suppose I have solved for some state |\psi\rangle on a lattice of size l, is there a way to somehow ‘embed’ this state in a larger lattice of size L? That is, putting this state in an ‘empty’ background of a more sites, or equivalently, extending the original state in either direction with empty sites.

Obviously a physically appropriate way would be to start the calculation on the L lattice, but with a very strong positive bias on all the sites outside of the l window, so that the solved state would be confined within the ‘smaller’ system to begin with, but I’m wondering if we could also accomplish this from a more technical direction by manipulate the indices and sites.

(for example this naive approach does not work)

psi = someprocess(l)
s = siteinds("Fermion", L; conserved_qns = true)
M = randomMPS(s, [ "Emp" for _ in 1:L])
M[ 1 : l] = psi
1 Like

hi, I’m sure this is not the best way to do it, but you could try working directly with the .data attribute of the MPS, ie. something like

M.data[1:l] = psi.data

afterwards you’d likely need to fix the link indices with some replaceind(), since at the edges of your insertion they’d be messed up, also probably some replace_siteinds() at the end to adjust the site indices. So yeah, it’s definitely hacky, I wonder if there’s a more clever way to do it…