Пример #1
0
    def init_terms(self, model_params):
        t1 = get_parameter(model_params, 't1', -1., self.name, True)
        t2 = get_parameter(model_params, 't2', (np.sqrt(129) / 36) * t1 *
                           np.exp(1j * np.arccos(3 * np.sqrt(3 / 43))),
                           self.name, True)
        V = get_parameter(model_params, 'V', 0, self.name, True)
        mu = get_parameter(model_params, 'mu', 0., self.name, True)
        phi_ext = 2 * np.pi * get_parameter(model_params, 'phi_ext', 0.,
                                            self.name)

        for u in range(len(self.lat.unit_cell)):

            self.add_onsite(mu, 0, 'N', category='mu N')
            self.add_onsite(-mu, 1, 'N', category='mu N')

        for u1, u2, dx in self.lat.pairs['nearest_neighbors']:
            t1_phi = self.coupling_strength_add_ext_flux(t1, dx, [0, phi_ext])
            self.add_coupling(t1_phi,
                              u1,
                              'Cd',
                              u2,
                              'C',
                              dx,
                              'JW',
                              True,
                              category='t1 Cd_i C_j')
            self.add_coupling(np.conj(t1_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='t1 Cd_i C_j h.c.')  # h.c.
            self.add_coupling(V, u1, 'N', u2, 'N', dx, category='V N_i N_j')

        for u1, u2, dx in [(0, 0, np.array([-1, 1])), (0, 0, np.array([1, 0])),
                           (0, 0, np.array([0, -1])), (1, 1, np.array([0, 1])),
                           (1, 1, np.array([1, -1])), (1, 1, np.array([-1,
                                                                       0]))]:
            t2_phi = self.coupling_strength_add_ext_flux(t2, dx, [0, phi_ext])
            self.add_coupling(t2_phi,
                              u1,
                              'Cd',
                              u2,
                              'C',
                              dx,
                              'JW',
                              True,
                              category='t2 Cd_i C_j')
            self.add_coupling(np.conj(t2_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='t2 Cd_i C_j h.c.')  # h.c.
Пример #2
0
    def init_terms(self, model_params):
        t = get_parameter(model_params, 't', -1., self.name, True)
        V = get_parameter(model_params, 'V', 0, self.name, True)
        phi_ext = 2 * np.pi * get_parameter(model_params, 'phi_ext', 0.,
                                            self.name)

        t1 = t
        t2 = 0.39 * t * 1j
        t3 = -0.34 * t

        for u1, u2, dx in self.lat.NN:
            t1_phi = self.coupling_strength_add_ext_flux(t1, dx, [0, phi_ext])
            self.add_coupling(t1_phi, u1, 'CdA', u2, 'CB', dx, 'JW', True)
            self.add_coupling(np.conj(t1_phi), u2, 'CdB', u1, 'CA', -dx, 'JW',
                              True)
            self.add_coupling(V, u1, 'Ntot', u2, 'Ntot', dx)

        for u1, u2, dx in self.lat.nNNA:
            t2_phi = self.coupling_strength_add_ext_flux(t2, dx, [0, phi_ext])
            self.add_coupling(t2_phi, u1, 'CdA', u2, 'CA', dx, 'JW', True)
            self.add_coupling(np.conj(t2_phi), u2, 'CdA', u1, 'CA', -dx, 'JW',
                              True)

        for u1, u2, dx in self.lat.nNNB:
            t2_phi = self.coupling_strength_add_ext_flux(t2, dx, [0, phi_ext])
            self.add_coupling(t2_phi, u1, 'CdB', u2, 'CB', dx, 'JW', True)
            self.add_coupling(np.conj(t2_phi), u2, 'CdB', u1, 'CB', -dx, 'JW',
                              True)

        for u1, u2, dx in self.lat.nnNN:
            t3_phi = self.coupling_strength_add_ext_flux(t3, dx, [0, phi_ext])
            self.add_coupling(t3_phi, u1, 'CdA', u2, 'CB', dx, 'JW', True)
            self.add_coupling(np.conj(t3_phi), u2, 'CdB', u1, 'CA', -dx, 'JW',
                              True)
Пример #3
0
 def init_terms(self, model_params):
     x = get_parameter(model_params, 'x', 1., self.name)
     y = get_parameter(model_params, 'y', 0.25, self.name)
     self.add_onsite_term(y, 0, 'Sz')
     self.add_onsite_term(y, 4, 'Sz')
     self.add_coupling_term(x, 0, 1, 'Sx', 'Sx')
     self.add_coupling_term(2. * x, 1, 2, 'Sy', 'Sy')
     self.add_coupling_term(3. * x, 3, 4, 'Sy', 'Sy')
Пример #4
0
    def init_terms(self, model_params):
        J = get_parameter(model_params, 'J', 1., self.name, True)
        g = get_parameter(model_params, 'g', 1., self.name, True)
        h = get_parameter(model_params, 'h', 1., self.name, True)
        for u in range(len(self.lat.unit_cell)):
            self.add_onsite(-g, u, 'Sigmaz')
            self.add_onsite(-h, u, 'Sigmax')

        for u1, u2, dx in self.lat.nearest_neighbors:
            self.add_coupling(-J, u1, 'Sigmax', u2, 'Sigmax', dx)
Пример #5
0
    def init_terms(self, model_params):
        t = get_parameter(model_params, 't', -1., self.name, True)
        V = get_parameter(model_params, 'V', 0., self.name, True)
        mu = get_parameter(model_params, 'mu', 0., self.name, True)
        phi_ext = 2 * np.pi * get_parameter(model_params, 'phi_ext', 0., self.name)

        t1 = t * np.exp(1j * np.pi / 4)
        t2 = t / np.sqrt(2)

        for u in range(len(self.lat.unit_cell)):
            self.add_onsite(mu, 0, 'N', category='mu N')
            self.add_onsite(-mu, 1, 'N', category='mu N')

        for u1, u2, dx in self.lat.NN:
            t1_phi = self.coupling_strength_add_ext_flux(t1, dx, [0, phi_ext])
            self.add_coupling(t1_phi, u1, 'Cd', u2, 'C', dx, 'JW', True, category='t1 Cd_i C_j')
            self.add_coupling(np.conj(t1_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='t1 Cd_i C_j h.c.')
            self.add_coupling(V, u1, 'N', u2, 'N', dx, category='V N_i N_j')

        for u1, u2, dx in self.lat.nNNdashed:
            t2_phi = self.coupling_strength_add_ext_flux(t2, dx, [0, phi_ext])
            self.add_coupling(t2_phi, u1, 'Cd', u2, 'C', dx, 'JW', True, category='t2 Cd_i C_j')
            self.add_coupling(np.conj(t2_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='t2 Cd_i C_j h.c.')

        for u1, u2, dx in self.lat.nNNdotted:
            t2_phi = self.coupling_strength_add_ext_flux(t2, dx, [0, phi_ext])
            self.add_coupling(-t2_phi, u1, 'Cd', u2, 'C', dx, 'JW', True, category='-t2 Cd_i C_j')
            self.add_coupling(-np.conj(t2_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='-t2 Cd_i C_j h.c.')
Пример #6
0
 def __init__(self, psi, model, TDVP_params, environment=None):
     self.verbose = get_parameter(TDVP_params, 'verbose', 1, 'TDVP')
     self.TDVP_params = TDVP_params
     if environment is None:
         environment = MPOEnvironment(psi, model.H_MPO, psi)
     self.evolved_time = get_parameter(TDVP_params, 'start_time', 0., 'TDVP')
     self.H_MPO = model.H_MPO
     self.environment = environment
     if not psi.finite:
         raise ValueError("TDVP is only implemented for finite boundary conditions")
     self.psi = psi
     self.L = self.psi.L
     self.dt = get_parameter(TDVP_params, 'dt', 2, 'TDVP')
     self.trunc_params = get_parameter(TDVP_params, 'trunc_params', {}, 'TDVP')
     self.N_steps = get_parameter(TDVP_params, 'N_steps', 10, 'TDVP')
Пример #7
0
    def init_terms(self, model_params):
        t = get_parameter(model_params, 't', -1., self.name, True)
        V = get_parameter(model_params, 'V', 1, self.name, True)
        mu = get_parameter(model_params, 'mu', 0., self.name, True)
        phi_ext = 2 * np.pi * get_parameter(model_params, 'phi_ext', 0., self.name)

        phi = np.arccos(3 * np.sqrt(3 / 43))
        t2 = (np.sqrt(129) / 36) * t * np.exp(1j * phi)
        # t2 = 0  # TODO: external parameter!

        for u in range(len(self.lat.unit_cell)):
            self.add_onsite(mu, 0, 'N', category='mu N')
            self.add_onsite(-mu, 1, 'N', category='mu N')

        for u1, u2, dx in self.lat.nearest_neighbors:
            t_phi = self.coupling_strength_add_ext_flux(t, dx, [0, phi_ext])
            self.add_coupling(t_phi, u1, 'Cd', u2, 'C', dx, 'JW', True, category='t Cd_i C_j')
            self.add_coupling(np.conj(t_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='t Cd_i C_j h.c.')  # h.c.
            self.add_coupling(V, u1, 'N', u2, 'N', dx, category='V N_i N_j')

        for u1, u2, dx in [
            (0, 0, np.array([1, 0])),
            (0, 0, np.array([0, -1])),
            (0, 0, np.array([-1, 1])),  # first triangle counter-clockwise
            (1, 1, np.array([-1, 0])),
            (1, 1, np.array([0, 1])),
            (1, 1, np.array([1, -1]))
        ]:  # second triangle counter-clockwise
            t2_phi = self.coupling_strength_add_ext_flux(t2, dx, [0, phi_ext])
            self.add_coupling(t2_phi, u1, 'Cd', u2, 'C', dx, 'JW', True, category='t2 Cd_i C_j')
            self.add_coupling(np.conj(t2_phi),
                              u2,
                              'Cd',
                              u1,
                              'C',
                              -dx,
                              'JW',
                              True,
                              category='t2 Cd_i C_j h.c.')  # h.c.
Пример #8
0
    def __init__(self, model_param):
        # 0) Read and set parameters.
        L = get_parameter(model_param, 'L', 1, self.__class__)
        bc_MPS = get_parameter(model_param, 'bc_MPS', 'finite', self.__class__)
        t = get_parameter(model_param, 't', 1., self.__class__)
        alpha = get_parameter(model_param, 'alpha', 1.0, self.__class__)
        delta = get_parameter(model_param, 'delta', 1.0, self.__class__)
        beta = get_parameter(model_param, 'beta', 1.0, self.__class__)
        conserve_fermionic_boson = get_parameter(model_param, \
                            'conserve_fermionic_boson', 'Sz', self.__class__)
        conserve_spin = get_parameter(model_param, 'conserve_spin', None,
                                      self.__class__)
        unused_parameters(model_param, self.__class__)

        # 1) Sites and lattice.
        boson_site = SpinHalfSite(conserve=conserve_fermionic_boson, )
        bond_spin = SpinHalfSite(conserve=conserve_spin)
        double_site = DoubleSite(site0=boson_site,
                                 site1=bond_spin,
                                 label0='0',
                                 label1='1',
                                 charges='independent')
        #        lat = Lattice(Ls=[1], unit_cell=[bond_spin], order='default', bc_MPS=bc_MPS,
        #                      basis=None, positions=None)
        lat = Chain(L=L, site=double_site, bc_MPS='finite')

        # 2) Initialize CouplingModel
        bc_coupling = 'periodic' if bc_MPS == 'infinite' else 'open'
        CouplingModel.__init__(self, lat, bc_coupling)

        # 3) Build the Hamiltonian.
        # 3a) on-site terms
        self.add_onsite(delta / 2.0, 0, 'Sigmaz1')
        self.add_onsite(beta, 0, 'Sigmax1')

        # 3b) coupling terms.
        # 3bi) standard Bose-Hubbard coupling terms
        self.add_coupling(-t, 0, 'Sp0', 0, 'Sm0', 1)
        self.add_coupling(-t, 0, 'Sm0', 0, 'Sp0', 1)
        # 3bii) coupling on site bosons to bond spin
        self.add_coupling(-alpha, 0, 'Sp0 Sigmaz1', 0, 'Sm0', 1)
        self.add_coupling(-alpha, 0, 'Sm0 Sigmaz1', 0, 'Sp0', 1)

        # 4) Initialize MPO
        MPOModel.__init__(self, lat, self.calc_H_MPO())
        # 5) Initialize H bond  # LS: what does this mean?
        NearestNeighborModel.__init__(self, self.lat, self.calc_H_bond())
Пример #9
0
    def __init__(self, model_param):
        # model parameters
        L  = get_parameter(model_param, 'L', 2, self.__class__)
        xi = get_parameter(model_param, 'xi', 0.5, self.__class__)
        Jxx  = get_parameter(model_param, 'Jxx', 1., self.__class__)
        Jz = get_parameter(model_param, 'Jz', 1.5, self.__class__)
        hz = get_parameter(model_param, 'hz', 0., self.__class__)
        conserve = get_parameter(model_param, 'conserve', 'Sz', self.__class__)
        if xi == 0.:
            g = 0.
        elif xi == np.inf:
            g = 1.
        else:
            g = np.exp(-1/(xi))
        unused_parameters(model_param, self.__class__)

        # Define the sites and the lattice, which in this case is a simple uniform chain
        # of spin 1/2 sites
        site = SpinHalfSite(conserve=conserve)
        lat = Chain(L, site, bc_MPS='infinite')

        # The operators that appear in the Hamiltonian. Standard spin operators are
        # already defined for the spin 1/2 site, but it is also possible to add new
        # operators using the add_op method
        Sz, Sp, Sm, Id = site.Sz, site.Sp, site.Sm, site.Id

        # yapf:disable
        # The grid (list of lists) that defines the MPO. It is possible to define the
        # operators in the grid in the following ways:
        # 1) NPC arrays, defined above:
        grid = [[Id,   Sp,   Sm,   Sz,   -hz*Sz    ],
                [None, g*Id, None, None, 0.5*Jxx*Sm],
                [None, None, g*Id, None, 0.5*Jxx*Sp],
                [None, None, None, g*Id, Jz*Sz     ],
                [None, None, None, None, Id        ]]
        # 2) In the form [("OpName", strength)], where "OpName" is the name of the
        # operator (e.g. "Sm" for Sm) and "strength" is a number that multiplies it.
        grid = [[[("Id", 1)], [("Sp",1)], [("Sm",1)], [("Sz",1)], [("Sz", -hz)]    ],
                [None       , [("Id",g)], None      , None      , [("Sm", 0.5*Jxx)]],
                [None       , None      , [("Id",g)], None      , [("Sp", 0.5*Jxx)]],
                [None       , None      , None      , [("Id",g)], [("Sz",Jz)]      ],
                [None       , None      , None      , None      , [("Id",1)]       ]]
        # 3) It is also possible to write a single "OpName", equivalent to
        # [("OpName", 1)].
        grid = [["Id"       , "Sp"      , "Sm"      , "Sz"      , [("Sz", -hz)]    ],
                [None       , [("Id",g)], None      , None      , [("Sm", 0.5*Jxx)]],
                [None       , None      , [("Id",g)], None      , [("Sp", 0.5*Jxx)]],
                [None       , None      , None      , [("Id",g)], [("Sz",Jz)]      ],
                [None       , None      , None      , None      , "Id"             ]]
        # yapf:enable
        grids = [grid]*L

        # Generate the MPO from the grid. Note that it is not necessary to specify
        # the physical legs and their charges, since the from_grids method can extract
        # this information from the position of the operators inside the grid.
        H = MPO.from_grids(lat.mps_sites(), grids, bc='infinite', IdL=0, IdR=-1)
        MPOModel.__init__(self, lat, H)
Пример #10
0
 def init_sites(self, model_params):
     conserve = get_parameter(model_params, 'conserve', 'N', self.name)
     site = BosonSite(conserve=conserve)
     return site
Пример #11
0
 def init_sites(self, model_params):
     conserve = get_parameter(model_params, 'conserve', 'parity', self.name)
     return tenpy.networks.site.SpinHalfSite(conserve)
Пример #12
0
def example_function(example_pars, keys=['a', 'b']):
    """example function using a parameter dictionary"""
    for default, k in enumerate(keys):
        p_k = params.get_parameter(example_pars, k, default, "testing")
        print("read out parameter {p_k!r}".format(p_k=p_k))
Пример #13
0
 def init_sites(self, model_params):
     conserve = get_parameter(model_params, 'conserve', 'N', self.name)
     filling = get_parameter(model_params, 'filling', 1 / 2., self.name)
     site = FermionSite(conserve=conserve, filling=filling)
     return site
Пример #14
0
 def init_lattice(self, model_params):
     Lx = get_parameter(model_params, 'Lx', 1, self.name)
     Ly = get_parameter(model_params, 'Ly', 3, self.name)
     fs = self.init_sites(model_params)
     lat = BipartiteSquare(Lx, Ly, fs)
     return lat
Пример #15
0
 def init_sites(self, model_params):
     conserve = get_parameter(model_params, 'conserve', 'N', self.name)
     fs = FermionSite(conserve=conserve)
     gs = GroupedSite([fs, fs], labels=['A', 'B'], charges='same')
     gs.add_op('Ntot', gs.NA + gs.NB, False)
     return gs