plasmacoll
Null-collision Monte Carlo collisions (MCC) of charged particles with
neutral gases, on NumPy or CuPy arrays. It is the collision step of a
particle-in-cell code, or with ZeroDReactor a homogeneous reactor,
optionally in an electric field, for testing cross-section sets.
- Processes: elastic, backscatter (resonant charge exchange), excitation, ionization (electron and ion impact), attachment, detachment, charge transfer, dissociation, dissociative attachment, dissociative ionization, and stripping and capture of a fast beam (from the same cross sections as its charge-state fractions). Isotropic or forward-peaked (Vahedi–Surendra, Okhrimovskyy) scattering, and equal, uniform or Opal–Peterson–Beaty energy sharing. Fast neutrals and fragments can be tracked as species.
- Neutral gases: drifting Maxwellians with density and temperature profiles, replaceable between steps for gas heating or depletion.
- Cross sections: from text tables, LXCat files (with
EFFECTIVEsets converted to elastic, and the ion-neutral blocks of the Phelps database) or functions. Also Maxwell molecules for benchmarks, and population-weighted mixtures of level-resolved tables, e.g. H₂(v) dissociative attachment. Rudd’s energy distribution of the secondary electrons of ionization by fast ions, with its H₂ parameters. - Argon and metals: electron-argon processes from a downloaded LXCat set, Phelps’ Ar⁺ + Ar fits, and Lotz ionization cross sections for sputtered Cu and Ti atoms and ions.
- Plain arrays: markers are positions, velocities and weights. Any particle container with those plugs in, and cunumpy runs the same code on CPU (NumPy) or GPU (CuPy). Markers can be merged and split, conserving weight, momentum and energy.
- Boltzmann solver:
solve_eedfsolves the two-term Boltzmann equation for electrons in a DC field (Hagelaar and Pitchford, the method of BOLSIG+) for the same processes: the energy distribution, mobility, diffusion and rate coefficients.swarm_tabletabulates them against the mean energy for fluid and global models. - Validated: a 0D reactor reproduces the closed-form relaxation, growth and decay rates of Maxwell-molecule gases, and the drift velocity and Wannier energy of a swarm in a field. The Boltzmann solver reproduces the Maxwell and Druyvesteyn limits and published model-gas results. The tests run on NumPy and on a CuPy stand-in, with 100 % combined coverage.
Collisions between charged particles (Coulomb collisions, recombination) are out of scope: the collision partners are always neutral gases.
Documentation: https://max-models.github.io/plasmacoll/
Install
pip install plasmacoll
Example
import plasmacoll
from plasmacoll.constants import ATOMIC_MASS, ELECTRON_MASS, kelvin_to_ev
argon_mass = 39.95 * ATOMIC_MASS
argon_gas = plasmacoll.NeutralBackground(
"Ar", density=1e21, temperature=kelvin_to_ev(300.0), mass=argon_mass
)
elastic_xs = plasmacoll.CrossSection.constant(1e-19)
ionization_xs = plasmacoll.CrossSection.constant(3e-20, threshold=15.76)
elastic = plasmacoll.CollisionProcess("elastic", "Ar", elastic_xs, energy_frame="lab")
ionization = plasmacoll.CollisionProcess(
"ionization",
"Ar",
ionization_xs,
energy_frame="lab",
products={"electron": "e", "ion": "Ar+"},
)
mcc = plasmacoll.MonteCarloCollisions(
species_masses={"e": ELECTRON_MASS, "Ar+": argon_mass},
backgrounds=[argon_gas],
processes={"e": [elastic, ionization]},
seed=1,
)
temperature = 10.0 # kT in eV
electrons = plasmacoll.ParticleArrays.maxwellian(
100_000, ELECTRON_MASS, temperature, seed=2
)
reactor = plasmacoll.ZeroDReactor(mcc, {"e": electrons}, volume=1e-6)
history = reactor.run(dt=1e-11, num_steps=500, every=10)
print(history.density["Ar+"][-1], history.collisions["ionization:Ar"][-1])
In a particle-in-cell code, call
mcc.collide(species, positions, velocities, weights, dt) on arrays, or
mcc.collide_species({...}, dt) on your own particle containers. See
Use in a particle-in-cell
code.
plasmacoll does not ship tabulated cross-section data, only published
analytic fits, among them plasmacoll.janev, the openly published
hydrogen fits of Janev, Reiter and Samm (2003), and
plasmacoll.hydrogen_elastic, the elastic e + H and e + H₂ fits of Park
et al. (2022). Load tables from LXCat or the
literature with plasmacoll.read_lxcat and CrossSection.from_table.
Development
With uv:
make install # uv sync --extra dev, plus the pre-commit hooks
make test # pytest with coverage on NumPy
make test-cupy # the same tests on cunumpy's stand-in for CuPy (no GPU needed)
make coverage # both runs combined, must be 100 %
make lint # ruff check, ruff format --check, pyright, ty
Commit messages follow Conventional Commits.
Build docs
The documentation in docs/ is an Astro +
Starlight site: hand-written guides,
the notebooks in tutorials/ executed and published as pages, and the
API reference generated from the docstrings. It needs Node 22 or newer.
make docs-install # npm packages and the Python docs extra
make docs-notebooks # execute tutorials/*.ipynb and convert them to pages
make docs-dev # live preview at http://localhost:4321/plasmacoll/
make docs-build # the static site in docs/dist
README.md is rendered from README.qmd with
Quarto: make readme.
Releases
Before merging a release to main, update the version in
pyproject.toml and src/plasmacoll/__init__.py, and add the release
notes to CHANGELOG.md. The push to main creates a GitHub release
with a vX.Y.Z tag and publishes the package to PyPI with trusted
publishing (OIDC). See the publishing
guide.
Metadata
Release files for plasmacoll 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plasmacoll-0.4.0.tar.gz | 131.7 kB | With provenance | Details for plasmacoll-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plasmacoll-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for plasmacoll-0.4.0-py3-none-any.whl |
Total release size: 286.1 kB
Release files / plasmacoll-0.4.0.tar.gz
| Download URL | plasmacoll-0.4.0.tar.gz |
|---|---|
| Size | 131.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
556472c8fcfa08c6b4a9a65fca9ffd50c647621f37181cbd2a16ff06bc2b4af9
|
|
BLAKE2b-256 checksum How to use checksums |
1c4f5b434f34537c8da7aec4f50b65b04a1da42b9c7ec604f94c37600e867586
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 27, 2026.
Transparency logRelease files / plasmacoll-0.4.0-py3-none-any.whl
| Download URL | plasmacoll-0.4.0-py3-none-any.whl |
|---|---|
| Size | 154.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31ef4e8a895ce8b664569c145d5fef99b6a05a48a5cd7f5743941722b30c1da4
|
|
BLAKE2b-256 checksum How to use checksums |
9dc8b5a56d881d2f6621ec73050483fbe1955a86f5e4673aa176c3b80619f4fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 27, 2026.
Transparency logSecurity for plasmacoll 0.4.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for plasmacoll-0.4.0.tar.gz
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 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.