def hamiltonian(self) -> csc_matrix: """ Returns Hamiltonian in basis obtained by employing harmonic basis for :math:`\\phi, \\zeta` and charge basis for :math:`\\theta`. """ phi_osc_mat = self._kron3( op.number_sparse(self._dim_phi(), self.phi_plasma()), self._identity_zeta(), self._identity_theta(), ) zeta_osc_mat = self._kron3( self._identity_phi(), op.number_sparse(self._dim_zeta(), self.zeta_plasma()), self._identity_theta(), ) cross_kinetic_mat = ( 2 * self._disordered_ecj() * (self.n_theta_operator() - self.total_identity() * self.ng - self.n_zeta_operator())**2) phi_flux_term = self._cos_phi_operator() * np.cos( self.flux * np.pi) - self._sin_phi_operator() * np.sin( self.flux * np.pi) junction_mat = (-2 * self.EJ * self._kron3( phi_flux_term, self._identity_zeta(), self._cos_theta_operator()) + 2 * self.EJ * self.total_identity()) disorder_l = (-2 * self._disordered_el() * self.dL * self._kron3(self._phi_operator(), self._zeta_operator(), self._identity_theta())) dis_phi_flux_term = self._sin_phi_operator() * np.cos( self.flux * np.pi) + self._cos_phi_operator() * np.sin( self.flux * np.pi) disorder_j = (2 * self.EJ * self.dEJ * self._kron3(dis_phi_flux_term, self._identity_zeta(), self._sin_theta_operator())) dis_c_opt = ( self._kron3(self._n_phi_operator(), self._identity_zeta(), self._n_theta_operator()) - self.n_phi_operator() * self.ng - self._kron3(self._n_phi_operator(), self._n_zeta_operator(), self._identity_theta())) disorder_c = -4 * self._disordered_ecj() * self.dCJ * dis_c_opt return (phi_osc_mat + zeta_osc_mat + cross_kinetic_mat + junction_mat + disorder_l + disorder_j + disorder_c)
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()
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()