Skip to content

Commit

Permalink
added instructions on how to extract relevant hamiltonian
Browse files Browse the repository at this point in the history
  • Loading branch information
Phionx committed Jul 31, 2024
1 parent ad05352 commit dbfc5d0
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 12 deletions.
103 changes: 91 additions & 12 deletions tutorials/ats-coupler/0-resonator-ats-resonator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -47,62 +47,141 @@
" 'ω_ResonatorB': Array(7.00151547, dtype=float64)}"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# system, ϕ0, metrics0, system0 = get_system_normal_rar({})\n",
"# Analytic calculation of relevant metrics\n",
"ϕ0, metrics0, system0 = get_metrics_linear_rar({})\n",
"metrics0"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([ 0.00000000e+00, -3.55271368e-06, 3.55271368e-06, -3.55271368e-06,\n",
" -1.06581410e-05, 2.13162821e-05], dtype=float64)"
"Array([ 1.77635684e-06, -3.55271368e-06, 3.55271368e-06, 3.55271368e-06,\n",
" -1.77635684e-05, 2.13162821e-05], dtype=float64)"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Calculate Kerr in full system\n",
"metrics, system, ϕ0, metrics0, system0 = get_metrics_normal_rar({})#{\"ResonatorA_frequency\": 3})\n",
"metrics[\"K_a\"]*1e9"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([ 9.07343001e+00, 9.07285802e+00, 9.07207109e+00, 9.07084541e+00,\n",
" -1.22035928e+01, 4.27481506e+05], dtype=float64)"
"Array([ 9.07340869e+00, 9.07284026e+00, 9.07218478e+00, 9.07082054e+00,\n",
" -1.22036532e+01, 4.27481506e+05], dtype=float64)"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Can override parameters!\n",
"metrics, system, ϕ0, metrics0, system0 = get_metrics_normal_rar({\n",
" \"ATS__dE_J\": 37.0 * 0.01\n",
"})\n",
"metrics[\"K_a\"]*1e9"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Relevant Hamiltonian Terms for a Time Dep Simulation"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"metrics, system, ϕ0, metrics0, system0 = get_metrics_normal_rar({})"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"H_static = system.get_H()\n",
"\n",
"phi = system.params[\"phi\"]\n",
"Ejb = system.devices[1].params[\"Ej\"]\n",
"H_drive = -2*Ejb*jqt.sinm(phi)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"# The full system Hamiltonian H = H_static + sin(eps(t)) * H_drive\n",
"H_static_qt = jqt.jqt2qt(H_static)\n",
"H_drive_qt = jqt.jqt2qt(H_drive) "
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"Quantum object: dims=[[8, 10, 8], [8, 10, 8]], shape=(640, 640), type='oper', dtype=Dense, isherm=True$$\\left(\\begin{array}{cc}0 & -0.697 & 0 & 2.651\\times10^{ -5 } & 0 & \\cdots & 0 & 0 & 0 & 0 & 0\\\\-0.697 & 0 & -0.986 & 0 & 5.302\\times10^{ -5 } & \\cdots & 0 & 0 & 0 & 0 & 0\\\\0 & -0.986 & 0 & -1.207 & 0 & \\cdots & 0 & 0 & 0 & 0 & 0\\\\2.651\\times10^{ -5 } & 0 & -1.207 & 0 & -1.394 & \\cdots & 0 & 0 & 0 & 0 & 0\\\\0 & 5.302\\times10^{ -5 } & 0 & -1.394 & 0 & \\cdots & 0 & 0 & 0 & 0 & 0\\\\\\vdots & \\vdots & \\vdots & \\vdots & \\vdots & \\ddots & \\vdots & \\vdots & \\vdots & \\vdots & \\vdots\\\\0 & 0 & 0 & 0 & 0 & \\cdots & 0 & -1.139 & 0 & 9.688\\times10^{ -5 } & 0\\\\0 & 0 & 0 & 0 & 0 & \\cdots & -1.139 & 0 & -1.274 & 0 & 1.282\\times10^{ -4 }\\\\0 & 0 & 0 & 0 & 0 & \\cdots & 0 & -1.274 & 0 & -1.395 & 0\\\\0 & 0 & 0 & 0 & 0 & \\cdots & 9.688\\times10^{ -5 } & 0 & -1.395 & 0 & -1.507\\\\0 & 0 & 0 & 0 & 0 & \\cdots & 0 & 1.282\\times10^{ -4 } & 0 & -1.507 & 0\\end{array}\\right)$$"
],
"text/plain": [
"Quantum object: dims=[[8, 10, 8], [8, 10, 8]], shape=(640, 640), type='oper', dtype=Dense, isherm=True\n",
"Qobj data =\n",
"[[ 0. -0.69714856 0. ... 0. 0.\n",
" 0. ]\n",
" [-0.69714856 0. -0.98587103 ... 0. 0.\n",
" 0. ]\n",
" [ 0. -0.98587103 0. ... 0. 0.\n",
" 0. ]\n",
" ...\n",
" [ 0. 0. 0. ... 0. -1.39529043\n",
" 0. ]\n",
" [ 0. 0. 0. ... -1.39529043 0.\n",
" -1.50720291]\n",
" [ 0. 0. 0. ... 0. -1.50720291\n",
" 0. ]]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"H_drive_qt # qutip job"
]
}
],
"metadata": {
Expand All @@ -121,7 +200,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions tutorials/ats-coupler/rar_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def get_system_normal_rar(params):
system = qs.System.create(devices, couplings=couplings)
system.params["phi_c"] = phi_c
system.params["phi_c_alternative"] = phi_c_alternative
system.params["phi"] = phi
return system, ϕ0, metrics0, system0

@jit
Expand Down

0 comments on commit dbfc5d0

Please sign in to comment.