{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# V-Type Three-Level: Solitons form Simulton\n", "\n", "In this example, a soliton is put in on both the probe and the coupling fields." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "sech_fwhm_conv = 1.0 / 2.6339157938\n", "t_width = 1.0 * sech_fwhm_conv # [τ]\n", "\n", "print(\"t_width\", t_width)\n", "\n", "n_1 = np.sqrt(8) # For a pulse area of nπ\n", "ampl_1 = n_1 / t_width / (2 * np.pi) # Pulse amplitude [2π Γ]\n", "\n", "print(\"ampl_1\", ampl_1)\n", "\n", "n_2 = np.sqrt(8) # For a pulse area of nπ\n", "ampl_2 = n_2 / t_width / (2 * np.pi) # Pulse amplitude [2π Γ]\n", "\n", "print(\"ampl_2\", ampl_2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "np.sqrt(n_1**2 + n_2**2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mb_solve_json = \"\"\"\n", "{{\n", " \"atom\": {{\n", " \"fields\": [\n", " {{\n", " \"coupled_levels\": [[0, 1]],\n", " \"label\": \"probe\",\n", " \"rabi_freq\": 1.0,\n", " \"rabi_freq_t_args\": \n", " {{\n", " \"ampl\": {ampl_1},\n", " \"centre\": 0.0,\n", " \"width\": {t_width}\n", " }},\n", " \"rabi_freq_t_func\": \"sech\"\n", " }},\n", " {{\n", " \"coupled_levels\": [[0, 2]],\n", " \"label\": \"coupling\",\n", " \"rabi_freq\": 1.0,\n", " \"rabi_freq_t_args\": \n", " {{\n", " \"ampl\": {ampl_2},\n", " \"centre\": 3.0,\n", " \"width\": {t_width}\n", " }},\n", " \"rabi_freq_t_func\": \"sech\"\n", " }}\n", " ],\n", " \"num_states\": 3\n", " }},\n", " \"t_min\": -2.0,\n", " \"t_max\": 14.0,\n", " \"t_steps\": 200,\n", " \"z_min\": -0.5,\n", " \"z_max\": 1.5,\n", " \"z_steps\": 500,\n", " \"z_steps_inner\": 1,\n", " \"interaction_strengths\": [50.0, 10.0],\n", " \"savefile\": \"mbs-vee-sech-sqrt8pi-sqrt8pi-collision\"\n", "}}\n", "\"\"\".format(ampl_1=ampl_1, t_width=t_width, ampl_2=ampl_2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from maxwellbloch import mb_solve\n", "\n", "mb_solve_00 = mb_solve.MBSolve().from_json_str(mb_solve_json)\n", "\n", "%time Omegas_zt, states_zt = mb_solve_00.mbsolve(recalc=False, pbar_chunk_size=2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "%matplotlib inline\n", "import seaborn as sns\n", "\n", "sns.set_style(\"darkgrid\")\n", "fig = plt.figure(1, figsize=(16, 12))\n", "\n", "# Probe\n", "ax = fig.add_subplot(211)\n", "# cmap_range = np.linspace(0.0, 0.8, 11)\n", "cf = ax.contourf(\n", " mb_solve_00.tlist,\n", " mb_solve_00.zlist,\n", " np.abs(mb_solve_00.Omegas_zt[0] / (2 * np.pi)),\n", " # cmap_range,\n", " cmap=plt.cm.Blues,\n", ")\n", "ax.set_title(r\"Rabi Frequency ($\\Gamma / 2\\pi $)\")\n", "ax.set_ylabel(\"Distance ($L$)\")\n", "ax.text(\n", " 0.02,\n", " 0.95,\n", " \"Probe\",\n", " verticalalignment=\"top\",\n", " horizontalalignment=\"left\",\n", " transform=ax.transAxes,\n", " color=\"grey\",\n", " fontsize=16,\n", ")\n", "plt.colorbar(cf)\n", "\n", "# Coupling\n", "ax = fig.add_subplot(212)\n", "# cmap_range = np.linspace(0.0, 0.8, 11)\n", "cf = ax.contourf(\n", " mb_solve_00.tlist,\n", " mb_solve_00.zlist,\n", " np.abs(mb_solve_00.Omegas_zt[1] / (2 * np.pi)),\n", " # cmap_range,\n", " cmap=plt.cm.Greens,\n", ")\n", "ax.set_xlabel(r\"Time ($1/\\Gamma$)\")\n", "ax.set_ylabel(\"Distance ($L$)\")\n", "ax.text(\n", " 0.02,\n", " 0.95,\n", " \"Coupling\",\n", " verticalalignment=\"top\",\n", " horizontalalignment=\"left\",\n", " transform=ax.transAxes,\n", " color=\"grey\",\n", " fontsize=16,\n", ")\n", "plt.colorbar(cf)\n", "\n", "# Both\n", "for ax in fig.axes:\n", " for y in [0.0, 1.0]:\n", " ax.axhline(y, c=\"grey\", lw=1.0, ls=\"dotted\")\n", "plt.tight_layout();" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "total_area = np.sqrt(\n", " mb_solve_00.fields_area()[0] ** 2 + mb_solve_00.fields_area()[1] ** 2\n", ")\n", "\n", "fig, ax = plt.subplots(figsize=(16, 4))\n", "ax.plot(\n", " mb_solve_00.zlist,\n", " mb_solve_00.fields_area()[0] / np.pi,\n", " label=\"Probe\",\n", " clip_on=False,\n", ")\n", "ax.plot(\n", " mb_solve_00.zlist,\n", " mb_solve_00.fields_area()[1] / np.pi,\n", " label=\"Coupling\",\n", " clip_on=False,\n", ")\n", "ax.plot(\n", " mb_solve_00.zlist, total_area / np.pi, label=\"Total\", ls=\"dashed\", clip_on=False\n", ")\n", "ax.legend()\n", "ax.set_ylim([0.0, 4.0])\n", "ax.set_xlabel(\"Distance ($L$)\")\n", "ax.set_ylabel(r\"Pulse Area ($\\pi$)\");" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fields_area_abs = np.trapezoid(np.abs(mb_solve_00.Omegas_zt), mb_solve_00.tlist, axis=2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Animation" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "C = 0.1 # speed of light\n", "Y_MIN = 0.0 # Y-axis min\n", "Y_MAX = 3.0 # y-axis max\n", "ZOOM = 2 # level of linear interpolation\n", "FPS = 60 # frames per second\n", "ATOMS_ALPHA = 0.2 # Atom indicator transparency" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "FNAME = \"mbs-vee-sech-sqrt8pi-sqrt8pi-collision\"\n", "FNAME_JSON = FNAME + \".json\"\n", "with open(FNAME_JSON, \"w\") as f:\n", " f.write(mb_solve_json)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }