Page 1 of 1

Symmetries Of lattice

Posted: 12 Oct 2020, 19:30
by amankumar
Hi
I wanted to evaluate entanglement entropy for a segment of sites with function entanglement_entropy_segment(). But this can not take more than or equal 12 sites as memory issue. Can I exploit lattice symmetries like translation one using tenpy package, and can extend my segment size to more than 12 for evaluation of entanglement entropy for a segment.

Thanks

Re: Symmetries Of lattice

Posted: 13 Oct 2020, 14:49
by Johannes
As far as I know, exploiting translation symmetry or other symmetries of the lattice is not possible.

There is only the trick which was pointed out in the source code of entanglement_entropy_segment before.
I've implemented in 61be6397b0fedb066199bf24e948a6f6f702f6c6 today to give entanglement_entropy_segment2.

While this is not exponentially expensive in the number of sites involved (unless you have a non-consecutive segment),
it is of \(\mathcal{O}(\chi^6)\) and hence much more expensive than e.g. DMRG or TEBD.

You can give it a try!

Re: Symmetries Of lattice

Posted: 14 Oct 2020, 21:34
by amankumar
Thanks it works fine, but only for small bond dimension.
I have another conceptual question in dmrg, I was simulating ferromagnetic heisenberg model using tenpy, and evaluated ground state entanglement entropy for some subsystem. I got Log(2) as answer, as this is obvious ground state preserves spin flip symmetry, where I have turned on parity symmetry.

Code: Select all

    def init_sites(self, model_params):
        conserve = model_params.get('conserve', 'parity')
        site = SpinHalfSite(conserve)
        return site
But if I turn off this parity symmetry I am getting zero entanglement entropy for a subsystem in ground state.

Code: Select all

    def init_sites(self, model_params):
        conserve = model_params.get('conserve', None)
        site = SpinHalfSite(conserve)
        return site
So I am not understanding this distinct behaviour.
If you don't understand my question or need more details, please let me know.

Thanks

Re: Symmetries Of lattice

Posted: 19 Oct 2020, 09:00
by amankumar
Hi
If you need more details, or did not understood my question, please let me know.
Thanks

Re: Symmetries Of lattice

Posted: 20 Oct 2020, 19:13
by Johannes
The Ground state of the ferromagnetic Heisenberg model is degenerate, and I guess that you might get different states depending on whether you turn on parity conservation. The different ground states have different entanglement.
What start did you start with? It fixes the charge sector you remain in.
Take a look at the expectation values of Sz - do you simply get an all-up or all-down state?

Re: Symmetries Of lattice

Posted: 21 Oct 2020, 15:10
by amankumar
Thanks
That is fine, when parity is conserved, state is in all up state plus down state, which is confirmed by zero expectation vale of Sz on a site. And in other case, when I turn off parity, I get state to be in all up configuration, confirmed by "one" expectation value of Sz on a site.
But I do not understand, how parity conservation make the state to be spin flip symmetric?

Re: Symmetries Of lattice

Posted: 21 Oct 2020, 16:01
by Johannes
Just to make sure, you really look at the Ferromagnetic Heisenberg model, and not the transverse field Ising model, right?
Why do you preserve the parity, but not Sz?

To clarify: the "parity" is not the same as "spin flip symmetric".
The conserved "parity" is \((sum_i Z_i) mod 2\), i.e. whether the number of up spins is even. For an even number of sites, the "all up" state is also in the parity-0 sector!
In contrast, spin flip symmetry is \(\prod X_i\), and a whole different story - it implies that the coefficients for a given
Enforcing spin-flip symmetry is (at least at the moment) not possible in TeNPy.

What bond dimension does your final state have when you don't enforce parity? (And is it really a product state if you don't?)

Re: Symmetries Of lattice

Posted: 21 Oct 2020, 17:49
by amankumar
Yes I am considering Ferromagnetic Heisenberg model on hexagonal lattice. Here is my code

Code: Select all

