PyPartMC

raw JSON →
2.0.6 verified Fri May 01 auth: no python

Python interface to the PartMC (Particle Monte Carlo) model for simulating atmospheric aerosol dynamics. Version 2.0.6. Uses nanobind bindings. Irregular release cadence, roughly monthly.

pip install pypartmc
error ImportError: No module named PyPartMC
cause The Python module is named 'PyPartMC', but package is 'pypartmc'. You may have installed the wrong package or used wrong import.
fix
Run 'pip install pypartmc' and then 'import PyPartMC'.
error ModuleNotFoundError: No module named 'partmc'
cause Common mistake: trying to import 'partmc' instead of 'PyPartMC'.
fix
Use 'import PyPartMC'.
error ValueError: species 'SO4' not found
cause AeroData species definitions must include all properties (density, kappa). Missing or misnamed species cause this.
fix
Provide complete species_data for each species, e.g., ppmc.AeroData.species_data('SO4', density=1.8, kappa=0.5).
breaking PyPartMC v2.0.0 switched from pybind11 to nanobind. Code compiled against previous versions may need reinstallation. The module import path remains 'PyPartMC'.
fix Reinstall pypartmc and ensure all dependencies are up-to-date.
gotcha Always use 'import PyPartMC', not 'import pypartmc' or 'import partmc'. The package name is pypartmc on PyPI, but the Python module is PyPartMC (case-sensitive).
fix Use 'import PyPartMC'.
deprecated Some older functions (e.g., AeroData.from_json) may be removed in future versions. Check the changelog for deprecation notices.
fix Check documentation for current API.
conda install -c conda-forge pypartmc

Initialize aerosol species data, create gas state, set concentrations.

import PyPartMC as ppmc
import numpy as np
aero_data = ppmc.AeroData(
    ["SO4", "NaCl"],
    [ppmc.AeroData.species_data("SO4", density=1.8, kappa=0.5),
     ppmc.AeroData.species_data("NaCl", density=2.16, kappa=1.0)]
)
state = ppmc.GasState(aero_data)
state.set_conc(np.array([1e-5, 2e-5]))
print(state.conc)