def test_tunneling(): "Tunneling operator" N = 5 tn = tunneling(2*N+1) tn_matrix = np.diag(np.ones(2*N),k=-1) + np.diag(np.ones(2*N),k=1) assert_equal(np.allclose(tn.full(), tn_matrix), True) tn = tunneling(2*N+1,2) tn_matrix = np.diag(np.ones(2*N-1),k=-2) + np.diag(np.ones(2*N-1),k=2) assert_equal(np.allclose(tn.full(), tn_matrix), True)
def calc_Hj_cb(self, phi): """ Calculate Josephson energy in charge bassis. phi = pi Flux/Flux_quantum Returns ------- qp.Qobj """ scalar = - np.sign(np.cos(phi))*self.Ej * \ self._phi_coeff(phi) / 2 op = qp.tunneling(self.space_dim, 1) return scalar * op
def test_tunneling_type(): "Operator CSR Type: tunneling" op = tunneling(5) assert_equal(isspmatrix_csr(op.data), True)
def H_J(E_j,N): return -E_j/2*qp.tunneling(2*N+1,1)
def test_tunneling(shift): N = 10 tn = qutip.tunneling(N, shift) tn_matrix = np.diag(np.ones(N - shift), k=shift) tn_matrix += tn_matrix.T np.testing.assert_allclose(tn.full(), tn_matrix)