Continueing from discussion above:
I don't understand all of the notation there, but indeed stat mech models are a bit outside the scope of AutoMPO. However, my understanding was that every MPO/operator should be expandable in terms of a sum of tensor products of single-site operators (for example for a qubit or spin-1/2 system, tensor products of pauli operators form a complete basis), so in principle if you could expand the MPO in a complete operator basis and then put it into AutoMPO. Maybe that is only the case for Hermitian operators and your example isn't Hermitian?
However, if you already have the analytic form of the MPO tensors, to make an MPO periodic really just requires making the first and last dangling indices equal. For example:
function make_mpo_tensor(s, l, r)
T = ITensor(s, s', l, r)
# Code to set the elements of the MPO tensor goes here
end
# N site system
N = 4
l = [Index(3, "l$n") for n in 1:N]
s = [Index(2, "s$n") for n in 1:N]
M = MPO(N)
M[1] = make_mpo_tensor(s[1], l[N], l[1])
for n in 2:N
M[n] = make_mpo_tensor(s[n], l[n-1], l[n])
end
For smaller systems, you can contract them all together with prod(M)
or contract(M...)
to see that you are only left with site indices and it should be the exponentially large operator you are looking for.
Note that built-in ITensor functions like inner(psi, M, psi)
won't generally work with these kinds of MPOs (but those shouldn't be hard to write on your own). You can also manually turn this kind of periodic MPO into an open boundary MPO with a larger bond dimension by running the extra link index through the system (essentially by contracting with an identity MPO that has link indices that are the same as the link indices at the edges of the system).