Skip to main content

boltzpmp

boltzpmp は、プロパゲータ法で電子ボルツマン方程式を解く、Rustで高速化された Pythonパッケージです。DC・RF電場における電子エネルギー分布、平均エネルギー、 ドリフト速度、反応速度係数を計算できます。

インストール

Python 3.10以降が必要です。

uv pip install boltzpmp

クイックスタート

import boltzpmp as bp

mixture = bp.load_argon()
solver = bp.PMSolver(
    mixture,
    eps_max_eV=25.0,
    d_eps_eV=0.2,
    n_theta=90,
)

result = solver.solve_dc(EN_Td=10.0)
print(result.mean_energy)
print(result.drift_velocity)
print(result.rate_coefficients)

RF周期定常計算も同じソルバーから実行できます。

result = solver.solve_rf(EN_rms_Td=10.0, freq_Hz=13.56e6)
print(result.mean_energy_rms, result.drift_velocity_rms)

独立した換算電場点は、Rust計算中にPythonインタープリタを解放して並列実行できます。

results = bp.solve_dc_sweep(
    solver,
    [0.5, 1.0, 2.0, 5.0, 10.0],
    max_workers=4,
    scheme="upwind",
)

計算点の並列化には solve_dc_sweep を使用してください。単一計算内の並列化は PMSolver(..., parallel=True) で明示的に有効化できます。

断面積データ(LXCat・BOLSIG+形式)

parse_lxcat はLXCatとBOLSIG+の書式を読みます。読み込みと検証はRustコアが行い、書式の誤りは 行番号付きの ValueError になります。

  • EXCITATIONの3行目の「しきい値 統計重み比」
  • 反応式の <->(逆過程の標的を、生成物の気体とする)
  • ROTATIONブロック(3行目と4行目に下準位・上準位の「エネルギー 統計重み」)
  • 表の3列目(運動量移行断面積。このとき2列目は積分断面積として扱う)

物理モデル

0.2.0から、次の2つを既定で有効にしています。0.1.3と同じ模型で計算するには PMSolver(..., superelastic=False, gas_heating=False) とします。

  • 超弾性衝突(superelastic=True)。逆過程の断面積は詳細釣り合いで求めます。
    • ROTATION: 同じ気体のROTATIONブロックに現れる全準位の占有をBoltzmann因子で求め(全体で規格化)、 遷移ごとに下準位・上準位の占有を掛けます(BOLSIG+と同じ)。
    • EXCITATIONで <-> を使うか、生成物が混合気体の成分にあるとき: 逆過程の標的は生成物の気体です。
    • それ以外のEXCITATION: 下準位と上準位の2準位系として占有を求めます(BOLSIG+と同じ)。
    • 占有の温度は Mixture(T_K=..., T_exc_K=..., transition_energy_eV=...) で与えます (BOLSIG+のGas temperature、Excitation temperature、Transition energy。T_exc_Kの既定はT_K)。
  • 気体温度による弾性衝突のエネルギー交換(gas_heating=True)。電場がなければ格子上のMaxwell分布が 厳密な定常解になるように離散化しています。

断面積に運動量移行断面積(CrossSection.mt_data または表の3列目)があると、その比 σ_m/σ から 遮蔽Rutherford型の角度分布(Okhrimovskyy et al., Phys. Rev. E 65, 037402 (2002))を作り、 散乱後の方向の再分配に使います。極性分子の回転励起のような前方散乱を、積分断面積のまま扱えます。

DC定常解の陰解法

0.3.0から、solve_dc の既定は陰解法(method="implicit")です。定常方程式を直接解くので、 時間発展(method="explicit")より数十〜数千倍速く、同じ離散方程式の解になります。

  • 風上差分の移流と衝突の損失を、流れに沿った1回の走査で厳密に解きます((ε, θ) の流れは閉路を作らない)。
  • 衝突による再注入と、limiter の高次補正は前の反復の値を使い(ソース反復と欠損補正)、Anderson加速で収束を速めます。
  • 電離・付着による電子数の増減は、陽解法と同じく和を1に保つ規格化として扱います。
  • tol(既定1e-8)は1反復の残差 ‖g(n) − n‖₁、max_steps は反復回数の上限です。
  • scheme="blending"(ξの探索)は陽解法だけで使えます。
