Esempio n. 1
0
 def _n_zeta_operator(self) -> csc_matrix:
     """
     Returns
     -------
         `n_\zeta` operator in the harmonic oscillator basis"""
     dimension = self._dim_zeta()
     return (1j * (op.creation_sparse(dimension) -
                   op.annihilation_sparse(dimension)) /
             (self.zeta_osc() * math.sqrt(2)))
Esempio n. 2
0
 def _zeta_operator(self) -> csc_matrix:
     """
     Returns
     -------
         `zeta` operator in the harmonic oscillator basis"""
     dimension = self._dim_zeta()
     return ((op.creation_sparse(dimension) +
              op.annihilation_sparse(dimension)) * self.zeta_osc() /
             math.sqrt(2))
Esempio n. 3
0
    def hamiltonian(
        self,
        return_parts: bool = False
    ) -> Union[csc_matrix, Tuple[csc_matrix, ndarray, ndarray, float]]:
        """Returns Hamiltonian in basis obtained by discretizing phi, employing charge basis for theta, and Fock
        basis for zeta.

        Parameters
        ----------
        return_parts:
            If set to true, `hamiltonian` returns [hamiltonian, evals, evecs, g_coupling_matrix]
        """
        zeropi_dim = self.zeropi_cutoff
        zeropi_evals, zeropi_evecs = self._zeropi.eigensys(
            evals_count=zeropi_dim)
        zeropi_diag_hamiltonian = sparse.dia_matrix((zeropi_dim, zeropi_dim),
                                                    dtype=np.complex_)
        zeropi_diag_hamiltonian.setdiag(zeropi_evals)

        zeta_dim = self.zeta_cutoff
        prefactor = self.E_zeta

        zeta_diag_hamiltonian = op.number_sparse(zeta_dim, prefactor)

        hamiltonian_mat = sparse.kron(
            zeropi_diag_hamiltonian,
            sparse.identity(zeta_dim, format="dia", dtype=np.complex_),
        )
        hamiltonian_mat += sparse.kron(
            sparse.identity(zeropi_dim, format="dia", dtype=np.complex_),
            zeta_diag_hamiltonian,
        )

        gmat = self.g_coupling_matrix(zeropi_evecs)
        zeropi_coupling = sparse.dia_matrix((zeropi_dim, zeropi_dim),
                                            dtype=np.complex_)
        for l1 in range(zeropi_dim):
            for l2 in range(zeropi_dim):
                zeropi_coupling += gmat[l1, l2] * op.hubbard_sparse(
                    l1, l2, zeropi_dim)
        hamiltonian_mat += sparse.kron(
            zeropi_coupling, op.annihilation_sparse(zeta_dim)) + sparse.kron(
                zeropi_coupling.conjugate().T, op.creation_sparse(zeta_dim))

        if return_parts:
            return (hamiltonian_mat.tocsc(), zeropi_evals, zeropi_evecs, gmat)

        return hamiltonian_mat.tocsc()
Esempio n. 4
0
    def hamiltonian(self, return_parts=False):
        """Returns Hamiltonian in basis obtained by discretizing phi, employing charge basis for theta, and Fock
        basis for zeta.

        Parameters
        ----------
        return_parts: bool, optional
            If set to true, `hamiltonian` returns [hamiltonian, evals, evecs, g_coupling_matrix]

        Returns
        -------
        scipy.sparse.csc_matrix or list
        """
        zeropi_dim = self.zeropi_cutoff
        zeropi_evals, zeropi_evecs = self._zeropi.eigensys(
            evals_count=zeropi_dim)
        zeropi_diag_hamiltonian = sparse.dia_matrix((zeropi_dim, zeropi_dim),
                                                    dtype=np.complex_)
        zeropi_diag_hamiltonian.setdiag(zeropi_evals)

        zeta_dim = self.zeta_cutoff
        prefactor = self.omega_zeta()
        zeta_diag_hamiltonian = op.number_sparse(zeta_dim, prefactor)

        hamiltonian_mat = sparse.kron(
            zeropi_diag_hamiltonian,
            sparse.identity(zeta_dim, format='dia', dtype=np.complex_))
        hamiltonian_mat += sparse.kron(
            sparse.identity(zeropi_dim, format='dia', dtype=np.complex_),
            zeta_diag_hamiltonian)

        gmat = self.g_coupling_matrix(zeropi_evecs)
        zeropi_coupling = sparse.dia_matrix((zeropi_dim, zeropi_dim),
                                            dtype=np.complex_)
        for l1 in range(zeropi_dim):
            for l2 in range(zeropi_dim):
                zeropi_coupling += gmat[l1, l2] * op.hubbard_sparse(
                    l1, l2, zeropi_dim)
        hamiltonian_mat += sparse.kron(
            zeropi_coupling,
            op.annihilation_sparse(zeta_dim) + op.creation_sparse(zeta_dim))

        if return_parts:
            return [hamiltonian_mat.tocsc(), zeropi_evals, zeropi_evecs, gmat]

        return hamiltonian_mat.tocsc()