AlkaMEE 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- AlkaMEE/__init__.py +93 -0
- AlkaMEE/atomic/__init__.py +20 -0
- AlkaMEE/atomic/alkali/__init__.py +6 -0
- AlkaMEE/atomic/alkali/alkali_system.py +392 -0
- AlkaMEE/atomic/alkali/decay_builder.py +232 -0
- AlkaMEE/atomic/alkali/kernels.py +1177 -0
- AlkaMEE/atomic/alkali/operators.py +469 -0
- AlkaMEE/atomic/channels.py +631 -0
- AlkaMEE/atomic/state.py +802 -0
- AlkaMEE/atomic/system.py +1076 -0
- AlkaMEE/classical_fields.py +731 -0
- AlkaMEE/constants.py +48 -0
- AlkaMEE/diagram.py +1765 -0
- AlkaMEE/enums.py +263 -0
- AlkaMEE/hamiltonian.py +252 -0
- AlkaMEE/import_pkgs.py +35 -0
- AlkaMEE/interactions.py +794 -0
- AlkaMEE/model.py +1108 -0
- AlkaMEE/parameters.py +243 -0
- AlkaMEE/solvers/__init__.py +26 -0
- AlkaMEE/solvers/base.py +215 -0
- AlkaMEE/solvers/floquet_solvers.py +245 -0
- AlkaMEE/solvers/nullspace.py +310 -0
- AlkaMEE/solvers/single_frequency.py +341 -0
- AlkaMEE/solvers/utilities.py +210 -0
- AlkaMEE/sweep/__init__.py +26 -0
- AlkaMEE/sweep/doppler.py +94 -0
- AlkaMEE/sweep/engine.py +628 -0
- AlkaMEE/sweep/observable.py +484 -0
- AlkaMEE/sweep/result.py +246 -0
- AlkaMEE/sweep/runner.py +144 -0
- AlkaMEE/utils.py +179 -0
- alkamee-0.1.0.dist-info/METADATA +13 -0
- alkamee-0.1.0.dist-info/RECORD +35 -0
- alkamee-0.1.0.dist-info/WHEEL +4 -0
AlkaMEE/__init__.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
2
|
+
__author__ = "-----------------------------"
|
|
3
|
+
__license__ = "---------------------------"
|
|
4
|
+
|
|
5
|
+
import warnings
|
|
6
|
+
|
|
7
|
+
# ============================================================================
|
|
8
|
+
# Layer A: Physics Construction
|
|
9
|
+
# ============================================================================
|
|
10
|
+
|
|
11
|
+
# Import and re-export from constants
|
|
12
|
+
from AlkaMEE.constants import *
|
|
13
|
+
|
|
14
|
+
# Import and re-export from enums
|
|
15
|
+
from AlkaMEE.enums import *
|
|
16
|
+
|
|
17
|
+
# Import and re-export from atomic systems
|
|
18
|
+
from AlkaMEE.atomic import *
|
|
19
|
+
from AlkaMEE.atomic.alkali import *
|
|
20
|
+
|
|
21
|
+
# Import and re-export from fields
|
|
22
|
+
from AlkaMEE.classical_fields import *
|
|
23
|
+
|
|
24
|
+
# Import and re-export from interactions
|
|
25
|
+
from AlkaMEE.interactions import *
|
|
26
|
+
|
|
27
|
+
# Import and re-export from parameters and model
|
|
28
|
+
from AlkaMEE.parameters import *
|
|
29
|
+
from AlkaMEE.model import *
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
from AlkaMEE.diagram import DiagramModel, wavy_line
|
|
33
|
+
# ============================================================================
|
|
34
|
+
# Layer B: Single-Point Solver (Advanced Users)
|
|
35
|
+
# ============================================================================
|
|
36
|
+
|
|
37
|
+
from AlkaMEE.solvers import *
|
|
38
|
+
|
|
39
|
+
# ============================================================================
|
|
40
|
+
# Layer C: Execution Engine
|
|
41
|
+
# ============================================================================
|
|
42
|
+
|
|
43
|
+
# Import and re-export observables
|
|
44
|
+
from AlkaMEE.sweep.observable import *
|
|
45
|
+
|
|
46
|
+
# Import and re-export main user interface
|
|
47
|
+
from AlkaMEE.sweep.runner import *
|
|
48
|
+
|
|
49
|
+
# Import and re-export results
|
|
50
|
+
from AlkaMEE.sweep.result import *
|
|
51
|
+
|
|
52
|
+
# Import advanced engine access
|
|
53
|
+
from AlkaMEE.sweep.engine import *
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# ============================================================================
|
|
58
|
+
# Dependency Checking
|
|
59
|
+
# ============================================================================
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
import scipy
|
|
63
|
+
except ImportError:
|
|
64
|
+
warnings.warn(
|
|
65
|
+
"scipy is not installed. "
|
|
66
|
+
"AlkaMEE solvers require scipy.sparse and scipy.linalg. "
|
|
67
|
+
"Install it with: pip install scipy",
|
|
68
|
+
ImportWarning
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
try:
|
|
72
|
+
import joblib
|
|
73
|
+
except ImportError:
|
|
74
|
+
warnings.warn(
|
|
75
|
+
"joblib is not installed. "
|
|
76
|
+
"Parallel solving will not be available. "
|
|
77
|
+
"Install it with: pip install joblib",
|
|
78
|
+
ImportWarning
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
import arc
|
|
83
|
+
except ImportError:
|
|
84
|
+
warnings.warn(
|
|
85
|
+
"arc (atomic-rf-calculations) is not installed. "
|
|
86
|
+
"AlkaliAtomSystem requires arc. "
|
|
87
|
+
"Install it with: pip install arc-light",
|
|
88
|
+
ImportWarning
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# ============================================================================
|
|
92
|
+
# Optional: Print package info on first import
|
|
93
|
+
# ============================================================================
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from .state import AtomicState
|
|
2
|
+
from .channels import (
|
|
3
|
+
EnergySpec,
|
|
4
|
+
DecayChannel,
|
|
5
|
+
DephasingChannel,
|
|
6
|
+
CoherentChannel,
|
|
7
|
+
EnergyShift,
|
|
8
|
+
)
|
|
9
|
+
from .system import AtomicSystem
|
|
10
|
+
from .alkali import AlkaliAtomSystem
|
|
11
|
+
|
|
12
|
+
# __all__ = [
|
|
13
|
+
# 'AtomicState',
|
|
14
|
+
# 'EnergySpec',
|
|
15
|
+
# 'DecayChannel',
|
|
16
|
+
# 'DephasingChannel',
|
|
17
|
+
# 'CoherentChannel',
|
|
18
|
+
# 'AtomicSystem',
|
|
19
|
+
# 'AlkaliAtomSystem',
|
|
20
|
+
# ]
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"""
|
|
2
|
+
atomic/alkali/alkali_system.py
|
|
3
|
+
==============================
|
|
4
|
+
Defines :class:`AlkaliAtomSystem`, an :class:`~atomic.system.AtomicSystem`
|
|
5
|
+
subclass for alkali atoms supported by the ARC library.
|
|
6
|
+
|
|
7
|
+
On construction it automatically:
|
|
8
|
+
|
|
9
|
+
1. Loads the ARC atom object for the requested species and isotope.
|
|
10
|
+
2. Validates user-provided states against the ARC atom identity.
|
|
11
|
+
3. Builds fine-structure and hyperfine energies relative to a reference state.
|
|
12
|
+
4. Optionally computes and attaches spontaneous E1 decay channels from ARC.
|
|
13
|
+
5. Constructs electric and magnetic dipole operator matrices.
|
|
14
|
+
|
|
15
|
+
The ARC object (``self.arc_atom``) is retained on the instance for
|
|
16
|
+
post-construction queries but must not be passed into
|
|
17
|
+
:class:`~model.Model` or any solver. All downstream physics uses only the
|
|
18
|
+
numpy-array-backed operator objects.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from ...import_pkgs import *
|
|
22
|
+
from ...enums import BasisType
|
|
23
|
+
from ..state import AtomicState
|
|
24
|
+
from ..system import AtomicSystem, AtomicSystemMode, EnergySpec
|
|
25
|
+
from ..channels import DecayChannel, DephasingChannel
|
|
26
|
+
from .operators import ElectricDipoleOperator, MagneticDipoleOperator
|
|
27
|
+
from .decay_builder import SpontaneousDecayBuilder
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AlkaliAtomSystem(AtomicSystem):
|
|
33
|
+
"""
|
|
34
|
+
Atom-specific :class:`~atomic.system.AtomicSystem` for ARC-supported
|
|
35
|
+
alkali atoms.
|
|
36
|
+
|
|
37
|
+
Wraps the ARC library to automatically populate energies, spontaneous
|
|
38
|
+
decay channels, and dipole operators from tabulated atomic data.
|
|
39
|
+
The mode is always ``ATOM_SPECIFIC``; selection rules are not re-checked
|
|
40
|
+
internally (they are guaranteed by ARC).
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
atom : str
|
|
45
|
+
Atomic symbol: ``'Rb'``, ``'Cs'``, ``'K'``, ``'Na'``, or ``'Li'``.
|
|
46
|
+
isotope : int or None
|
|
47
|
+
Mass number (e.g. ``87`` for ⁸⁷Rb). Pass ``None`` for atoms where
|
|
48
|
+
ARC has a single hard-coded isotope (``'Cs'``, ``'Na'``).
|
|
49
|
+
states : list of AtomicState
|
|
50
|
+
All basis states to include. Must share the same
|
|
51
|
+
:class:`~enums.BasisType`. No internal expansion is performed.
|
|
52
|
+
basis_type : BasisType or str
|
|
53
|
+
Common basis type. Must be Zeeman-resolved (``FINE_ZEEMAN`` or
|
|
54
|
+
``HYPERFINE_ZEEMAN``) to enable dipole operators.
|
|
55
|
+
reference_state : AtomicState, optional
|
|
56
|
+
State assigned zero energy. Defaults to the first state in
|
|
57
|
+
canonical basis order.
|
|
58
|
+
enable_spontaneous_decay : bool, optional
|
|
59
|
+
If ``True`` (default), spontaneous E1 decay channels are computed
|
|
60
|
+
from ARC and attached automatically.
|
|
61
|
+
extra_decays : list of DecayChannel, optional
|
|
62
|
+
Additional user-defined decay channels (e.g. non-radiative or
|
|
63
|
+
manually specified radiative channels).
|
|
64
|
+
dephasings : list of DephasingChannel, optional
|
|
65
|
+
Pure-dephasing channels.
|
|
66
|
+
backend : str, optional
|
|
67
|
+
Numerical backend identifier. Default ``'numpy'``.
|
|
68
|
+
|
|
69
|
+
Attributes
|
|
70
|
+
----------
|
|
71
|
+
arc_atom : ARC atom instance
|
|
72
|
+
Live ARC object for post-construction queries (transition
|
|
73
|
+
frequencies, Landé g-factors, etc.).
|
|
74
|
+
Must not be passed into :class:`~model.Model` or solvers.
|
|
75
|
+
I : float
|
|
76
|
+
Nuclear spin quantum number, extracted from ``arc_atom``.
|
|
77
|
+
atomic_mass : float
|
|
78
|
+
Atomic mass (kg), extracted from ``arc_atom``.
|
|
79
|
+
electric_dipole : ElectricDipoleOperator
|
|
80
|
+
Electric dipole operator in the system basis (numpy arrays only).
|
|
81
|
+
Access via ``.d_x``, ``.d_y``, ``.d_z``, ``.d_spherical(q)``, etc.
|
|
82
|
+
magnetic_dipole : MagneticDipoleOperator
|
|
83
|
+
Magnetic dipole operator in the system basis (numpy arrays only).
|
|
84
|
+
Access via ``.m_x``, ``.m_y``, ``.m_z``, ``.μ_spherical(q)``, etc.
|
|
85
|
+
|
|
86
|
+
Notes
|
|
87
|
+
-----
|
|
88
|
+
Zeeman shifts are **not** included in the bare Hamiltonian. They enter
|
|
89
|
+
at the interaction layer via a :class:`~classical_fields.StaticField`
|
|
90
|
+
paired with :class:`~interactions.MagneticDipoleInteraction`.
|
|
91
|
+
|
|
92
|
+
All energies and rates are in angular frequency units (rad/s).
|
|
93
|
+
|
|
94
|
+
See :meth:`supported_atoms` for the full list of available species.
|
|
95
|
+
|
|
96
|
+
Examples
|
|
97
|
+
--------
|
|
98
|
+
>>> system = AlkaliAtomSystem(
|
|
99
|
+
... atom='Rb', isotope=87,
|
|
100
|
+
... states=[g1, g2, g3, e1, e2],
|
|
101
|
+
... basis_type='hyperfine_zeeman',
|
|
102
|
+
... reference_state=g2,
|
|
103
|
+
... )
|
|
104
|
+
>>> system.electric_dipole.d_x # Cartesian x matrix
|
|
105
|
+
>>> system.magnetic_dipole.m_z # Cartesian z matrix
|
|
106
|
+
>>> system.electric_dipole.d_spherical(-1) # σ⁻ component
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
# ------------------------------------------------------------------
|
|
110
|
+
# Supported ARC atoms
|
|
111
|
+
# Maps (symbol, isotope) → ARC class
|
|
112
|
+
# isotope = None for atoms with a single hard-coded ARC isotope
|
|
113
|
+
# ------------------------------------------------------------------
|
|
114
|
+
_ARC_ATOMS = {
|
|
115
|
+
# Alkalis with explicit isotope classes
|
|
116
|
+
("Rb", 85): arc.Rubidium85,
|
|
117
|
+
("Rb", 87): arc.Rubidium87,
|
|
118
|
+
("K", 39): arc.Potassium39,
|
|
119
|
+
("K", 40): arc.Potassium40,
|
|
120
|
+
("K", 41): arc.Potassium41,
|
|
121
|
+
("Li", 6): arc.Lithium6,
|
|
122
|
+
("Li", 7): arc.Lithium7,
|
|
123
|
+
# Alkalis with implicit (hard-coded) isotope in ARC
|
|
124
|
+
("Cs", None): arc.Cesium,
|
|
125
|
+
("Na", None): arc.Sodium,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# ==================================================================
|
|
129
|
+
# Constructor
|
|
130
|
+
# ==================================================================
|
|
131
|
+
|
|
132
|
+
def __init__(
|
|
133
|
+
self,
|
|
134
|
+
atom: str,
|
|
135
|
+
isotope: Optional[int],
|
|
136
|
+
states: List[AtomicState],
|
|
137
|
+
basis_type: BasisType,
|
|
138
|
+
reference_state: Optional[AtomicState] = None,
|
|
139
|
+
*,
|
|
140
|
+
enable_spontaneous_decay: bool = True,
|
|
141
|
+
extra_decays: Optional[List[DecayChannel]] = None,
|
|
142
|
+
dephasings: Optional[List[DephasingChannel]] = None,
|
|
143
|
+
backend: str = "numpy",
|
|
144
|
+
):
|
|
145
|
+
# ------------------------------------------------------------------
|
|
146
|
+
# Stage 1 — Identity - Store atom symbol and isotope for reference; not used in physics.
|
|
147
|
+
# ------------------------------------------------------------------
|
|
148
|
+
self.atom_symbol = atom
|
|
149
|
+
self.isotope = isotope
|
|
150
|
+
self.backend = backend
|
|
151
|
+
|
|
152
|
+
# ------------------------------------------------------------------
|
|
153
|
+
# Stage 2 — Load ARC atom
|
|
154
|
+
# self.arc_atom is the live ARC database object andremains on this instance.
|
|
155
|
+
# ------------------------------------------------------------------
|
|
156
|
+
self.arc_atom = self._load_arc_atom(atom, isotope)
|
|
157
|
+
self.I = self.arc_atom.I # nuclear spin scalar
|
|
158
|
+
self.atomic_mass = self.arc_atom.mass # atomic mass in kg
|
|
159
|
+
|
|
160
|
+
# ------------------------------------------------------------------
|
|
161
|
+
# Stage 3 — Validate user states against ARC atom identity
|
|
162
|
+
# Checks nuclear spin consistency and alkali-valid l values.
|
|
163
|
+
# ------------------------------------------------------------------
|
|
164
|
+
self._validate_states_against_atom(states)
|
|
165
|
+
|
|
166
|
+
# ------------------------------------------------------------------
|
|
167
|
+
# Stage 4 — Initialise base AtomicSystem
|
|
168
|
+
# (builds canonical basis, indexes states, freezes AtomicState objects)
|
|
169
|
+
# ------------------------------------------------------------------
|
|
170
|
+
super().__init__(
|
|
171
|
+
states = states,
|
|
172
|
+
basis_type = basis_type,
|
|
173
|
+
mode = AtomicSystemMode.ATOM_SPECIFIC,
|
|
174
|
+
atom = f"{atom}-{isotope}",
|
|
175
|
+
backend = backend,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# ------------------------------------------------------------------
|
|
179
|
+
# Stage 5 — Reference state(zero of energy)- Defaults to the first state in canonical basis ordering.
|
|
180
|
+
# ------------------------------------------------------------------
|
|
181
|
+
self.reference_state = reference_state or self.basis_states[0]
|
|
182
|
+
if reference_state is not None and reference_state not in self.basis_states:
|
|
183
|
+
raise ValueError(
|
|
184
|
+
f"reference_state {reference_state} is not in the system basis."
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# ------------------------------------------------------------------
|
|
188
|
+
# Stage 6 — Build and attach energies from ARC
|
|
189
|
+
# ------------------------------------------------------------------
|
|
190
|
+
self.add_energies(self._build_energy_specs())
|
|
191
|
+
|
|
192
|
+
# ------------------------------------------------------------------
|
|
193
|
+
# Stage 7 — Build and attach spontaneous decay channels (optional)
|
|
194
|
+
# ------------------------------------------------------------------
|
|
195
|
+
if enable_spontaneous_decay:
|
|
196
|
+
spontaneous_decays = SpontaneousDecayBuilder(
|
|
197
|
+
arc_atom = self.arc_atom,
|
|
198
|
+
states = self.basis_states,
|
|
199
|
+
basis_type = self.basis_type,
|
|
200
|
+
).decay_channels
|
|
201
|
+
self.add_decays(decays=spontaneous_decays, policy=self._selection_policy) # relaxed policy for ARC-derived decays
|
|
202
|
+
|
|
203
|
+
# ------------------------------------------------------------------
|
|
204
|
+
# Stage 8 — Attach user-defined extra decays and dephasings
|
|
205
|
+
# ------------------------------------------------------------------
|
|
206
|
+
if extra_decays:
|
|
207
|
+
self.add_decays(decays=extra_decays, policy="strict") # strict policy for user-defined decays
|
|
208
|
+
|
|
209
|
+
if dephasings:
|
|
210
|
+
self.add_dephasings(dephasings)
|
|
211
|
+
|
|
212
|
+
# ------------------------------------------------------------------
|
|
213
|
+
# Stage 9 — Build dipole operators(numpy arrays; arc_atom not retained inside)
|
|
214
|
+
# ------------------------------------------------------------------
|
|
215
|
+
if self.basis_type not in (BasisType.FINE_ZEEMAN, BasisType.HYPERFINE_ZEEMAN):
|
|
216
|
+
raise ValueError(
|
|
217
|
+
f"basis_type {self.basis_type} is not Zeeman-resolved; "
|
|
218
|
+
"cannot construct dipole operators."
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
# if self.basis_type in (BasisType.FINE_ZEEMAN, BasisType.HYPERFINE_ZEEMAN):
|
|
222
|
+
self.electric_dipole = ElectricDipoleOperator(
|
|
223
|
+
self.arc_atom,
|
|
224
|
+
self.basis_states,
|
|
225
|
+
self.basis_type,
|
|
226
|
+
)
|
|
227
|
+
self.magnetic_dipole = MagneticDipoleOperator(
|
|
228
|
+
self.arc_atom,
|
|
229
|
+
self.basis_states,
|
|
230
|
+
self.basis_type,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
# ==================================================================
|
|
234
|
+
# ARC loading
|
|
235
|
+
# ==================================================================
|
|
236
|
+
|
|
237
|
+
def _load_arc_atom(self, atom: str, isotope: int | None):
|
|
238
|
+
"""
|
|
239
|
+
Instantiate the ARC class for *atom* and *isotope*.
|
|
240
|
+
|
|
241
|
+
Raises a descriptive ``ValueError`` listing valid options if the
|
|
242
|
+
combination is not in :attr:`_ARC_ATOMS`.
|
|
243
|
+
"""
|
|
244
|
+
key = (atom, isotope)
|
|
245
|
+
|
|
246
|
+
# Exact match — preferred path
|
|
247
|
+
if key in self._ARC_ATOMS:
|
|
248
|
+
return self._ARC_ATOMS[key]()
|
|
249
|
+
|
|
250
|
+
# Atom symbol recognised but isotope not supported
|
|
251
|
+
available = [k for k in self._ARC_ATOMS if k[0] == atom]
|
|
252
|
+
if available:
|
|
253
|
+
allowed = ", ".join(
|
|
254
|
+
f"{a}-{i}" if i is not None else f"{a} (implicit isotope)"
|
|
255
|
+
for a, i in available
|
|
256
|
+
)
|
|
257
|
+
raise ValueError(
|
|
258
|
+
f"Unsupported isotope for atom '{atom}': {isotope}. "
|
|
259
|
+
f"Available: {allowed}."
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
# Atom symbol not recognised at all
|
|
263
|
+
raise ValueError(
|
|
264
|
+
f"Unsupported atom '{atom}'. "
|
|
265
|
+
f"Supported: {sorted(set(a for a, _ in self._ARC_ATOMS))}."
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
# ==================================================================
|
|
269
|
+
# State validation against ARC identity
|
|
270
|
+
# ==================================================================
|
|
271
|
+
|
|
272
|
+
def _validate_states_against_atom(self, states: List[AtomicState]):
|
|
273
|
+
"""
|
|
274
|
+
Check that *states* are consistent with this ARC atom.
|
|
275
|
+
|
|
276
|
+
Verifies that the nuclear spin *I* on each state (if set) matches
|
|
277
|
+
``arc_atom.I``, and that orbital quantum number *l* is in
|
|
278
|
+
``{0, 1, 2, 3}`` (alkali constraint). Structural checks
|
|
279
|
+
(duplicates, basis uniformity) are delegated to
|
|
280
|
+
:meth:`~atomic.system.AtomicSystem._validate_states`.
|
|
281
|
+
"""
|
|
282
|
+
I_arc = self.arc_atom.I
|
|
283
|
+
|
|
284
|
+
for s in states:
|
|
285
|
+
if s.I is not None and abs(s.I - I_arc) > 1e-6:
|
|
286
|
+
raise ValueError(
|
|
287
|
+
f"State {s} has I={s.I}, "
|
|
288
|
+
f"but ARC atom {self.atom_symbol}-{self.isotope} has I={I_arc}."
|
|
289
|
+
)
|
|
290
|
+
if s.l not in (0, 1, 2, 3):
|
|
291
|
+
raise ValueError(
|
|
292
|
+
f"State {s} has l={s.l}, which is not valid for an alkali atom."
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
# ==================================================================
|
|
296
|
+
# Energy construction
|
|
297
|
+
# ==================================================================
|
|
298
|
+
|
|
299
|
+
def _build_energy_specs(self) -> List[EnergySpec]:
|
|
300
|
+
"""
|
|
301
|
+
Build :class:`~channels.EnergySpec` objects for all basis states.
|
|
302
|
+
|
|
303
|
+
Energies are in rad/s, relative to ``self.reference_state``
|
|
304
|
+
(which is assigned zero).
|
|
305
|
+
|
|
306
|
+
Returns
|
|
307
|
+
-------
|
|
308
|
+
list[EnergySpec]
|
|
309
|
+
"""
|
|
310
|
+
arc_atom = self.arc_atom
|
|
311
|
+
ref = self.reference_state
|
|
312
|
+
|
|
313
|
+
# ------------------------------------------------------------------
|
|
314
|
+
# Reference hyperfine shift
|
|
315
|
+
# ARC transition frequencies are relative to the centre-of-gravity
|
|
316
|
+
# of the hyperfine manifold. To pin E(reference_state) = 0, subtract
|
|
317
|
+
# the reference state's own hyperfine shift.
|
|
318
|
+
# Only relevant for hyperfine-resolved bases.
|
|
319
|
+
# ------------------------------------------------------------------
|
|
320
|
+
ref_hfs_shift = 0.0
|
|
321
|
+
|
|
322
|
+
if self.basis_type in (BasisType.HYPERFINE, BasisType.HYPERFINE_ZEEMAN):
|
|
323
|
+
A_r, B_r = arc_atom.getHFSCoefficients(ref.n, ref.l, ref.J)
|
|
324
|
+
ref_hfs_shift = arc_atom.getHFSEnergyShift(ref.J, ref.F, A_r, B_r)
|
|
325
|
+
|
|
326
|
+
# ------------------------------------------------------------------
|
|
327
|
+
# Build one EnergySpec per basis state
|
|
328
|
+
# ------------------------------------------------------------------
|
|
329
|
+
energy_specs = []
|
|
330
|
+
|
|
331
|
+
for s in self.basis_states:
|
|
332
|
+
|
|
333
|
+
# Fine-structure contribution
|
|
334
|
+
# ARC returns ν = (E_s - E_ref) / h in Hz, with correct sign.
|
|
335
|
+
ν_fs = arc_atom.getTransitionFrequency(
|
|
336
|
+
ref.n, ref.l, ref.J,
|
|
337
|
+
s.n, s.l, s.J,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
# Hyperfine correction relative to reference
|
|
341
|
+
ν_hfs = 0.0
|
|
342
|
+
if self.basis_type in (BasisType.HYPERFINE, BasisType.HYPERFINE_ZEEMAN):
|
|
343
|
+
A_s, B_s = arc_atom.getHFSCoefficients(s.n, s.l, s.J) # Hyperfine constants A, B for target state
|
|
344
|
+
s_hfs_shift = arc_atom.getHFSEnergyShift(s.J, s.F, A_s, B_s) # Hyperfine energy shift of target state
|
|
345
|
+
ν_hfs = s_hfs_shift - ref_hfs_shift # Relative hyperfine correction
|
|
346
|
+
|
|
347
|
+
energy_specs.append(
|
|
348
|
+
EnergySpec(
|
|
349
|
+
states = s,
|
|
350
|
+
energy = 2 * pi * (ν_fs + ν_hfs), # Hz → rad/s
|
|
351
|
+
)
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
return energy_specs
|
|
355
|
+
|
|
356
|
+
# ==================================================================
|
|
357
|
+
# Class-level utility
|
|
358
|
+
# ==================================================================
|
|
359
|
+
|
|
360
|
+
@classmethod
|
|
361
|
+
def supported_atoms(cls) -> dict:
|
|
362
|
+
"""
|
|
363
|
+
Return a dict of all ARC-supported atoms and their available isotopes.
|
|
364
|
+
|
|
365
|
+
Returns
|
|
366
|
+
-------
|
|
367
|
+
dict[str, list[int | None]]
|
|
368
|
+
{ atom_symbol : [isotope, ...] }
|
|
369
|
+
Isotopes are integers; None indicates a hard-coded ARC isotope.
|
|
370
|
+
|
|
371
|
+
Example
|
|
372
|
+
-------
|
|
373
|
+
>>> AlkaliAtomSystem.supported_atoms()
|
|
374
|
+
{'K': [39, 40, 41], 'Li': [6, 7], 'Rb': [85, 87], 'Cs': [None], 'Na': [None]}
|
|
375
|
+
"""
|
|
376
|
+
out = {}
|
|
377
|
+
for atom, isotope in cls._ARC_ATOMS:
|
|
378
|
+
out.setdefault(atom, []).append(isotope)
|
|
379
|
+
|
|
380
|
+
# Sort: integers first, None last
|
|
381
|
+
for atom in out:
|
|
382
|
+
out[atom].sort(key=lambda x: (x is None, x))
|
|
383
|
+
|
|
384
|
+
return out
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
# ==================================================================
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
__all__ = ['AlkaliAtomSystem']
|
|
392
|
+
|