Esempio n. 1
0
def return_op(Nx, Ny, sym=None, backend='numpy'):
    """
    Return the operators

    Args:
        Nx : int
            Lattice size in the x direction
        Ny : int
            Lattixe size in the y direction

    Returns:
        op
    """
    # Collect relevant operators
    ops = OPS(sym=sym, backend=backend)

    # Operators within columns
    columns = []
    for x in range(Nx):
        col_ops = []
        for y in range(Ny - 1):
            col_ops.append(op(ops))
        columns.append(col_ops)

    # Operators within Rows
    rows = []
    for y in range(Ny):
        row_ops = []
        for x in range(Nx - 1):
            row_ops.append(op(ops))
        rows.append(row_ops)

    return [columns, rows]
Esempio n. 2
0
def return_op(Nx, Ny, params, sym=None, backend='numpy'):
    """
    Return the operators

    Args:
        Nx : int
            Lattice size in the x direction
        Ny : int
            Lattixe size in the y direction
        params : 1D Array
            The parameters for the hamiltonian.
            Here,
                params[0] = spin-spin interaction
                params[1] = Magnetic Field

    Returns:
        op
    """
    # Collect useful operators
    ops = OPS(sym=sym, backend=backend)

    # Operators within columns
    columns = []
    for x in range(Nx):
        col_ops = []
        for y in range(Ny - 1):
            if y == 0:
                col_ops.append(op0(params, ops))
            elif y == Ny - 2:
                col_ops.append(opN(params, ops))
            else:
                col_ops.append(op(params, ops))
        columns.append(col_ops)

    # Operators within Rows
    rows = []
    for y in range(Ny):
        row_ops = []
        for x in range(Nx - 1):
            if x == 0:
                row_ops.append(op0(params, ops))
            elif x == Nx - 2:
                row_ops.append(opN(params, ops))
            else:
                row_ops.append(op(params, ops))
        rows.append(row_ops)

    return [columns, rows]
Esempio n. 3
0
def return_act_op(Nx,Ny,params,hermitian=False,sym=None,backend='numpy'):
    """
    Operators to compute the activity

    Args:
        Nx : int
            Lattice size in the x direction
        Ny : int
            Lattixe size in the y direction
        params : 1D Array
            The parameters for the hamiltonian.
            Here,
                params[0] = c      : Spin flip rate, c = beta = 1/T = ln(1-c)/c
                params[1] = \lambda: Bias towards higher activity 

    Returns:
        op
    """
    # Collect useful operators
    ops = OPS(sym=sym,backend=backend)

    # Operators within columns
    columns = []
    for x in range(Nx):
        col_ops = []
        for y in range(Ny-1):
            if (x == 0) and (y == Ny-2):
                col_ops.append(corner_act_op(params,ops,hermitian=hermitian))
            else:
                col_ops.append(act_op(params,ops,hermitian=hermitian))
        columns.append(col_ops)

    # Operators within Rows
    rows = []
    for y in range(Ny):
        row_ops = []
        for x in range(Nx-1):
            if (x == 0) and (y == Ny-1):
                row_ops.append(corner_act_op(params,ops,hermitian=hermitian))
            else:
                row_ops.append(act_op(params,ops,hermitian=hermitian))
        rows.append(row_ops)

    return [columns,rows]
Esempio n. 4
0
def return_op(Nx, Ny, j1=1., j2=0., bx=0., bz=0., sym=None, backend='numpy'):
    """
    Return the operators

    Args:
        Nx : int
            Lattice size in the x direction
        Ny : int
            Lattixe size in the y direction

    Kwargs:
        j1 : float
            The nearest neighbor interaction strength
        j2 : float
            The next nearest neighbor interaction strength
        bx : float
            The strength of the on site x-direction field.
        bz : float
            The strength of the on site z-direction field.

    Returns:
        op
    """
    # Haven't figured out symmetric case for NN interactions
    if sym is not None:
        raise NotImplementedError()

    # Collect relevant operators
    ops = OPS(sym=sym, backend=backend)

    # Get the tensor backend
    if isinstance(backend, str):
        backend = load_lib(backend)
    else:
        backend = backend

    # Loop over columns
    all_cols = []
    for x in range(Nx - 1):
        single_col = []
        for y in range(Ny - 1):
            # Create a list to hold all the MPOs acting on the 2x2 unit cell
            cell_mpos = []

            # Create first MPO
            # The first acts on the left and bottom bonds
            # and contains the (0,0)-(0,1) and (0,0)-(1,0)
            # interactions. The (0,0) site always contains
            # a single site field. At the top boundary, the
            # field is also applied to the (0,1) site and at
            # the right boundary, the field is also applied
            # to the (1,0) site.
            #     __             __
            #    |1 |           |  |
            #    |o_|           |__|
            #     |
            #     |
            #     |
            #     |
            #     |_             __
            #    ||2|           |3 |
            #    |o--------------o_|
            cell_mpos.append(
                mpo(ops,
                    j1,
                    j2,
                    bx,
                    bz,
                    backend,
                    interaction01=True,
                    interaction12=True,
                    left_field=(y == Ny - 2),
                    center_field=True,
                    right_field=(x == Nx - 2)))
            # Create second MPO
            # The second acts on the right and bottom bonds
            # and contains the (0,0)-(1,1) interactions on
            # all units and the (0,1)-(1,1) interaction on
            # units on the right hand side. (Note that these
            # are applied to tensors of a flipped PEPS).
            #     __             __
            #    |  |           | 1|
            #    |__|           |o_|
            #                    |
            #                    |
            #                    |
            #                    |
            #     __             |_
            #    | 3|           ||2|
            #    |_o-------------o_|
            cell_mpos.append(
                mpo(ops, j1, j2, bx, bz, backend, interaction02=True))
            # Create third MPO
            # The third acts on the top and right bonds
            # and always contains the (0,1)-(1,0) interaction
            # and when on the top boundary it also
            # includes the (0,1)-(1,1) interaction.
            # A field is added to the (1,1) site
            # when at the rightmost and
            # uppermost unit cell.
            #     __             __
            #    |  o-------------o|
            #    |1_|           |2||
            #                     |
            #                     |
            #                     |
            #                     |
            #     __             _|
            #    |  |           | o|
            #    |__|           |3_|
            cell_mpos.append(
                mpo(ops,
                    j1,
                    j2,
                    bx,
                    bz,
                    backend,
                    interaction02=True,
                    interaction01=(y == Ny - 2),
                    interaction12=(x == Nx - 2),
                    center_field=((y == Ny - 2) and (x == Nx - 2))))

            # Add mpos on the 2x2 square into the column's interactions
            single_col.append(cell_mpos)

        # Add columns interaction to list of all interactions
        all_cols.append(single_col)

    return all_cols