diff --git a/tutorials/ats-coupler/0-resonator-ats-resonator.ipynb b/tutorials/ats-coupler/0-resonator-ats-resonator.ipynb index 605e2bc..dc63222 100644 --- a/tutorials/ats-coupler/0-resonator-ats-resonator.ipynb +++ b/tutorials/ats-coupler/0-resonator-ats-resonator.ipynb @@ -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, @@ -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": {}, diff --git a/tutorials/ats-coupler/rar_helpers.py b/tutorials/ats-coupler/rar_helpers.py index 385dcde..0bf5f9d 100644 --- a/tutorials/ats-coupler/rar_helpers.py +++ b/tutorials/ats-coupler/rar_helpers.py @@ -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 \ No newline at end of file