Skip to content

Extend with dipole traps, level dynamics, GPU backend, diagnostics and recapture - #2

Open
alexlegoshin wants to merge 9 commits into
robertfasano:masterfrom
alexlegoshin:master
Open

Extend with dipole traps, level dynamics, GPU backend, diagnostics and recapture#2
alexlegoshin wants to merge 9 commits into
robertfasano:masterfrom
alexlegoshin:master

Conversation

@alexlegoshin

Copy link
Copy Markdown

Summary

This fork extends the original scattering-force MOT model with several additional components, built on top of it:

  • Optical dipole traps (Gaussian beam, 1D lattice, crossed beams) with the AC-Stark potential
  • Multi-level hyperfine rate-equation dynamics with a repumper
  • Ensemble diagnostics (temperature, distributions)
  • MOT-to-dipole recapture
  • A CPU/GPU (CuPy) backend, with the same code path for both
  • A high-level API and an expanded README documenting the physics

The branch is 9 commits ahead of master and merges cleanly (0 behind). Full details are in the README and release notes.

Note

This is a substantial change in scope, not a small patch, so I understand if reviewing or merging it isn't practical. I'm opening this PR mainly to make the extension available here and to credit the original work it builds on — not with any expectation attached. Thank you for the original library.

alexlegoshin and others added 9 commits July 23, 2026 09:41
- __init__.py: use PyYAML (import yaml) instead of removed ruamel_yaml
- setup.py: switch distutils->setuptools (distutils gone in 3.12),
  fix find_packages(), add full install_requires and package_data
- parameters.yml: populate default Rb-87 D2 atom block (file was fully
  commented, which made load_parameters() return None and crash
  maxwell_boltzmann at import); use PyYAML-safe float literals (6.0666e+6)
- plotting.py: colorbar title -> {'title':{'text':..,'side':..}} for plotly 6.x

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- dipole.py: DipoleTrap / OpticalLattice, AC-Stark potential (Grimm review
  form, red-detuned U<0), Gaussian beam + retro-reflected lattice, force and
  acceleration compatible with integration.solve, depth and trap frequencies
- levels.py: LevelDynamics, 3-level (F=2/e/F=1) rate equations + repumper;
  two-level limit reproduces the textbook saturated scattering rate
- diagnostics.py: cloud temperature (total/per-axis), rms size, distributions,
  matplotlib plots, temperature series over a trajectory
- recapture.py: classical MOT->dipole recapture (E<0 capture criterion +
  trajectory integration), thermal_cloud helper, trapped/retained fractions
- expose all of the above via __init__.py

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GPU acceleration:
- backend.py: array-agnostic CPU/GPU selection (NumPy or CuPy) with auto
  detection, runtime use_gpu()/use_cpu() override and MOTORNOT_BACKEND env var
- make numeric kernels dispatch on their input arrays via get_array_module:
  beams (Uniform/Gaussian), LinearQuadrupole field, MOT force/scattering rate,
  dipole potential/force, diagnostics, recapture energy criterion
- integration.integrate(): backend-aware fixed-step RK4 that keeps the whole
  ensemble on-device (scipy solve_ivp stays CPU-only). Also improves energy
  conservation vs the default-tolerance adaptive path
- CPU and GPU results verified identical to floating-point precision

High-level API (api.py):
- built-in atoms (Rb87/Rb85/Na23/K39/Cs133), six_beam_mot(), dipole_trap(),
  thermal_cloud(), set_backend() and an Experiment orchestrator
  (load_cloud -> cool -> recapture -> diagnostics)

Docs/packaging:
- rewrite README with quick start, GPU notes and physics caveats
- setup.py: optional [gpu] extra (cupy-cuda12x[ctk])

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a detailed "The physics" section: MOT scattering force (Doppler + Zeeman +
polarisation), magnetic field, AC-Stark dipole potential, level rate equations,
recapture energy criterion and the integrators.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mark tutorial notebooks as linguist-documentation so GitHub reports this
repo's language as Python instead of Jupyter Notebook (the notebooks are
mostly embedded output/plot images by byte count, which otherwise dominates
linguist's stats). Also removes a stray Python 3.7 __pycache__ file that
got committed before .gitignore covered it.
Marks the first release since the fork's rewrite: CPU/GPU (CuPy) backend,
dipole traps, multi-level rate-equation dynamics, ensemble diagnostics,
MOT-to-dipole recapture and a high-level API, on top of the original
scattering-force MOT model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant