3. Capacitance matrix extraction for an Xmon qubit
3.1. Requirements
3.1.1. Software components
QTCAD®
3.1.2. Mesh generation script
qtcad/examples/tutorials/builder_xmon.py
3.1.3. Python script
qtcad/examples/tutorials/cap_xmon_builder.py
3.1.4. References
3.2. Briefing
In this example, we extract the capacitance matrix for an Xmon qubit with coupling capacitors that are meant to couple the qubit to a readout line, an XY control line, and a quantum bus resonator. For more details, please see [BKM+13]. The geometry and the mesh are generated with Builder in the tutorial First- and second-order meshes of an Xmon. The legacy tutorial Capacitance matrix extraction for an Xmon qubit (Legacy) extracts the capacitance matrix of a similar device, whose geometry is generated with the Gmsh Python API. At the end of this tutorial, we repeat the extraction with a second-order mesh.
3.3. Geometry of the problem
The layout of the Xmon is shown below:
Fig. 3.3.4 Layout of the Xmon opened in KLayout.
The capacitance is formed by etching out the gap between the Xmon cross
(xmon_cross) and the ground plane (gnd).
The etching around readout, xy_ctrl, and qbus forms coupling capacitors that
are needed for interfacing the qubit with the rest of the quantum circuit
[BKM+13].
For the purpose of capacitance extraction, we only consider a portion of those conductors
near the Xmon.
The rectangle labeled jj represents the Josephson junction and is not used in this
tutorial. In a circuit model of the qubit, the junction is added as a separate element,
in parallel with the capacitance between xmon_cross and gnd.
3.4. Setting up the device and extracting the capacitance
The procedure for extracting the capacitance matrix is similar to the previous tutorial.
3.4.1. Header, input parameters, and file paths
# Capacitance matrix for an Xmon with coupling capacitors.
#
# See the following article for more details on the operation of an Xmon qubit
# coupled to a readout line, an XY control line, and a quantum bus resonator.
#
# Barends, Rami, et al. "Coherent Josephson qubit suitable for scalable quantum
# integrated circuits." Physical review letters 111.8 (2013): 080502.
from pathlib import Path
from time import time
import os
# import relevant modules of QTCAD
import qtcad.device.capacitance as cap
from qtcad.device.mesh3d import Mesh
from qtcad.device import Device
from qtcad.device import materials as mt
The mesh and the raw geometry file are generated by the tutorial First- and second-order meshes of an Xmon, which must be run first.
# directories and file paths
script_dir = Path(__file__).parent.resolve()
input_dir = script_dir / "meshes" # for mesh and raw geometry files
result_dir = script_dir / "output" / Path(__file__).stem # for results
fpath_mesh = input_dir / "builder_xmon_order1.msh" # first-order mesh file
# uncomment to use the second-order mesh instead
# fpath_mesh = input_dir / "builder_xmon_order2.msh"
fpath_xao = input_dir / "builder_xmon.xao" # raw geometry file (for adaptive meshing)
# code to check that the mesh and raw geometry files exist
if not os.path.isfile(fpath_mesh) or not os.path.isfile(fpath_xao):
raise Exception(
"Please run %s/builder_xmon.py to generate the mesh and geometry files."
% (script_dir)
)
3.4.2. Loading the initial mesh and defining the device
The scale of the mesh is the unit of length of the layout file, 1 μm.
# scale of the mesh
scale = 1e-6 # i.e. the mesh is in μm
# parse the mesh
mesh = Mesh(scale, fpath_mesh)
# Create device from mesh.
dvc = Device(mesh)
# Create regions (note: the device of Barends et al. is on sapphire)
dvc.new_region("substrate", mt.Si)
dvc.new_region("air", mt.vacuum)
# Set potential to zero on the surfaces of each conductor (including ground)
dvc.new_dirichlet_bnd("gnd", 0.0)
dvc.new_dirichlet_bnd("xmon_cross", 0.0)
dvc.new_dirichlet_bnd("xy_ctrl", 0.0)
dvc.new_dirichlet_bnd("readout", 0.0)
dvc.new_dirichlet_bnd("qbus", 0.0)
Note
A common mistake in creating the geometry files and the device in this type of problems
is forgetting to create a 3D physical group for "air" or forgetting to define the
corresponding region. It is important to mesh and assign the correct medium to any region
of space that contains a significant electric field when voltages are applied to the signal
conductors.
We then visualize the device in the QTCAD® visualizer. The right-hand panel of the visualizer lists the regions and boundaries of the device, whose visibility and opacity can be changed interactively (see Poisson and Schrödinger simulation of a nanowire quantum dot).
dvc.show()
Fig. 3.4.4 Device in the QTCAD® visualizer. The controls of the right-hand panel are
used to reduce the opacity of the "substrate" and "air" regions and to hide
the boundaries that do not correspond to conductors.
3.4.3. Creating and running the capacitance solver
Next, we set up the solver parameters. For more details on the adaptive
algorithm parameters for the capacitance solver
(SolverParams), see the previous tutorial and
Capacitance Matrix pages.
######################################################################################
# setup and run the solver
######################################################################################
params = cap.SolverParams()
# directory where results will be stored
params.output_dir = result_dir
# tolerances
params.tol_rel = 0.05
params.tol_abs = 0
# name
params.name = Path(__file__).stem
The signal conductors include all perfect conductor boundaries, except "gnd".
# Set up signal conductors
signal_conductors = ["xmon_cross", "xy_ctrl", "readout", "qbus"]
The following code initializes and executes the adaptive solver:
# initialize the solver
cap_solver = cap.Solver(dvc, signal_conductors, params, geo_file=fpath_xao)
# execute the solver algorithm
t0 = time()
c = cap_solver.solve()
dt = time() - t0
Finally, we display the final result of the solver:
######################################################################################
# Display the final results (in addition to the data in convergence files)
######################################################################################
cap_solver.print_cap(c, decimals=3)
print("Time taken: %.1f s" % dt)
# The solver replaces the mesh of the device by each refined mesh.
print("Number of nodes:", dvc.mesh.node_number)
print("Number of tetrahedra:", dvc.mesh.tetra_number)
Here, the print_cap method is used, which is convenient for printing out matrices with
multiple rows and columns.
The solver replaces the mesh of the device by each refined mesh, so dvc.mesh is the
final mesh.
The resulting values (in farads) are shown below:
xmon_cross xy_ctrl readout qbus
xmon_cross 9.216e-14 -5.330e-17 -2.217e-15 -2.230e-15
xy_ctrl -5.330e-17 3.824e-14 -5.834e-18 -2.395e-18
readout -2.217e-15 -5.834e-18 7.425e-14 -4.613e-17
qbus -2.230e-15 -2.395e-18 -4.613e-17 7.437e-14
The adaptive solver stops when capacitance estimates on successive meshes agree
within tol_rel (here 5%), subject to its minimum iteration requirements.
The final values can therefore differ slightly between runs. Reducing
tol_rel helps reduce these differences at the expense of computation time
and resources.
The dominant entry of the matrix is the diagonal entry of "xmon_cross", about 92 fF,
which is the capacitance between the qubit island and all the other conductors,
including ground.
As expected, the coupling capacitances between the qubit and the other signal conductors
are much smaller.
For example, the coupling capacitance to the XY control line is about 53 aF.
Neglecting the capacitance of the Josephson junction, the diagonal entry of
"xmon_cross" is the total capacitance \(C_\Sigma\) of the island.
The anharmonicity of the qubit is then approximately
\(-E_C/h = -e^2/(2hC_\Sigma) \approx -210\) MHz, where \(E_C\) is the charging
energy [BGGW21, KYG+07].
These values are comparable to the literature [BKM+13].
In a separate set of three benchmarking runs on a Windows 11 computer with an Intel Core i7-13620H processor and 32 GiB of RAM, the solver took 148 to 369 s. The final meshes had 113471 to 256178 nodes and 662700 to 1510562 tetrahedra.
3.5. Using a second-order mesh
To run the capacitance solver with second-order elements, we load the second-order mesh
builder_xmon_order2.msh by uncommenting the second definition of fpath_mesh in
the file paths of the script above.
The solver then uses the same order as the initial mesh.
The second-order mesh is generated in the tutorial First- and second-order meshes of an Xmon,
together with the first-order mesh.
The XAO file stays the same, since it contains only the geometry.
The resulting values (in farads) are shown below:
xmon_cross xy_ctrl readout qbus
xmon_cross 9.661e-14 -5.695e-17 -2.413e-15 -2.412e-15
xy_ctrl -5.695e-17 3.964e-14 -6.279e-18 -2.603e-18
readout -2.413e-15 -6.279e-18 7.690e-14 -4.941e-17
qbus -2.412e-15 -2.603e-18 -4.941e-17 7.690e-14
In a separate set of three benchmarking runs on the same computer, the solver took 336 to 344 s. The final meshes had 592005 to 599406 nodes and 436897 to 442454 tetrahedra.
Second-order elements introduce a computational overhead, since each tetrahedron has six additional nodes, one at the midpoint of each edge. However, the discretization error decays more rapidly as the elements become smaller. As a result, when the desired tolerance is reduced, second-order meshes need far fewer additional elements to converge than first-order meshes, and the computational gains outweigh the overhead that is noticeable at coarse tolerances.
3.6. Full code
__copyright__ = "Copyright 2022-2026, Nanoacademic Technologies Inc."
# Capacitance matrix for an Xmon with coupling capacitors.
#
# See the following article for more details on the operation of an Xmon qubit
# coupled to a readout line, an XY control line, and a quantum bus resonator.
#
# Barends, Rami, et al. "Coherent Josephson qubit suitable for scalable quantum
# integrated circuits." Physical review letters 111.8 (2013): 080502.
from pathlib import Path
from time import time
import os
# import relevant modules of QTCAD
import qtcad.device.capacitance as cap
from qtcad.device.mesh3d import Mesh
from qtcad.device import Device
from qtcad.device import materials as mt
# directories and file paths
script_dir = Path(__file__).parent.resolve()
input_dir = script_dir / "meshes" # for mesh and raw geometry files
result_dir = script_dir / "output" / Path(__file__).stem # for results
fpath_mesh = input_dir / "builder_xmon_order1.msh" # first-order mesh file
# uncomment to use the second-order mesh instead
# fpath_mesh = input_dir / "builder_xmon_order2.msh"
fpath_xao = input_dir / "builder_xmon.xao" # raw geometry file (for adaptive meshing)
# code to check that the mesh and raw geometry files exist
if not os.path.isfile(fpath_mesh) or not os.path.isfile(fpath_xao):
raise Exception(
"Please run %s/builder_xmon.py to generate the mesh and geometry files."
% (script_dir)
)
# scale of the mesh
scale = 1e-6 # i.e. the mesh is in μm
# parse the mesh
mesh = Mesh(scale, fpath_mesh)
# Create device from mesh.
dvc = Device(mesh)
# Create regions (note: the device of Barends et al. is on sapphire)
dvc.new_region("substrate", mt.Si)
dvc.new_region("air", mt.vacuum)
# Set potential to zero on the surfaces of each conductor (including ground)
dvc.new_dirichlet_bnd("gnd", 0.0)
dvc.new_dirichlet_bnd("xmon_cross", 0.0)
dvc.new_dirichlet_bnd("xy_ctrl", 0.0)
dvc.new_dirichlet_bnd("readout", 0.0)
dvc.new_dirichlet_bnd("qbus", 0.0)
dvc.show()
######################################################################################
# setup and run the solver
######################################################################################
params = cap.SolverParams()
# directory where results will be stored
params.output_dir = result_dir
# tolerances
params.tol_rel = 0.05
params.tol_abs = 0
# name
params.name = Path(__file__).stem
# Set up signal conductors
signal_conductors = ["xmon_cross", "xy_ctrl", "readout", "qbus"]
# initialize the solver
cap_solver = cap.Solver(dvc, signal_conductors, params, geo_file=fpath_xao)
# execute the solver algorithm
t0 = time()
c = cap_solver.solve()
dt = time() - t0
######################################################################################
# Display the final results (in addition to the data in convergence files)
######################################################################################
cap_solver.print_cap(c, decimals=3)
print("Time taken: %.1f s" % dt)
# The solver replaces the mesh of the device by each refined mesh.
print("Number of nodes:", dvc.mesh.node_number)
print("Number of tetrahedra:", dvc.mesh.tetra_number)