Giter VIP home page Giter VIP logo

circuitq's Introduction

Logo

CircuitQ

Simulation and analysis of superconducting circuits

CircuitQ is an an open-source toolbox for the analysis of superconducting circuits implemented in Python. It features the automated construction of a symbolic Hamiltonian of the input circuit as well as a dynamic numerical representation of this Hamiltonian with a variable basis choice. Additional features include the estimation of the T1 lifetimes of the circuit states under various noise mechanisms. The circuit quantization procedure is applicable to circuit inputs from a large design space.

Please refer to the documentation for installation instructions and a guideline for using the toolbox.

More details on physics and numerical implementation can be found in our publication.

CircuitQ was developed by Philipp Aumann and Tim Menke under the supervision of William Oliver and Wolfgang Lechner.

circuitq's People

Contributors

nikosavola avatar philippaumann avatar timmenke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

circuitq's Issues

Problem with shunt capacitance to ground

While drawing a flux tunable two island transmon I was not able to implement correctly the shunt capacitance to ground of left and right island.

graph = nx.MultiGraph()
graph.add_edge(1, 2, element='C')
graph.add_edge(1, 2, element='J')
graph.add_edge(1, 2, element='J')
# shunt capacitances to ground
graph.add_edge(0, 1, element='C')
graph.add_edge(2, 3, element='C')

circuit = cq.CircuitQ(graph, ground_nodes= [0,3])
circuit.h

where the error is
Exception: Specified ground node 0 is not an active node.

It seems this error is present in also more complex structures, whenever a ground node is not terminated at some qubit node. One could terminate all the ground nodes of a complex circuit to the same qubit ground node for example, although the graph get a bit confusing and makes the ground_nodes= parameter useless, and I am not sure if it is interpreted correctly since both C will be called C01

Equivalent circuits have different Hamiltonians?

I expected Hamiltonians to be invariant under changing the order in which parallel edges are added, but this appears not to be the case.

Is this a change in coordinates somehow, or a bug?

graph.add_edge(0,1, element = 'L')
graph.add_edge(0,1, element = 'J')

circuit = cq.CircuitQ(graph, ground_nodes=[0, 1])
print(circuit.h)

yields

-E_{J010}*cos(\tilde{\Phi}_{010}/\Phi_{o})

While

graph.add_edge(0,1, element = 'J')
graph.add_edge(0,1, element = 'L')

circuit = cq.CircuitQ(graph, ground_nodes=[0, 1])
print(circuit.h)

yields what looks something like a small angle approximation (?) of the above Hamiltonian

-E_{J010} + \tilde{\Phi}_{010}**2/(2*L_{010})

Question about T1 calculation of CircuitQ

When I calculate the T1 value of the qubit several times with the same hamiltonian, the values decrease in each time.

First, create the fluxonium qubit.

# this cell is extracted from the tutorial section of circuitQ documentation
import circuitq as cq
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
graph = nx.MultiGraph()
graph.add_edge(0,1, element = 'C')
graph.add_edge(0,1, element = 'J')
graph.add_edge(0,1, element = 'L')
circuit = cq.CircuitQ(graph)

# set the circuit parameters
# use the same parameters as the tutorial
EJ = circuit.c_v["E"]/3
phi_ext = np.pi*circuit.phi_0

There are three methods for T1 calculation, get_T1_quasiparticles(), get_T1_charge(), and get_T1_flux(). In my code, everytime I calcurate the T1 with the same hamiltonian, T1_charge and T1_flux decrease. ( I recreate the same hamiltonian in each loop.) I do not know why the values decrease even though I use the same circuit parameters.
The eigenvalues were not changing. Only T1_charge and T1_flux.

T1_qp = []
T1_c = []
T1_f = []
for i in range(15):
    circuit.get_numerical_hamiltonian(401, parameter_values=[False, EJ, False, phi_ext])
    circuit.get_eigensystem()
    
    # T1 caluculation
    T1_qp.append(circuit.get_T1_quasiparticles())
    T1_c.append(circuit.get_T1_charge())
    T1_f.append(circuit.get_T1_flux())
