Skip to main content

"The test of a first-rate intelligence is the ability to hold two opposed ideas in the mind at the same time, and still retain the ability to function." ~ F. Scott Fitzgerald

Polarism

Polarism is a Python package for 2-D driven-dissipative Gross-Pitaevskii simulations of exciton-polariton systems. It provides configurable pumps, reservoirs, solvers, and result output for CPU and optional CUDA runs.

PyPI version Python versions Tests Documentation License: MIT

Highlights

  • Finite-difference RK4, split-step FFT, ETD-RK2, and interaction-picture solver families.
  • NumPy execution and optional CuPy GPU execution, including CUDA graph chunks for eligible CUDA solver runs.
  • Single, double, and quadratic-double reservoirs; continuous and pulsed pumps.
  • HDF5, JSON, and NPY output, live visualization, and online animation.
  • Registries for custom solvers and model components, documented in the plugin guide; a tyro-generated polarism CLI.
  • polarism-bench for measuring per-step and chunked GPU execution on your hardware.

Installation

pip install polarism

For CUDA runs, install the extra matching your CUDA environment:

Extra CUDA environment
pip install "polarism[cuda12]" CUDA 12.x; use this for V100/Volta
pip install "polarism[cuda13]" CUDA 13.x

The installed CuPy build must be compatible with the NVIDIA driver and CUDA toolkit. See the installation guide and GPU guide.

For a development checkout:

pip install -e ".[dev]"

Quickstart

This example matches examples/basic_run.py:

import polarism as ps
from polarism.compute_engine import compute_engine

cfg = ps.Config()

cfg.grid.nx = 128
cfg.grid.ny = 128
cfg.grid.lx = 100.0
cfg.grid.ly = 100.0
cfg.grid.grid_type = "periodic"

cfg.reservoir.reservoir_type = "single"
cfg.potential.potential_type = "zero"

cfg.laser.mode = "single"
cfg.laser.laser_type = "continuous-gaussian"
cfg.laser.P0 = 0.02
cfg.laser.sigma_space = 12.0

cfg.solver.method = "rk4-fdm"
cfg.solver.dt = 1e-3
cfg.solver.total_time = 2.0

cfg.result.save_results = True
cfg.result.save_hdf5 = True
cfg.result.output_directory = "quickstart_results"

cfg.compute_engine.use_gpu = False
compute_engine.configure(cfg.compute_engine)

ps.SimulationController(cfg).run()

For GPU execution, set cfg.compute_engine.use_gpu = True, choose cfg.solver.method = "rk4-cuda", "split-step-fft-cuda", or "ifrk-fft-cuda", and consider cfg.solver.precision = "single" on consumer GPUs. FFT solvers require a periodic grid. Inspect CLI options with polarism --help.

Choosing a solver

Method Grid Device Use
rk4-fdm, rk4-fdm-fused periodic or closed-interval CPU or CuPy FDM reference or lower-overhead FDM
rk4-cuda periodic or closed-interval CUDA Fused FDM runs
split-step-fft, etd-rk2, ip-rk4 periodic CPU or CuPy Spectral integration
split-step-fft-cuda periodic CUDA Second-order spectral runs
ifrk-fft-cuda periodic CPU or CUDA Spectral RK4/DP5/DOP853/Verner 7/9 with stage-coupled reservoirs
ifrk4-fft-cuda periodic CPU or CUDA Historical alias for spectral RK4

Check timestep and grid convergence for your model. See the solver reference for compatibility details.

Documentation

For pulsed pumps, power_definition: pulse_energy makes power or P the integrated dose of one pulse over space and time. The legacy peak_amplitude mode remains available for reproducing older runs. See Potentials and Pumps.

Contributing

See the contributing guide. Run the default regression suite with .venv/bin/pytest -q from a development checkout.

Citation

Use CITATION.cff or GitHub's “Cite this repository” menu.

License

Polarism is licensed under the MIT License.

Acknowledgements

This project is developed with the Exciton-Polariton research group at the Faculty of Physics, University of Warsaw, with support from NCN OPUS grant work and ICM computing infrastructure.

Metadata

Release files for polarism 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polarism 0.3.6
File Size Uploaded
polarism-0.3.6.tar.gz 114.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polarism 0.3.6
File Interpreter ABI Platform
polarism-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 249.5 kB

Release files / polarism-0.3.6.tar.gz

Download URL polarism-0.3.6.tar.gz
Size 114.6 kB
Tags Source
SHA-256 checksum
How to use checksums
607f728b2ae1e0aa6ebd7039a5b4ce2b85d09f439b640f5a8a04e6b239cb9df2
BLAKE2b-256 checksum
How to use checksums
d2db97eca58a5b953d1e2b361ebbd906ee35e9c3850f59eeefc5abd43aa1fb66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / polarism-0.3.6-py3-none-any.whl

Download URL polarism-0.3.6-py3-none-any.whl
Size 134.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7c66c5f9e148c307d868b026ea11e43a7a9b2299cf7b1cb37b606dbfde6dbf1
BLAKE2b-256 checksum
How to use checksums
012a67ffb06c6f46b24cfbe01024e4d964cc2eea1eb29103a90bc0000ddb485a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.8

2 release files

0.3.7

2 release files

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page