Python Bindings and Real Time 3D Visualization for OpenTRIM
OpenTRIM is a C++/Qt Monte Carlo ion transport simulator for radiation damage research. Every parameter study today requires four manual steps: edit config.json, invoke the CLI, load HDF5 output, and plot by hand. No Python interface exists. No live view inside the target. This project delivers both. Feature A - Python Bindings: A pybind11 module wrapping libopentrim so researchers drive simulations directly from Python: result = opentrim.run(config_dict). Tally data is exposed as zero-copy NumPy arrays via ArrayNDd buffer protocol. result.to_xarray() returns a labeled Dataset with element names and nm coordinates for publication-ready depth profiles in one line. result.core exposes mccore internals - ion counts, per-tally SEM, and run merging. GSoC 2025 user_tally binning is bridged to Python. Seven benchmark configurations verify physics parity with the CLI. Feature B - Real-Time 3D Visualization: A QOpenGLWidget tab rendering live ion tracks as GL_LINES during simulation. A two-buffer pipeline handles 30M events/second without stalling. Cascade genealogy is color-coded from ion.recoil_id(): beam ions blue, PKAs orange, sub-cascade recoils red. A SEM convergence overlay tells researchers when to stop. Camera state serializes to JSON; --render produces headless PNG with no display server. Both features are isolated - bindings/ and source/gui/trackview.* - delivered across 14 pull requests in 350 hours.
Project details
Technologies
Not listed in the archive