# plot each T1 value
plt.plot(np.arange(15), T1_qp/T1_qp[0],'ro', label = 'T1_qp')
plt.plot(np.arange(15), T1_c/T1_c[0],'go', label = 'T1_c')
plt.plot(np.arange(15), T1_f/T1_f[0],'bx', label = 'T1_f', markersize = 10)
plt.legend()
plt.xlabel('number of loop')
plt.ylabel('T1 proportion')
plt.show()

image
I also found that I could get the same T1_c and T1_f if we don't recreate the hamiltonian. The same value was calculated even when get_eigensystem() method was done in each loop. The get_numerical_hamiltonian() method, however, made the situation bad, I guess.

T1_qp = []
T1_c = []
T1_f = []
for i in range(15):
    circuit.get_eigensystem()
    # T1 caluculation
    T1_qp.append(circuit.get_T1_quasiparticles())
    T1_c.append(circuit.get_T1_charge())
    T1_f.append(circuit.get_T1_flux())
# plot each T1 value
plt.plot(np.arange(15), T1_qp/T1_qp[0],'ro', label = 'T1_qp')
plt.plot(np.arange(15), T1_c/T1_c[0],'go', label = 'T1_c')
plt.plot(np.arange(15), T1_f/T1_f[0],'bx', label = 'T1_f', markersize = 10)
plt.legend()
plt.xlabel('number of loop')
plt.ylabel('T1 proportion')
plt.show()

image

visualization of a circuit

Hi,
I have issue with using the visualization function:

`import circuitq as cq
import networkx as nx
import matplotlib.pyplot as plt

Create the graph

graph = nx.MultiGraph()
graph.add_edge(0, 1, element='C')
graph.add_edge(0, 1, element='J')

Create a CircuitQ object

circuit = cq.CircuitQ(graph)

Visualize the circuit

circuitq.functions_file.visualize_circuit_general(circuit, "Macintosh HD/Users/fani/Desktop/circuit.png")`

here is the Error:


AttributeError Traceback (most recent call last)
Cell In[14], line 14
11 circuit = cq.CircuitQ(graph)
13 # Visualize the circuit
---> 14 circuitq.functions_file.visualize_circuit_general(circuit, "Macintosh HD/Users/fani/Desktop/circuit.png")

File /opt/anaconda3/envs/circuitQ1/lib/python3.9/site-packages/circuitq-1.2.1-py3.9.egg/circuitq/functions_file.py:17, in visualize_circuit_general(graph, save_as)
6 """
7 Visualises a circuit by creating a figure to an arbitrary path.
8
(...)
14 Arbitrary figure path
15 """
16 circuit_func = copy.deepcopy(graph)
---> 17 for e in circuit_func.edges.data():
18 e[2]['label'] = e[2]['element']
19 circuit_vis = nx.nx_agraph.to_agraph(circuit_func)

AttributeError: 'CircuitQ' object has no attribute 'edges'

Implemented Hamiltonian expression has $$q^q$$ instead of $$q^2$$

Hi,

On line 637 of core.py, the following expression is used when creating the implemented Hamiltonian:

q_q = sp.symbols('q^{q}_{' + str(node_l) + '}')

I'm wondering if it should be the expression below instead?

q_q = sp.symbols('q^{2}_{' + str(node_l) + '}')

spa.linalg.eigsh import does not work correctly

import scipy.sparse as spa
evals, estates = spa.linalg.eigsh(self.h_num, k=self.n_eig, which='SA' ,v0=v0) 

does not work in my installation with the latest scipy and python. The reason is this https://stackoverflow.com/questions/65909046/module-scipy-sparse-has-no-attribute-linalg-error-in-reticulate-virtual-envi

and can be easily fixed by doing

import scipy.sparse.linalg
 evals, estates = scipy.sparse.linalg.eigsh(self.h_num, k=self.n_eig, which='SA',v0=v0)

circuitq uses deprecated np.complex

Hi Philipp!

I noticed CirquitQ breaks with the most recent numpy due to the np.complex attribute being deprecated. From what I understand np.complex128 is available to explicitly specify the datatype.

Relevant part of the traceback:

circuitq\core.py in transform_charge_to_flux(self)
   1207         reversed_subspace_pos = dict(map(reversed, self.subspace_pos.items()))
   1208         length = len(self.estates[:,0])
-> 1209         T = np.ones((length, length), dtype=np.complex)
   1210         for i in range(length):
   1211             for j in range(length):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.