条件 陽解法 陰解法
同梱Ar、10 Td(0.2 eV刻み、n_theta = 90) 24 s 0.7 s
HF(xsecsim、非一様格子2331セル)、10 Td 15 s 0.3 s
HF、30 Td 400 s 0.6 s
HF、50 Td(4183セル) 1.5時間で未収束 1.3 s

RF周期定常解の陰解法

0.4.0から、solve_rf の既定も陰解法(method="implicit")です。

  • 各段をBDF2で陰的に解きます(1段目と、右辺が負になる段は後退Euler)。解き方はDCの陰解法と同じです。
  • 時間刻みは安定条件に縛られません。1周期の既定は256段以上(n_store の倍数)で、時間の誤差は1e-5程度です。
  • 1周期の写像の不動点を、Anderson加速と実効電場の前処理で求めます。
    • 実効電場の問題は、実効値の電場に、エネルギーを変えない等方散乱 ω²/ν を加えたDC問題です (高周波の極限で時間平均の分布になります)。
    • init_n を与えないときは、この問題の定常解から始めます。
  • tol(既定1e-6)は、周期写像の残差 ‖Φ(n) − n‖₁ と前処理による誤差の見積もりの許容値です。
    • extra["cycle_residuals"] に周期ごとの残差、extra["inner_iterations"] に反復の合計が入ります。
  • 陽解法(時間の1次精度)は、安定条件の刻みでもドリフト速度に0.5〜1%の誤差が残ります。陰解法は256段で1e-5以下です。
    • 気体密度が低く陽解法の刻みが粗くて済む条件では、陽解法のほうが速いこともあります(VALIDATION.md)。
  • 気体密度が低く、エネルギー分布の緩和に数千周期以上かかる条件では、収束に時間がかかります。converged を確かめてください。

数値スキームと格子

solve_dc と solve_rf の scheme で移流の離散化を選びます。

scheme 内容
limiter(既定) van Leer制限関数による2次精度のTVDスキーム。負の値を作らない
upwind 1次精度。刻みと電場に比例する数値拡散で平均エネルギーを高めに出す
blending ξ = 1(中心差分)から始め、負の値が出るたびに ξ を下げてやり直す

熱平衡の近く(0.01 Td)での平均エネルギーの誤差は、5 meV刻みで upwind が +5.9%、limiter が +0.4% でした。

低エネルギーに細かい構造がある分子(回転しきい値が数meVのHFなど)では、非一様格子を使うと 少ないセル数と大きな時間刻みで計算できます。

edges = bp.graded_energy_grid(eps_max_eV=60.0, d_eps_min_eV=0.0025, eps_uniform_eV=0.5)
solver = bp.PMSolver(mixture, energy_grid=edges, n_theta=16)

eps_uniform_eV までは一様刻み、その上は刻みを sqrt(eps) に比例して広げます(速度の刻みが一定)。

計算結果

  • rate_coefficients: 過程ごとの速度係数(その過程の標的1個あたり)。キーは 気体名:過程名 で、 逆過程には (superelastic) が付きます。
  • fractions: 各過程の標的の、全数密度に対する割合。混合気体全体への寄与は速度係数に掛けて足します。
  • reduced_ionization_frequency、reduced_attachment_frequency: その和。alpha_over_N、eta_over_N はドリフト速度で割った値です。
  • PMSolver.processes(): 組み立てた衝突過程(逆過程を含む)の一覧。

LXCat断面積による検証

2026-08-15に、LXCatのMorgan databaseから取得したAr電子衝突断面積セットを使い、 1、10、50、100 Tdのupwind計算と、10、100 Tdの自動ブレンディング計算を検証しました (0.1.3の模型。超弾性衝突と気体温度の効果なし)。 6条件すべてが収束し、Python参照実装との比較は次の結果でした。0.2.0でも、両方を切ると 同じ結果になることを互換テスト(tests/parity)で確かめています。

