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

High-performance tools for 2-D driven-dissipative Gross-Pitaevskii simulations of exciton-polariton systems.

The repository is organized around one clear boundary:

  • polarism/ is the physics engine: model configuration, grids, lasers, reservoirs, solvers, state evolution, and result storage.
  • tests/ contains the validation layer for the engine and solver behavior.
  • examples/ contains runnable usage examples.

The full documentation site is in docs/ and is configured by mkdocs.yml.

Documentation site: https://jakrog01.github.io/Polarism/#getting-started

Repository Layout

polarism/                     Physics engine and reusable Python package
  config/                     Dataclasses and validation helpers
  grid/                       Periodic and closed-interval 2-D grids
  laser/                      Continuous and pulsed pump definitions
  reservoir/                  Single, double, and quadratic-double reservoirs
  solver/                     CPU, CuPy, CUDA RK4, FFT, and ETD/IP solvers
  results/                    Storage and visualization support

tests/                        CPU, compliance, and benchmark-style tests

docs/                         MkDocs Material documentation site
examples/                     Runnable usage examples
pyproject.toml                Project metadata and dependency groups

Installation

pip install polarism

GPU solvers additionally need a CuPy build matching the local CUDA toolkit, e.g. pip install "polarism[cuda12]" or pip install "polarism[cuda13]"; see docs/getting-started/installation.md.

Quick Local Setup

For development, use the project virtual environment. The global Python on the target systems is not expected to contain the required packages.

python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e ".[dev]"

Run the default CPU-oriented checks:

.venv/bin/pytest
.venv/bin/mkdocs build

The default pytest selection excludes slow and compliance-marked suites. See docs/development/testing-and-ci.md for the heavier validation commands.

For the complete CPU/GPU validation, including the Phoenix reference matrix:

.venv/bin/pytest -q -m '' --use-gpu --tb=short \
  --junitxml=artifacts/reports/full_verification.xml

Run this command as a single process with exclusive access to the GPU.

Minimal API Example

The same script is available as 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 the command-line interface generated from polarism.Config:

.venv/bin/polarism --help

More examples are documented in docs/getting-started/quickstart.md.

Pump Power Conventions

For pulsed pumps, prefer explicit physical semantics in the laser YAML:

lasers:
  - laser_type: pulse-gaussian
    power_definition: pulse_energy

pulse_energy means that power / P is the integrated dose of one pulse over space and time. This keeps spot-size sweeps meaningful: increasing sigma_space lowers the local peak pump while preserving the total pulse dose. The legacy peak_amplitude mode is still available for reproducing old runs.

Numerical choices such as grid spacing, timestep, boundary condition, kinetic relaxation, and Laplacian stencil should be treated as convergence parameters, not as cosmetic post-processing settings. The model background and rationale are summarized in docs/development/physics-background.md.

Documentation

Build and serve the documentation locally:

.venv/bin/mkdocs serve

Key entry points:

Development Notes

  • Keep reusable physics logic inside polarism/.
  • Keep tests for engine behavior inside tests/.
  • Use .venv/bin/python, .venv/bin/pytest, and .venv/bin/mkdocs in this repository.

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.2

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.2
File Size Uploaded
polarism-0.3.2.tar.gz 90.8 kB Details

Built distribution (wheel)

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

Total release size: 201.8 kB

Release files / polarism-0.3.2.tar.gz

Download URL polarism-0.3.2.tar.gz
Size 90.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e31cf7d806f572105761c9e2d472e23839bb9efff95ee5a93dff454f00231577
BLAKE2b-256 checksum
How to use checksums
d24f8c98b5c746c97ae1a979cf7767296a71ec979bfbcca17eefb6131a0077c0
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.2-py3-none-any.whl

Download URL polarism-0.3.2-py3-none-any.whl
Size 111.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
178a08f24dbd305f4f6f07a03e02838569844649c5e8614e120b49c485786870
BLAKE2b-256 checksum
How to use checksums
84b11205f966b07d206bbff6dee3d228c2653bd26883b2e225ad2311a3db01c7
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

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

This release

0.3.2 This release

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