from tenpy.algorithms import dmrg
import numpy as np
from mps import MPS
from tenpy.models.lattice import Lattice, get_order, _parse_sites,Honeycomb
from tenpy.networks.site import SpinHalfSite
from tenpy.models.model import MultiCouplingModel, CouplingMPOModel
from tenpy.tools.params import asConfig
from tenpy.tools.misc import any_nonzero
class Heisenberg(CouplingMPOModel, MultiCouplingModel):

    def init_sites(self, model_params):
        conserve = model_params.get('conserve', 'parity')
        #conserve = model_params.get('conserve', None)
        site = SpinHalfSite(conserve)
        return site

    def init_lattice(self, model_params):
        site = self.init_sites(model_params)
        Lx = model_params.get('Lx', 2)
        Ly = model_params.get('Ly', 2)
        order = model_params.get('order', 'Cstyle')
        bc_MPS = model_params.get('bc_MPS', 'infinite')
        bc_x = 'periodic' if bc_MPS == 'infinite' else 'open'
        bc_x = model_params.get('bc_x', bc_x)
        bc_y = model_params.get('bc_y', 'periodic')
        assert bc_y in ['open', 'periodic']
        bc = [bc_x, bc_y]
        lat = Honeycomb(Lx, Ly, site, order=order, bc=bc, bc_MPS=bc_MPS)
        return lat
    def init_terms(self, model_params):
        J = model_params.get('J', -1.0)
        # Heisenberg interaction on one type of bond #
        self.add_multi_coupling(J, [('Sigmay', [0, 0], 0),
                                     ('Sigmay', [0, 0], 1)])
        self.add_multi_coupling(J, [('Sigmax', [0, 0], 0),
                                     ('Sigmax', [0, 0], 1)])
        self.add_multi_coupling(J, [('Sigmaz', [0, 0], 0),
                                     ('Sigmaz', [0, 0], 1)])
        # Heisenberg interaction on second type of bond #

        self.add_multi_coupling(J, [('Sigmaz', [0, 0], 1),
                                     ('Sigmaz', [1, 0], 0)])
        self.add_multi_coupling(J, [('Sigmax', [0, 0], 1),
                                     ('Sigmax', [1, 0], 0)])
         self.add_multi_coupling(J, [('Sigmay', [0, 0], 1),
                                     ('Sigmay', [1, 0], 0)])                                    
        # Heisenberg interaction on third type of bond #

        self.add_multi_coupling(J, [('Sigmax', [0, 0], 1),
                                     ('Sigmax', [0, 1], 0)])
        self.add_multi_coupling(J, [('Sigmay', [0, 0], 1),
                                     ('Sigmay', [0, 1], 0)])
        self.add_multi_coupling(J, [('Sigmaz', [0, 0], 1),
                                     ('Sigmaz', [0, 1], 0)])
def example():
    model_params = dict(Lx=4, Ly=4,J=-1,
                        verbose= 1)
    M = Heisenberg(model_params)
    product_state=[0]*M.lat.N_sites
    psi = MPS.from_product_state(M.lat.mps_sites(), product_state, bc =M.lat.bc_MPS)
    dmrg_params = {
        'mixer': True,  # setting this to True helps to escape local minima
        'trunc_params': {
            'chi_max': 10,
            'svd_min': 1.e-10,
        },
        'max_E_err': 1.e-10,
        'verbose': 1,
    }
    results = dmrg.run(psi, M, dmrg_params)
    print("Energy per site: ", results['E'])
    print(psi.entanglement_entropy_segment([1]))
    print("expectation_Value",psi.expectation_value_term([('Sigmax',1)]))
    print("expectation_Value",psi.expectation_value_term([('Sigmaz',1)]))
    print("expectation_Value",psi.expectation_value_term([('Sigmay',1)]))

if __name__ == "__main__":
    example()

So if I don't conserve parity, what makes my state to all spin up. In principle state should be symmetric.

Re: Symmetries Of lattice

Posted: 21 Oct 2020, 18:00
by Johannes
The all-up state which you start with is an *exact* eigenstate of the Heisenberg model (both the ferro-magnetic and anti-ferromagnetic one), and indeed it's the ground state (or one of them, to be precise) for the FM J=-1 case.

The reason why you still go away is a bug: you're missing the Y-Y term in the second type of bond!

Note that if you rewrite \( S^x_i S^x_j + S^y_i S^y_j = 0.5 * (S^+_i S^-_j + S^-_i S^+_j)\), you can even conserve the total Sz (which is a good idea to speed things up...

Re: Symmetries Of lattice

Posted: 21 Oct 2020, 18:23
by amankumar
Yes while copying code here, I missed that term, which I have updated now. But still I did not understood this distinct behaviour of ground state with or without parity.
Also, how to implement total Sz conserve symmetry here?

Re: Symmetries Of lattice

Posted: 02 Dec 2020, 21:00
by Johannes
Sorry for the late reply; your post was displayed on another page that I didn't see.

To see how you can use Sz conservation, take a look at the implementation of the tenpy.models.xxz_chain.XXZChain2
The lines

Code: Select all

            self.add_coupling(Jxx * 0.5, u1, 'Sp', u2, 'Sm', dx, plus_hc=True)
            self.add_coupling(Jz, u1, 'Sz', u2, 'Sz', dx)

add the SxSx + SySy + SzSz term for one bond, and you can do the same for each bond in the honeycomb lattice.

In fact, if your goal is only to get the Heisenberg model on the Honeycomb lattice: it is already implemented in the form of the tenpy.models.spins.SpinModel.
Try:

Code: Select all

from tenpy.models.spins import SpinModel
model_params = {
    'lattice': 'Honeycomb',
    'Lx': 4,
    'Ly': 4,
    'Jx': 1.,
    'Jy': 1.,
    'Jz': 1.,
}
M = SpinModel(model_params)
This will use Sz conservation by default (unless you disable it by explicitly setting the conserve model parameter.