Beispiel #1
0
 def init_sites(self, model_params):
     B = model_params.get('B', 0.)
     conserve = model_params.get('conserve', 'best')
     if conserve == 'best':
         conserve = 'Sz' if not model_params.any_nonzero(['B']) else None
         self.logger.info("%s: set conserve to %s", self.name, conserve)
     return SpinSite(S=1., conserve=None)
Beispiel #2
0
    def __init__(self, model_params):
        model_params = asConfig(model_params, "AKLTModel")
        L = model_params.get('L', 2)
        site = SpinSite(S=1., conserve='Sz')

        # lattice
        bc_MPS = model_params.get('bc_MPS', 'finite')
        bc = 'open' if bc_MPS == 'finite' else 'periodic'
        lat = Chain(L, site, bc=bc, bc_MPS=bc_MPS)

        Sp, Sm, Sz = site.Sp, site.Sm, site.Sz
        S_dot_S = 0.5 * (kron(Sp, Sm) + kron(Sm, Sp)) + kron(Sz, Sz)
        S_dot_S_square = npc.tensordot(S_dot_S, S_dot_S, [['(p0*.p1*)'], ['(p0.p1)']])

        H_bond = S_dot_S + S_dot_S_square / 3.
        # P_2 = H_bond * 0.5 + 1/3 * npc.eye_like(S_dot_S)

        J = model_params.get('J', 1.)
        H_bond = J * H_bond.split_legs().transpose(['p0', 'p1', 'p0*', 'p1*'])
        H_bond = [H_bond] * L
        # H_bond[i] acts on sites (i-1, i)
        if bc_MPS == "finite":
            H_bond[0] = None
        # 7) initialize H_bond (the order of 7/8 doesn't matter)
        NearestNeighborModel.__init__(self, lat, H_bond)
        # 9) initialize H_MPO
        MPOModel.__init__(self, lat, self.calc_H_MPO_from_bond())
Beispiel #3
0
    def __init__(self, L=10, Jn=1, Jnn=0, hz=0, options={}):
        # use predefined local Hilbert space and onsite operators
        site = SpinSite(S=1 / 2, conserve=None)
        self.L = L
        lat = Chain(L, site, bc="open", bc_MPS="finite")  # define geometry
        MultiCouplingModel.__init__(self, lat)
        # add terms of the Hamiltonian;
        # operators "Sx", "Sy", "Sz" are defined by the SpinSite
        self.add_coupling(Jn, 0, "Sx", 0, "Sx", 1)
        self.add_coupling(Jn, 0, "Sy", 0, "Sy", 1)
        self.add_coupling(Jn, 0, "Sz", 0, "Sz", 1)

        self.add_multi_coupling(
            Jnn, [("Sx", -1, 0), ("Sx", 1, 0)]
        )  #(oper, shift, internal index - it's possible to merge sites together)
        self.add_multi_coupling(Jnn, [("Sy", -1, 0), ("Sy", 1, 0)])
        self.add_multi_coupling(Jnn, [("Sz", -1, 0), ("Sz", 1, 0)])

        self.add_onsite(hz, 0, "Sz")
        # finish initialization
        MPOModel.__init__(self, lat, self.calc_H_MPO())
        self.psi = MPS.from_product_state(self.lat.mps_sites(), [0] * L,
                                          "finite")
        self.options = options
        self.dmrg_retval = None
Beispiel #4
0
    def __init__(self, L=2, S=0.5, J=1., Delta=1., hz=0.):
        spin = SpinSite(S=S, conserve="Sz")
        # the lattice defines the geometry
        lattice = Chain(L, spin, bc="open", bc_MPS="finite")
        CouplingModel.__init__(self, lattice)
        # add terms of the Hamiltonian
        self.add_coupling(J * 0.5, 0, "Sp", 0, "Sm", 1)  # Sp_i Sm_{i+1}
        self.add_coupling(J * 0.5, 0, "Sp", 0, "Sm", -1)  # Sp_i Sm_{i-1}
        self.add_coupling(J * Delta, 0, "Sz", 0, "Sz", 1)
        # (for site dependent prefactors, the strength can be an array)
        self.add_onsite(-hz, 0, "Sz")

        # finish initialization
        # generate MPO for DMRG
        MPOModel.__init__(self, lat, self.calc_H_MPO())
        # generate H_bond for TEBD
        NearestNeighborModel.__init__(self, lat, self.calc_H_bond())
Beispiel #5
0
    def __init__(self, L=10, J=1, Y=0, hz=0, options={}):
        # use predefined local Hilbert space and onsite operators
        site = SpinSite(S=1, conserve=None)
        self.L = L
        lat = Chain(L, site, bc="open", bc_MPS="finite")  # define geometry
        MultiCouplingModel.__init__(self, lat)
        # add terms of the Hamiltonian;
        # operators "Sx", "Sy", "Sz" are defined by the SpinSite
        self.add_coupling(J, 0, "Sx", 0, "Sx", 1)
        self.add_coupling(J, 0, "Sy", 0, "Sy", 1)
        self.add_coupling(J, 0, "Sz", 0, "Sz", 1)

        for oper1 in ['Sx', 'Sy', 'Sz']:
            for oper2 in ['Sx', 'Sy',
                          'Sz']:  # (\vec S(i) \cdot \vec S(i+1))^2 coupling
                self.add_multi_coupling(Y, [(oper1, 0, 0),(oper2, 0, 0),\
                                            (oper1, 1, 0),(oper2, 1, 0)] ) #note that there are two operators on one site
        self.add_onsite(hz, 0, "Sz")
        # finish initialization
        MPOModel.__init__(self, lat, self.calc_H_MPO())
        self.psi = MPS.from_product_state(self.lat.mps_sites(), [0] * L,
                                          "finite")
        self.options = options
        self.dmrg_retval = None
 def init_sites(self, model_params):
     # conserve = get_parameter(model_params, 'conserve', None, self.name)
     conserve = model_params.get('conserve', None)
     S = model_params.get('S', 0.5)
     fs = SpinSite(S=S, conserve=conserve)
     return [fs, fs, fs, fs]