Metadata-Version: 2.4
Name: levisim
Version: 0.1.0
Summary: Quantum linear theory and stochastic simulation of optically levitated nanoparticles: multi-particle coherent-scattering cavity spectra, free-space tweezer dynamics and Gaussian-state entanglement
Author-email: Julian Iacoponi <julian.iacoponi@gmail.com>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/julianiacoponi/levisim
Project-URL: Documentation, https://julianiacoponi.github.io/levisim/
Project-URL: Source, https://github.com/julianiacoponi/levisim
Project-URL: Issues, https://github.com/julianiacoponi/levisim/issues
Project-URL: Changelog, https://github.com/julianiacoponi/levisim/blob/main/CHANGELOG.md
Keywords: levitated optomechanics,optical tweezers,coherent scattering,cavity optomechanics,quantum linear theory,quantum Langevin equations,power spectral density,nanoparticles,entanglement,physics simulation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0
Requires-Dist: scipy>=1.13
Requires-Dist: matplotlib>=3.8
Requires-Dist: sympy>=1.12
Requires-Dist: loguru>=0.7
Requires-Dist: tqdm>=4.60
Provides-Extra: elk
Requires-Dist: elasticsearch>=8; extra == "elk"
Provides-Extra: notify
Requires-Dist: plyer; extra == "notify"
Provides-Extra: video
Requires-Dist: opencv-python; extra == "video"
Provides-Extra: notebooks
Requires-Dist: jupyterlab; extra == "notebooks"
Requires-Dist: ipykernel; extra == "notebooks"
Requires-Dist: nbclient; extra == "notebooks"
Requires-Dist: networkx; extra == "notebooks"
Provides-Extra: docs
Requires-Dist: sphinx>=7.2; extra == "docs"
Requires-Dist: myst-parser>=3.0; extra == "docs"
Requires-Dist: myst-nb>=1.0; extra == "docs"
Requires-Dist: furo; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Requires-Dist: sphinxcontrib-mermaid; extra == "docs"
Requires-Dist: plotly>=5.0; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: nbstripout; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# levisim

`levisim` simulates optically levitated nanoparticles.

- **Several particles, one cavity.** `MultiTrap` solves the linearised quantum Langevin equations
  of N levitated particles, each moving in up to three dimensions, coupled by coherent scattering
  to one shared cavity mode. It returns the homodyne and heterodyne spectra of the cavity output
  and the power and cross spectral densities of every motion. Seven independent calculation
  routes are provided (linear-amplifier models, numerical and power-series hybridisation, and an
  exact closed form that inverts no N×N matrix), which agree with each other to within 5e-13
  (relative) on every system in the test suite and notebooks.
- **One particle, free space.** `Simulation` integrates the stochastic (Langevin) dynamics of a bead
  in a Gaussian-beam tweezer with gas damping, feedback cold damping, a directed force, kicks and
  an optional detection floor, photon recoil and gravity; `SpectralDensityEstimate` and
  `SpectralDensityTheory` analyse the traces.
- **Entanglement.** Covariance-matrix dynamics, an exact multi-tone (Floquet) drive and Gaussian-state
  measures (log-negativity, discord, Duan and Hillery–Zubairy witnesses) for two-tone schemes.

```sh
pip install levisim
```

```python
import numpy as np
from levisim.core.units import kHz, degrees
from levisim.multiphysics.enums import QuantumLinearTheoryMethod
from levisim.multiphysics.multitrap import MultiTrap
from levisim.multiphysics.utils.shelf import DEFAULT_cavity_kwargs, DEFAULT_gas_kwargs

mtrap = MultiTrap(
    num_traps=2,
    Cartesian_axes_per_trap=2,
    gas_kwargs=DEFAULT_gas_kwargs,
    cavity_kwargs=DEFAULT_cavity_kwargs,
    φn_dict={2: 30*degrees},                 # second tweezer's phase
    ω_range=np.arange(125, 165, 0.02) * kHz,  # angular units: kHz is 2π × 10³ rad/s
)
S_hh = mtrap.homodyne_spectrum(QuantumLinearTheoryMethod.LINEAR_AMPLIFIER_MODEL)
```

**Documentation:** <https://julianiacoponi.github.io/levisim/> — user guide, the calculation methods
(with a flowchart), conventions, logging, an API reference, and a gallery of demo notebooks and
reproductions of published experiments.

Optional extras: `levisim[elk]` (logs to Elasticsearch/Kibana via the `levisim-logs` command),
`levisim[notebooks]`, `levisim[docs]`, `levisim[dev]`, `levisim[video]`, `levisim[notify]`.

`levisim` is licensed under the GNU GPL v3 or later. Parts of it were written with an LLM at the
author's request; `DISCLAIMER.md` in the source distribution records which.
