Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ This package relies on quantum defects provided by the community. Consider citin
## Using custom quantum defects
To use custom quantum defects (or quantum defects for a new species), you can simply create a subclass of `rydstate.species.species_object.SpeciesObject` (e.g. `class CustomRubidium(SpeciesObject):`) with a custom species name (e.g. `name = "Custom_Rb"`).
Then, similarly to `rydstate.species.rubidium.py` you can define the quantum defects (and model potential parameters, ...) for your species.
Finally, you can use the custom species by simply calling `rydstate.RydbergStateAlkali("Custom_Rb", n=50, l=0, j=1/2, m=1/2)` (the code will look for all subclasses of `SpeciesObject` until it finds one with the species name "Custom_Rb").
Finally, you can use the custom species by simply calling `rydstate.RydbergStateSQDTAlkali("Custom_Rb", n=50, l=0, j=1/2, m=1/2)` (the code will look for all subclasses of `SpeciesObject` until it finds one with the species name "Custom_Rb").


## License
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Examples
RadialState
-----------

Some examples demonstrating the usage of the RadialState class, which uses the Numerov method for solving the radial Schrödinger equation.
Some examples demonstrating the usage of the RadialKet class, which uses the Numerov method for solving the radial Schrödinger equation.

.. nbgallery::
examples/radial/hydrogen_wavefunction
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/benchmark/benchmark_njit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"\n",
"import numpy as np\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali\n",
"from rydstate import RydbergStateSQDTAlkali\n",
"\n",
"test_cases: list[tuple[str, int, int, bool]] = [\n",
" # species, n, l, use_njit\n",
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -41,21 +41,21 @@
" \"\"\"\n",
" # run the integration once to compile the numba function\n",
" species, n, l, use_njit = test_cases[0]\n",
" state = RydbergStateAlkali(species, n, l, j=l + 0.5)\n",
" state = RydbergStateSQDTAlkali(species, n, l, j=l + 0.5)\n",
" state.radial.create_wavefunction(_use_njit=True)\n",
"\n",
" results = []\n",
" for species, n, l, use_njit in test_cases:\n",
" # Setup the test function\n",
" stmt = (\n",
" \"state = RydbergStateAlkali(species, n, l, j=l+0.5)\\n\"\n",
" \"state = RydbergStateSQDTAlkali(species, n, l, j=l+0.5)\\n\"\n",
" \"state.radial.create_grid(dz=1e-3)\\n\"\n",
" \"state.radial.create_wavefunction(_use_njit=use_njit)\"\n",
" )\n",
"\n",
" # Time the integration multiple times and take average/std\n",
" globals_dict = {\n",
" \"RydbergStateAlkali\": RydbergStateAlkali,\n",
" \"RydbergStateSQDTAlkali\": RydbergStateSQDTAlkali,\n",
" \"species\": species,\n",
" \"n\": n,\n",
" \"l\": l,\n",
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/comparisons/compare_dipole_matrix_element.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -18,8 +18,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali\n",
"from rydstate.units import ureg"
"from rydstate import RydbergStateSQDTAlkali, ureg"
]
},
{
Expand Down Expand Up @@ -92,8 +91,8 @@
"for qn1, qn2 in zip(qn1_list, qn2_list):\n",
" print(f\"n={qn1[0]}\", end=\"\\r\")\n",
" q = round(qn2[-1] - qn1[-1])\n",
" state_i = RydbergStateAlkali(\"Rb\", n=qn1[0], l=qn1[1], j=qn1[2], m=qn1[3])\n",
" state_f = RydbergStateAlkali(\"Rb\", n=qn2[0], l=qn2[1], j=qn2[2], m=qn2[3])\n",
" state_i = RydbergStateSQDTAlkali(\"Rb\", n=qn1[0], l=qn1[1], j=qn1[2], m=qn1[3])\n",
" state_f = RydbergStateSQDTAlkali(\"Rb\", n=qn2[0], l=qn2[1], j=qn2[2], m=qn2[3])\n",
" dipole_me = state_i.calc_matrix_element(state_f, \"electric_dipole\", q, unit=\"a.u.\")\n",
" matrixelements.append(dipole_me)\n",
"\n",
Expand Down
20 changes: 10 additions & 10 deletions docs/examples/comparisons/compare_model_potentials.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali, RydbergStateAlkalineLS"
"from rydstate import RydbergStateSQDTAlkali, RydbergStateSQDTAlkalineLS"
]
},
{
Expand All @@ -41,15 +41,15 @@
}
],
"source": [
"state = RydbergStateAlkali(\"Rb\", n=40, l=0, j=0.5)\n",
"state = RydbergStateSQDTAlkali(\"Rb\", n=40, l=0, j=0.5)\n",
"\n",
"states: dict[str, RydbergStateAlkali] = {}\n",
"states: dict[str, RydbergStateSQDTAlkali] = {}\n",
"\n",
"\n",
"states[\"model_potential_marinescu_1993\"] = RydbergStateAlkali(state.species, n=state.n, l=state.l, j=state.j)\n",
"states[\"model_potential_marinescu_1993\"] = RydbergStateSQDTAlkali(state.species, n=state.n, l=state.l, j=state.j)\n",
"states[\"model_potential_marinescu_1993\"].radial.create_model(potential_type=\"model_potential_marinescu_1993\")\n",
"\n",
"states[\"model_potential_fei_2009\"] = RydbergStateAlkali(state.species, n=state.n, l=state.l, j=state.j)\n",
"states[\"model_potential_fei_2009\"] = RydbergStateSQDTAlkali(state.species, n=state.n, l=state.l, j=state.j)\n",
"states[\"model_potential_fei_2009\"].radial.create_model(potential_type=\"model_potential_fei_2009\")\n",
"\n",
"for label, state in states.items():\n",
Expand Down Expand Up @@ -122,17 +122,17 @@
}
],
"source": [
"state = RydbergStateAlkalineLS(\"Sr88\", n=8, l=0, j_tot=0, s_tot=0)\n",
"state = RydbergStateSQDTAlkalineLS(\"Sr88\", n=8, l=0, j_tot=0, s_tot=0)\n",
"\n",
"states: dict[str, RydbergStateAlkalineLS] = {}\n",
"states: dict[str, RydbergStateSQDTAlkalineLS] = {}\n",
"\n",
"\n",
"states[\"model_potential_marinescu_1993\"] = RydbergStateAlkalineLS(\n",
"states[\"model_potential_marinescu_1993\"] = RydbergStateSQDTAlkalineLS(\n",
" state.species, n=state.n, l=state.l, j_tot=state.j_tot, s_tot=state.s_tot\n",
")\n",
"states[\"model_potential_marinescu_1993\"].radial.create_model(potential_type=\"model_potential_marinescu_1993\")\n",
"\n",
"states[\"model_potential_fei_2009\"] = RydbergStateAlkalineLS(\n",
"states[\"model_potential_fei_2009\"] = RydbergStateSQDTAlkalineLS(\n",
" state.species, n=state.n, l=state.l, j_tot=state.j_tot, s_tot=state.s_tot\n",
")\n",
"states[\"model_potential_fei_2009\"].radial.create_model(potential_type=\"model_potential_fei_2009\")\n",
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/comparisons/compare_radial_matrix_element.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -18,8 +18,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali\n",
"from rydstate.units import ureg"
"from rydstate import RydbergStateSQDTAlkali, ureg"
]
},
{
Expand Down Expand Up @@ -64,8 +63,8 @@
" results[key] = []\n",
" for qn1, qn2 in zip(qn1_list, qn2_list):\n",
" print(f\"n={qn1[0]}\", end=\"\\r\")\n",
" state_i = RydbergStateAlkali(species, qn1[0], qn1[1], j=qn1[2])\n",
" state_f = RydbergStateAlkali(species, qn2[0], qn2[1], j=qn2[2])\n",
" state_i = RydbergStateSQDTAlkali(species, qn1[0], qn1[1], j=qn1[2])\n",
" state_f = RydbergStateSQDTAlkali(species, qn2[0], qn2[1], j=qn2[2])\n",
" radial_me = state_i.radial.calc_matrix_element(state_f.radial, 1, unit=\"a.u.\")\n",
" results[key].append(radial_me)\n",
"\n",
Expand Down
10 changes: 5 additions & 5 deletions docs/examples/comparisons/compare_wavefunctions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali"
"from rydstate import RydbergStateSQDTAlkali"
]
},
{
Expand Down Expand Up @@ -44,7 +44,7 @@
"source": [
"results[\"rydstate\"] = []\n",
"for qn in qns:\n",
" state = RydbergStateAlkali(\"Rb\", n=qn[0], l=qn[1], j=qn[2])\n",
" state = RydbergStateSQDTAlkali(\"Rb\", n=qn[0], l=qn[1], j=qn[2])\n",
" state.radial.create_grid()\n",
" state.radial.create_wavefunction()\n",
" results[\"rydstate\"].append(\n",
Expand Down Expand Up @@ -125,7 +125,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -142,8 +142,8 @@
"# the small difference of the wavefunctions explains the difference in the radial matrix element of circular states\n",
"# (see also the compare_radial_matrix_element and compare_dipole_matrix_element notebooks)\n",
"\n",
"from rydstate import ureg\n",
"from rydstate.radial.radial_matrix_element import calc_radial_matrix_element_from_w_z\n",
"from rydstate.units import ureg\n",
"\n",
"to_mum = ureg.Quantity(1, \"bohr_radius\").to(\"micrometer\").magnitude\n",
"\n",
Expand Down
22 changes: 11 additions & 11 deletions docs/examples/comparisons/compare_whittaker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rydstate import RydbergStateAlkali\n",
"from rydstate import RydbergStateSQDTAlkali\n",
"\n",
"logging.basicConfig(level=logging.INFO, format=\"%(levelname)s %(filename)s: %(message)s\")"
]
Expand All @@ -41,7 +41,7 @@
"metadata": {},
"outputs": [],
"source": [
"states: dict[str, RydbergStateAlkali] = {}"
"states: dict[str, RydbergStateSQDTAlkali] = {}"
]
},
{
Expand All @@ -62,15 +62,15 @@
}
],
"source": [
"state = RydbergStateAlkali(\"Rb\", n=21, l=0, j=0.5)\n",
"state = RydbergStateSQDTAlkali(\"Rb\", n=21, l=0, j=0.5)\n",
"\n",
"state.radial.create_model(potential_type=\"model_potential_marinescu_1993\")\n",
"state.radial.create_wavefunction(\"numerov\")\n",
"states[\"Numerov with Model Potentials\"] = state\n",
"\n",
"# Using Numerov without model potentials will lead to some warnings,\n",
"# since the resulting wavefunction does not pass all heuristic checks\n",
"state_without_mp = RydbergStateAlkali(state.species, state.n, state.l, state.j)\n",
"state_without_mp = RydbergStateSQDTAlkali(state.species, state.n, state.l, state.j)\n",
"state_without_mp.radial.create_model(potential_type=\"coulomb\")\n",
"state_without_mp.radial.create_wavefunction(\"numerov\")\n",
"states[\"Numerov without Model Potentials\"] = state_without_mp"
Expand All @@ -91,7 +91,7 @@
}
],
"source": [
"state_whittaker = RydbergStateAlkali(state.species, state.n, state.l, state.j)\n",
"state_whittaker = RydbergStateSQDTAlkali(state.species, state.n, state.l, state.j)\n",
"state_whittaker.radial.create_grid(x_min=state.radial.grid.x_min, x_max=state.radial.grid.x_max)\n",
"state_whittaker.radial.create_wavefunction(\"whittaker\")\n",
"states[\"Whittaker\"] = state_whittaker"
Expand Down Expand Up @@ -188,15 +188,15 @@
}
],
"source": [
"state1 = RydbergStateAlkali(\"Rb\", n=10, l=0, j=0.5)\n",
"state2 = RydbergStateAlkali(\"Rb\", n=9, l=1, j=1.5)\n",
"state1 = RydbergStateSQDTAlkali(\"Rb\", n=10, l=0, j=0.5)\n",
"state2 = RydbergStateSQDTAlkali(\"Rb\", n=9, l=1, j=1.5)\n",
"\n",
"dipole_me = state1.radial.calc_matrix_element(state2.radial, 1)\n",
"print(f\"Numerov with model potentials: {dipole_me}\", flush=True)\n",
"\n",
"_state1 = RydbergStateAlkali(state1.species, state1.n, state1.l, state1.j)\n",
"_state1 = RydbergStateSQDTAlkali(state1.species, state1.n, state1.l, state1.j)\n",
"_state1.radial.create_model(potential_type=\"coulomb\")\n",
"_state2 = RydbergStateAlkali(state2.species, state2.n, state2.l, state2.j)\n",
"_state2 = RydbergStateSQDTAlkali(state2.species, state2.n, state2.l, state2.j)\n",
"_state2.radial.create_model(potential_type=\"coulomb\")\n",
"\n",
"dipole_me = _state1.radial.calc_matrix_element(_state2.radial, 1)\n",
Expand All @@ -206,10 +206,10 @@
"# to avoid integrating over the diverging peak at the origin (see plots above)\n",
"xmin1, xmax1 = _state1.radial.grid.x_min, _state1.radial.grid.x_max\n",
"xmin2, xmax2 = _state2.radial.grid.x_min, _state2.radial.grid.x_max\n",
"_state1 = RydbergStateAlkali(state1.species, state1.n, state1.l, state1.j)\n",
"_state1 = RydbergStateSQDTAlkali(state1.species, state1.n, state1.l, state1.j)\n",
"_state1.radial.create_grid(x_min=xmin1, x_max=xmax1)\n",
"_state1.radial.create_wavefunction(\"whittaker\")\n",
"_state2 = RydbergStateAlkali(state2.species, state2.n, state2.l, state2.j)\n",
"_state2 = RydbergStateSQDTAlkali(state2.species, state2.n, state2.l, state2.j)\n",
"_state2.radial.create_grid(x_min=xmin2, x_max=xmax2)\n",
"_state2.radial.create_wavefunction(\"whittaker\")\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/comparisons/compare_z_min_cutoff.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali"
"from rydstate import RydbergStateSQDTAlkali"
]
},
{
Expand Down Expand Up @@ -57,7 +57,7 @@
"z_i_dict = {\"hydrogen\": [], \"classical\": [], \"rydstate cutoff\": []}\n",
"for qn in qn_list:\n",
" print(f\"n={qn[0]}\", end=\"\\r\")\n",
" state = RydbergStateAlkali(\"Rb\", n=qn[0], l=qn[1], j=qn[2])\n",
" state = RydbergStateSQDTAlkali(\"Rb\", n=qn[0], l=qn[1], j=qn[2])\n",
"\n",
" hydrogen_z_i = state.radial.model.calc_hydrogen_turning_point_z(state.n, state.l)\n",
" z_i_dict[\"hydrogen\"].append(hydrogen_z_i)\n",
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/dipole_matrix_elements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"from rydstate.rydberg_state import RydbergStateAlkali"
"from rydstate import RydbergStateSQDTAlkali"
]
},
{
Expand All @@ -34,8 +34,8 @@
}
],
"source": [
"state_i = RydbergStateAlkali(\"Rb\", 60, 2, j=3 / 2, m=1 / 2)\n",
"state_f = RydbergStateAlkali(\"Rb\", 60, 3, j=5 / 2, m=1 / 2)\n",
"state_i = RydbergStateSQDTAlkali(\"Rb\", 60, 2, j=3 / 2, m=1 / 2)\n",
"state_f = RydbergStateSQDTAlkali(\"Rb\", 60, 3, j=5 / 2, m=1 / 2)\n",
"\n",
"kappa = 1\n",
"radial = state_i.radial.calc_matrix_element(state_f.radial, k_radial=1)\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/radial/hydrogen_wavefunction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -18,7 +18,7 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from rydstate.radial import RadialState"
"from rydstate.radial import RadialKet"
]
},
{
Expand All @@ -27,7 +27,7 @@
"metadata": {},
"outputs": [],
"source": [
"state = RadialState(\"H_textbook\", nu=10, l_r=5)\n",
"state = RadialKet(\"H_textbook\", nu=10, l_r=5)\n",
"state.set_n_for_sanity_check(10)\n",
"state.create_model()\n",
"state.create_grid(dz=1e-2)\n",
Expand Down
Loading