Ok I see then how that could mix up the order of the indices. So an "ITensor way" of dealing with this is to make use of the index type feature. It sounds like the wavefunction you're working with is an MPS, correct? And that after you apply the gates you restore MPS form by doing an SVD, correct? In that case each MPS tensor would always have a single, unique physical index and the convention I use, and is used throughout ITensor, is to make these physical indices have the `Site` type. Then if you are wanting to retrieve the physical index of a certain MPS tensor, say the one at site n, you can do:
auto si = findtype(psi.A(n),Site);
to get the index of type `Site` on the nth MPS tensor.
Let me know if this doesn't solve your problem though.