-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
599 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%load_ext autoreload\n", | ||
"%autoreload 2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from jax import jit, grad\n", | ||
"import qcsys as qs\n", | ||
"import jax.numpy as jnp\n", | ||
"import jaxquantum as jqt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def calculate_chi_diagonalize():\n", | ||
" _, Ec_a, El_a = qs.calculate_lambda_over_four_resonator_zpf(5, 50)\n", | ||
"\n", | ||
" resonator = qs.Resonator.create(\n", | ||
" 10,\n", | ||
" {\"Ec\": Ec_a, \"El\": El_a},\n", | ||
" N_pre_diag=10,\n", | ||
" )\n", | ||
"\n", | ||
" Ec_q = 1\n", | ||
" El_q = 0.5\n", | ||
" Ej_q = 8\n", | ||
"\n", | ||
" qubit = qs.Fluxonium.create(\n", | ||
" 25,\n", | ||
" {\"Ec\": Ec_q, \"El\": El_q, \"Ej\": Ej_q, \"phi_ext\": 0.47},\n", | ||
" use_linear=False,\n", | ||
" N_pre_diag=100,\n", | ||
" )\n", | ||
"\n", | ||
" g_rq = 0.3\n", | ||
"\n", | ||
" devices = [resonator, qubit]\n", | ||
" r_indx = 0\n", | ||
" q_indx = 1\n", | ||
" Ns = [device.N for device in devices]\n", | ||
"\n", | ||
" a0 = qs.promote(resonator.ops[\"a\"], r_indx, Ns)\n", | ||
" a0_dag = qs.promote(resonator.ops[\"a_dag\"], r_indx, Ns)\n", | ||
"\n", | ||
" q0 = qs.promote(qubit.ops[\"a\"], q_indx, Ns)\n", | ||
" q0_dag = qs.promote(qubit.ops[\"a_dag\"], q_indx, Ns)\n", | ||
"\n", | ||
" couplings = []\n", | ||
" couplings.append(-g_rq * (a0 - a0_dag) @ (q0 - q0_dag))\n", | ||
"\n", | ||
" system = qs.System.create(devices, couplings=couplings)\n", | ||
" system.params[\"g_rq\"] = g_rq\n", | ||
"\n", | ||
" Es, kets = system.calculate_eig()\n", | ||
"\n", | ||
" # chi ----\n", | ||
" χ_e = Es[1:, 1] - Es[:-1, 1]\n", | ||
" χ_g = Es[1:, 0] - Es[:-1, 0]\n", | ||
" χ = χ_e - χ_g\n", | ||
"\n", | ||
" return χ" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Array([-0.00399307, -0.00369734, -0.0191641 , 0.13341733, -0.19415304,\n", | ||
" -0.00187664, -1.06201788, 1.10409898, -0.49863942], dtype=float64)" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"calculate_chi_diagonalize()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Normal Mode Approach" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Normal Mode Estimate\n", | ||
"\n", | ||
"def calculate_chi_normal_modes():\n", | ||
" _, Ec_a, El_a = qs.calculate_lambda_over_four_resonator_zpf(5, 50)\n", | ||
"\n", | ||
" resonator = qs.Resonator.create(\n", | ||
" 10,\n", | ||
" {\"Ec\": Ec_a, \"El\": El_a},\n", | ||
" N_pre_diag=10,\n", | ||
" )\n", | ||
"\n", | ||
" Ec_q = 1\n", | ||
" El_q = 0.5\n", | ||
" Ej_q = 8\n", | ||
"\n", | ||
" qubit = qs.Fluxonium.create(\n", | ||
" 25,\n", | ||
" {\"Ec\": Ec_q, \"El\": El_q, \"Ej\": Ej_q, \"phi_ext\": 0.47},\n", | ||
" use_linear=True,\n", | ||
" N_pre_diag=100,\n", | ||
" )\n", | ||
"\n", | ||
" g_rq = 0.3\n", | ||
"\n", | ||
" devices = [resonator, qubit]\n", | ||
" r_indx = 0\n", | ||
" q_indx = 1\n", | ||
" Ns = [device.N for device in devices]\n", | ||
"\n", | ||
" a0 = qs.promote(resonator.ops[\"a\"], r_indx, Ns)\n", | ||
" a0_dag = qs.promote(resonator.ops[\"a_dag\"], r_indx, Ns)\n", | ||
"\n", | ||
" q0 = qs.promote(qubit.ops[\"a\"], q_indx, Ns)\n", | ||
" q0_dag = qs.promote(qubit.ops[\"a_dag\"], q_indx, Ns)\n", | ||
"\n", | ||
" couplings = []\n", | ||
" couplings.append(-g_rq * (a0 - a0_dag) @ (q0 - q0_dag))\n", | ||
"\n", | ||
" linear_system = qs.System.create(devices, couplings=couplings)\n", | ||
" linear_system.params[\"g_rq\"] = g_rq\n", | ||
"\n", | ||
" Es, kets = linear_system.calculate_eig()\n", | ||
"\n", | ||
" # participations\n", | ||
"\n", | ||
" vac = kets[0, 0]\n", | ||
" \n", | ||
" e = {}\n", | ||
" e[linear_system.devices[0].label] = kets[1, 0]\n", | ||
" e[linear_system.devices[1].label] = kets[0, 1]\n", | ||
" e.keys()\n", | ||
"\n", | ||
" \"\"\"extract participations\"\"\"\n", | ||
" ϕ = {device.label: {} for device in linear_system.devices}\n", | ||
"\n", | ||
" for j, d1 in enumerate(linear_system.devices):\n", | ||
" phi_0 = linear_system.promote(d1.ops[\"phi\"], j).data\n", | ||
" for d2 in linear_system.devices:\n", | ||
" ϕ[d1.label][d2.label] = jqt.dag_data(e[d2.label]) @ phi_0 @ vac\n", | ||
"\n", | ||
" theta_a = ϕ[\"Fluxonium0\"][\"Resonator0\"]\n", | ||
"\n", | ||
"\n", | ||
" return theta_a" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Array(0.19994616+0.j, dtype=complex128)" | ||
] | ||
}, | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"calculate_chi_normal_modes()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "jax-framework", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%load_ext autoreload\n", | ||
"%autoreload 2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from jax import jit, grad\n", | ||
"import qcsys as qs\n", | ||
"import jax.numpy as jnp\n", | ||
"from rar_helpers import *" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import jaxquantum as jqt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# system, ϕ0, metrics0, system0 = get_system_normal_rar({})\n", | ||
"ϕ0, metrics0, system0 = get_metrics_linear_rar({})" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"{'g_ex': Array(-0.00212182+0.j, dtype=complex128),\n", | ||
" 'ω_ATS': Array(6.02181564, dtype=float64),\n", | ||
" 'ω_ResonatorA': Array(4.99584201, dtype=float64),\n", | ||
" 'ω_ResonatorB': Array(7.00151547, dtype=float64)}" | ||
] | ||
}, | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"metrics0" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "jax-framework", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.