指標 最大誤差 合格基準
状態分布のL1差 3.52e-14 1e-5
EEDFの相対L1差 3.55e-14 1e-5
主要物理量の相対差 3.63e-14 1e-5
反応速度係数の相対差 4.06e-14 1e-5

入力ファイルのSHA-256は 29c903d91e68bb0895f45b763c8c982ef09c2b2e0636fc75fd0545dc7d69abc3 です。 条件、収束ステップ数、各物理量、生の誤差は VALIDATION.md と reference/lxcat_morgan_argon_validation.json に記録しています。

開発とテスト

Windows PowerShellでは次のコマンドを実行します。

$env:UV_CACHE_DIR = Join-Path (Get-Location) '.uv-cache'
uv run --with maturin maturin develop --release
uv run --extra test pytest -q
cargo test --workspace

実データ検証は、断面積ファイルとPython参照実装の場所を指定して再実行できます。

$env:UV_CACHE_DIR = Join-Path (Get-Location) '.uv-cache'
uv run --with scipy --extra test python benchmarks\validate_lxcat.py `
  'C:\path\to\Ar-cross-sections.txt' `
  --reference-source 'C:\path\to\python-reference' `
  --output reference\lxcat_morgan_argon_validation.json

現在のテスト構成はRust単体テスト28件、Python API・物理テスト38件です。

パッケージ公開

.github/workflows/wheels.yml を手動実行すると、Windows、Linux、macOS向けwheelと sdistを作成します。全ビルド成功後、選択した公開先へOIDC Trusted Publishingで 配布します。

workflow入力 公開先 GitHub Environment
publish_testpypi TestPyPI testpypi
publish_pypi PyPI pypi

TestPyPI版を確認する場合は、依存パッケージと本体の取得先を分けます。

uv pip install "numpy>=1.22"
uv pip install --no-deps --index-url https://test.pypi.org/simple/ boltzpmp

Trusted PublisherにはOwner Reasonia-TK、Repository boltzpmp、Workflow wheels.yml と、公開先に対応するEnvironmentを設定します。

ライセンス

MIT License

Release files for boltzpmp 0.4.0

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

Source distribution (sdist)

Source distribution for boltzpmp 0.4.0
File Size Uploaded
boltzpmp-0.4.0.tar.gz 86.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for boltzpmp 0.4.0
File Interpreter ABI Platform
boltzpmp-0.4.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
boltzpmp-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
boltzpmp-0.4.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Total release size: 1.6 MB

Release files / boltzpmp-0.4.0.tar.gz

Download URL boltzpmp-0.4.0.tar.gz
Size 86.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ca2b2276645e7ad1b5835a675c449b0a1eddcf0b3879ee96c7f1c108baa1c4e3
BLAKE2b-256 checksum
How to use checksums
58322dda1599b2455eeb659d2d0e6054242051de618c0418e5504f8810a75a2f
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 Sep 25, 2026.

Transparency log

Release files / boltzpmp-0.4.0-cp310-abi3-win_amd64.whl

Download URL boltzpmp-0.4.0-cp310-abi3-win_amd64.whl
Size 420.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
dbda266c6f61f35c9fcfa64cdda69898287c70bc857dfb6f621da3f1efb73bde
BLAKE2b-256 checksum
How to use checksums
3379c84f83b9761a506b8a414b2aa10f3ed063f704f15eeb4fc70bbfc908340e
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 Sep 25, 2026.

Transparency log

Release files / boltzpmp-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL boltzpmp-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 593.6 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
23cea3d695399ffc5897d2fd2f79cc136aeeced63591df86f2923722ea2675f5
BLAKE2b-256 checksum
How to use checksums
996cc9a0812c50fa2d26130f4c4a533dad731381d050dc5ba2eecab10e4185e8
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 Sep 25, 2026.

Transparency log

Release files / boltzpmp-0.4.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL boltzpmp-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Size 524.8 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
43d4defd4c72cba2f1d304193936b165f32587d6072ba81036215348485bb0f3
BLAKE2b-256 checksum
How to use checksums
d96b525c2a8a04778bee4015d3dd6b312ce3edeb520a012e2cd8373ffe359882
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 Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

4 release files

0.3.0

4 release files

0.2.0

4 release files

0.1.3

4 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