Beispiel #1
0
    def __init__(self, L, Nmax, t, U, mu, V, Vint, offset):
        """
        Initialization.
        Input: system size L (int), maximum occupation number N (int), t, U, mu, V, Vint
               (all are either float or numpy float array of length L) and offset (float).
        Will generate the MPO of Hamiltonian in self.hamil.
        """
        self.L = L
        self.d = Nmax + 1
        self.t = Common.toArray(L, t)
        self.U = Common.toArray(L, U)
        self.mu = Common.toArray(L, mu)
        self.V = Common.toArray(L, V)
        self.Vint = Common.toArray(L, Vint)
        self.hamil = MPO.MPO(L, 5, self.d)
        self.offset = offset
        delta = offset / L

        self.Z = np.zeros((5, self.d, self.d), dtype=complex)
        self.Z[0, :, :] = np.identity(self.d, dtype=complex)  # Id
        self.Z[1, :, :] = np.diag(
            np.arange(self.d) * (np.arange(self.d) - 1) + 0j)  # n(n-1)
        self.Z[2, :, :] = np.diag(np.sqrt(np.arange(self.d - 1) + 1) + 0j,
                                  -1)  # b^dag
        self.Z[3, :, :] = np.diag(np.sqrt(np.arange(self.d - 1) + 1) + 0j,
                                  1)  # b
        self.Z[4, :, :] = np.diag(np.arange(self.d) + 0j)  # n

        opL = np.zeros((1, 5, 5), dtype=complex)
        opL[0, 0, 0] = 1
        opL[0, 1, 2] = 1
        opL[0, 2, 3] = 1
        opL[0, 3, 4] = 1
        opL[0, 4, 4] = self.V[0] - self.mu[0]
        opL[0, 4, 1] = self.U[0] / 2
        opL[0, 4, 0] = delta
        self.hamil.setA(0, np.einsum('ijk,kmn->mnij', opL, self.Z))
        opR = np.zeros((5, 1, 5), dtype=complex)
        opR[0, 0, 4] = self.V[self.L - 1] - self.mu[self.L - 1]
        opR[0, 0, 1] = self.U[self.L - 1] / 2
        opR[0, 0, 0] = delta
        opR[1, 0, 3] = -self.t[self.L - 1]
        opR[2, 0, 2] = -self.t[self.L - 1]
        opR[3, 0, 4] = self.Vint[self.L - 2]
        opR[4, 0, 0] = 1
        self.hamil.setA(L - 1, np.einsum('ijk,kmn->mnij', opR, self.Z))
        for i in range(1, L - 1):
            opM = np.zeros((5, 5, 5), dtype=complex)
            opM[0, 0, 0] = 1
            opM[0, 1, 2] = 1
            opM[0, 2, 3] = 1
            opM[0, 3, 4] = 1
            opM[0, 4, 4] = self.V[i] - self.mu[i]
            opM[0, 4, 1] = self.U[i] / 2
            opM[0, 4, 0] = delta
            opM[1, 4, 3] = -self.t[i]
            opM[2, 4, 2] = -self.t[i]
            opM[3, 4, 4] = self.Vint[i - 1]
            opM[4, 4, 0] = 1
            self.hamil.setA(i, np.einsum('ijk,kmn->mnij', opM, self.Z))
Beispiel #2
0
 def __init__(self, L, Jx, Jy, Jz, g, h, offset):
     """
     Initialization.
     Input: system size L (int), interaction Jx, Jy and Jz, longitudinal field g, transverse field h 
            (Jx, Jy, Jz, g and h are either float or numpy float array of length L) and offset (float).
     Will generate the MPO of Hamiltonian in self.hamil.
     """
     self.L = L
     self.Jx = Common.toArray(L, Jx)
     self.Jy = Common.toArray(L, Jy)
     self.Jz = Common.toArray(L, Jz)
     self.g = Common.toArray(L, g)
     self.h = Common.toArray(L, h)
     self.offset = offset
     self.hamil = MPO.MPO(L, 5, 2)
     opL = np.array([[[1, 0, 0, 0], [0, self.Jx[0], 0, 0], [0, 0, self.Jy[0], 0], [0, 0, 0, self.Jz[0]],
                      [offset / L, self.g[0], 0, self.h[0]]]])
     opR = np.array([[[offset / L, self.g[L - 1], 0, self.h[L - 1]]], [[0, 1, 0, 0]], [[0, 0, 1, 0]],
                     [[0, 0, 0, 1]], [[1, 0, 0, 0]]])
     self.hamil.ops[0].A = np.einsum('ijk,kml->mlij', opL, PauliSigma)
     self.hamil.ops[L - 1].A = np.einsum('ijk,kml->mlij', opR, PauliSigma)
     for i in range(1, L - 1):
         opM = np.array([[[1, 0, 0, 0], [0, self.Jx[i], 0, 0], [0, 0, self.Jy[i], 0],
                          [0, 0, 0, self.Jz[i]], [offset / L, self.g[i], 0, self.h[i]]],
                         [[0, 0, 0, 0], [0, 0, 0, 0], [
                             0, 0, 0, 0], [0, 0, 0, 0], [0, 1, 0, 0]],
                         [[0, 0, 0, 0], [0, 0, 0, 0], [
                             0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0]],
                         [[0, 0, 0, 0], [0, 0, 0, 0], [
                             0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1]],
                         [[0, 0, 0, 0], [0, 0, 0, 0], [
                             0, 0, 0, 0], [0, 0, 0, 0], [1, 0, 0, 0]]
                         ])
         self.hamil.ops[i].A = np.einsum('ijk,kml->mlij', opM, PauliSigma)