Hi Johannes,
I am interested in simulating many body effects on collective Neutrino Oscillation using TenPY, specifically, by following this paper: https://arxiv.org/pdf/2102.10188.pdf
I was thinking about using the SpinChain model. From this, to use "M.H_MPO", but I don't know if M.H_MPO will give me the right MPO for the Eq(1) in the https://arxiv.org/pdf/2102.10188.pdf.
Also I need to implement the SWAP gate in my code, could you please tell me if it is possible?
Or in my case, do I need to go from zero and do my own model from scratch using TeNPy tools?
The best,
Caroline
M.H_MPO and SWAP gate in SpinChain model
Re: M.H_MPO and SWAP gate in SpinChain model
To be honest, I'm quite surprised by arXiv:2102.10188 that it actually seems to work with MPS. They simulate eq. 2, with alltoall couplings \(H=\sum_{i<j} S_i \cdot S_j \). Naively, I would have expected much more entanglement than only ~log(N) to build up with the time evolution. On the other hand, it kind of makes sense, since it's effectively infinite dimensional and you expect a good description with mean field, so you might hope to not require too much entanglement.
Let me just say as a warning, that a priori, that there's no guarantee that MPSbased methods will work as well for the more general H of eq. 1.
Are you aiming for the more general eq. 1 with arbitrary J_ij, or "just" trying to reproduce the results for eq. 2 for now?
The method they use is a variant of the ususal TEBD, but to incorporate the longrange interactions, each time step consists of N usual TEBD steps intertwined with Swap gates.
You have two alternatives to try to reproduce their results with TeNPy:
So fter all, the SWAP method might work better  but of course, you'd have to try to really see this.
Let me just say as a warning, that a priori, that there's no guarantee that MPSbased methods will work as well for the more general H of eq. 1.
Are you aiming for the more general eq. 1 with arbitrary J_ij, or "just" trying to reproduce the results for eq. 2 for now?
The method they use is a variant of the ususal TEBD, but to incorporate the longrange interactions, each time step consists of N usual TEBD steps intertwined with Swap gates.
You have two alternatives to try to reproduce their results with TeNPy:
 Directly reproduce the same TEBDlike method with time steps and swap gates as they did.
You'd need to generalize TeNPy's TEBD update for this, following their Fig. 1.
Swap gates are implemented, you can just call permute_sites on the MPS to exchange neighboring sites.
TeNPy's TEBD usually just works for nearestneighbor models, theM.H_bond
are the corresponing twosite H_{i,i+1} terms (not theM.H_MPO
). If you have the truly uniform eq. 2, you might be able to get away with generating just a nearestneighbor model, since the couplings are uniform anyways; but I'm not sure about the boundaries i=0,L1 right now; there's probably special cases to account correctly for the onsite terms there. (I didn't think this through completely...)  Try another time evolution method based on the MPO, like TDVP.
The *uniform* alltoall coupling can actually be written *very* efficiently with a bonddimension 5 Matrix product operator of the form
\( W = \begin{pmatrix}
1 & Sp & Sm & Sz & h_x Sx + h_z Sz \\
0 & 1 & 0 & 0 & J Sm \\
0 & 0 & 1 & 0 & J Sp \\
0 & 0 & 0 & 1 & J Sz \\
0 & 0 & 0 & 0 & 1
\end{pmatrix} \)
This is a special case of the exponentially decaying interactions without decay, so you can use add_exponentially_decaying_interactions withlambda_ = 1.
to generate that MPO, like this:You can then try to evolve the state with methods which directly use the MPO, i.e. TDVP and/or ExpMPOEvolution.Code: Select all
class InfiniteRangeHeisenberg(tenpy.models.model.CouplingMPOModel): def init_sites(self, model_params): conserve = model_params.get('conserve', 'best') if conserve == 'best': # check how much we can conserve if not model_params.any_nonzero(['hx', 'hy'], "check Sz conservation"): conserve = 'Sz' else: conserve = None self.logger.info("%s: set conserve to %s", self.name, conserve) return tenpy.networks.site.SpinHalfSite(conserve=conserve) def init_terms(self, model_params): hx = model_params.get('hx', 0.) hz = model_params.get('hz', 0.) self.add_onsite(hx, 0, 'Sx') self.add_onsite(hz, 0, 'Sz') J = model_params.get('J', 1.) for op_i, op_j in [('Sp', 'Sm'), ('Sm', 'Sp'), ('Sz', 'Sz')]: self.add_exponentially_decaying_coupling(J, 1., op_i, op_j)
So fter all, the SWAP method might work better  but of course, you'd have to try to really see this.

 Posts: 2
 Joined: 01 Dec 2021, 09:33
Re: M.H_MPO and SWAP gate in SpinChain model
Hi Johannes,
Thanks so much for your help and for so many details.
I am trying to only reproduce what was done on the paper for now.
I will try both ways and hopefully one of them will work.
The best,
Caroline.
Thanks so much for your help and for so many details.
I am trying to only reproduce what was done on the paper for now.
I will try both ways and hopefully one of them will work.
The best,
Caroline.