Page 1 of 1

Custom (sum of) Operators

Posted: 21 Apr 2021, 08:52
by dorf
Hi,
is there an easy way to make custom operators and apply them to a MPS via 'mps.apply_local_op()'?
Let's say I want to apply S^x_i + S^y_i+1 - const*Id. Is there some functionality that I can construct this operator, give a name to it, and then apply it?
The 'const' is evaluated at runtime, so defining a new operator class or something in the source code probably wouldn't work for me.

Re: Custom (sum of) Operators

Posted: 08 Jun 2021, 03:14
by Johannes
A bit late, but better late than never ;-)
apply_local_op accepts an operator that acts on n neighboring sites, for example for two sites with legs 'p0', 'p1', 'p0*', 'p1*'.
You can use the brand-new function tenpy.networks.site.kron to create the corresponding bond operator from the single-site operators.
They can be added/scaled as desired.

When the terms become too long-range, it will eventually become cheaper to combine them into an MPO and apply that one, but with nearest-neighbor terms, you're definitely not in that limit...

Re: Custom (sum of) Operators

Posted: 28 Jun 2021, 14:56
by dorf
Thank you very much for your reply and that new functionality!
However, I didn't quite get how to construct the operator for two different sites.
Reading the documentation it seems that I have to pass an array of strings to kron(), which will be translated into some local operators (e.g. 'Sz' for the SpinHalfSite). But how do I pass the sites that they should act on? Or do I have to save the local operator in the MPO-class? I'm sorry but I'm only familiar with the apply_local_op, which is a method of an MPS. :oops:

-

Posted: 08 Jul 2021, 10:43
by HelgannuanO
Anybody know where to get custom fender badges for the engine size that look like the originals?
I have a 496 and I need new badges anyway.