Skip to content

Commit

Permalink
added dephasing calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Phionx committed Sep 3, 2024
1 parent 6d7a1ca commit e52f78d
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
92 changes: 92 additions & 0 deletions tutorials/ats-coupler/0-resonator-ats-resonator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,26 @@
"H_static = H_full - qs.ATS.get_H_nonlinear_static(phi_op, ATS_Ej, ATS_dEj, ATS_Ej2, phi_sum, phi_delta)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array(0., dtype=float64)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"jnp.max(jnp.abs((H_static - H_full).data ))"
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -261,6 +281,78 @@
"# Run Sweep"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Calculate Dephasing"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"def res_a_energies(phi_ext):\n",
" metrics, system, ϕ0, metrics0, system0 = get_metrics_normal_rar({\n",
" \"ATS__phi_sum_ext\": phi_ext[0],\n",
" \"ATS__phi_delta_ext\": phi_ext[1],\n",
" })\n",
"\n",
" Es = metrics[\"E\"]\n",
"\n",
" res_a = Es[1,0,0] - Es[0,0,0]\n",
" return res_a \n",
"\n",
"dephasing_a_phi_sum = jit(grad(res_a_energies))\n",
"\n",
"def res_b_energies(phi_ext):\n",
" metrics, system, ϕ0, metrics0, system0 = get_metrics_normal_rar({\n",
" \"ATS__phi_sum_ext\": phi_ext[0],\n",
" \"ATS__phi_delta_ext\": phi_ext[1],\n",
" })\n",
"\n",
" Es = metrics[\"E\"]\n",
"\n",
" res_b = Es[0,0,1] - Es[0,0,0]\n",
" return res_b\n",
"\n",
"dephasing_a_phi_sum = jit(grad(res_a_energies))\n",
"dephasing_b_phi_sum = jit(grad(res_b_energies))"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
"bias_point = jnp.array([0.25, 0.25])\n",
"dEa_dphi = dephasing_a_phi_sum(bias_point)\n",
"dEb_dphi = dephasing_b_phi_sum(bias_point)"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(Array([0., 0.], dtype=float64), Array([0., 0.], dtype=float64))"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dEa_dphi, dEb_dphi"
]
},
{
"cell_type": "markdown",
"metadata": {},
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 @@ -288,5 +288,6 @@ def get_metrics_normal_rar(params):
metrics = {}
metrics["K_a"] = K_a
metrics["K_b"] = K_b
metrics["E"] = Es

return metrics, system, ϕ0, metrics0, system0

0 comments on commit e52f78d

Please sign in to comment.