Fast, exact geometry queries on MCNP models: an interactive viewer, a command line and a Python module, on a Rust engine. llevant answers:
- where points are, and what lines cross;
- slices and 3D views;
- volumes, and the gaps and overlaps of a model;
- fingerprints that tell two versions of a model apart;
- tally results (meshtal, MCTAL, per cell) drawn over the geometry.
It reads the MCNP input (through migjorn), with every surface and macrobody, universes at any depth, lattices and transforms.
Documentation: https://fusion4energy.github.io/llevant/: install, a ten-minute tour, how-to guides and references.

| Results over the geometry (mock pin powers) | A check finds the lid overlapping the cask |
|---|---|
![]() |
![]() |
The models are in docs/examples.
Install
Windows and Linux (x86-64). The releases
also have the llevant and llevant-viewer programs to download, and
cargo install llevant-cli --features gpu,viewer builds them from source. Details,
and what your computer needs: Install.
Try it
docs/examples/cask.i is a small model to try (a cask of fuel
pins on a concrete floor); Getting started
walks through it.
With pip, llevant is python -m llevant. From Python:
= # compiled once, cached on disk
# <Label inside 4 > 30[0,0,0] > 41>
# (N, 3) numpy array -> numpy columns
# an image, shown inline in Jupyter
# volumes with their uncertainty
# gaps and overlaps
How fast
On a 425 k-cell fusion reactor model, on a 16-thread laptop
(docs/benchmarks.md):
| Load | 1.3 s from the cache (36 s to compile the first time) |
| Points | 5.4 million classified per second |
| Lines | 3.3·10⁵ lines of 100 cm traced per second |
| Slices | 110 ms for 1000 rows |
| Gaps and overlaps | the 36 × 37 × 35 m building checked on lines 5 cm apart in under 3 minutes |
| Viewer | 60 fps while orbiting (GPU) |
What it does
| Query | Command | Library |
|---|---|---|
| Where points are: cell path, material, density; gaps, overlaps, on-surface | locate |
Model::classify |
| What lines cross: exact segments, the surface at each end | trace (--lines for a file of them) |
Model::trace |
| 2D slices with exact boundaries, cell and surface labels | slice |
Model::slice, llevant_render::labels |
| 3D views: hidden cells, cutaways, universe levels, ghost shells | render (--gpu) |
Model::render, Model::first_hits, llevant-gpu |
| Realistic images: materials sorted by composition, physically based shading | render --colour realistic, materials |
llevant_scene::materials, llevant_render::shading |
| Volumes by cell, material, universe or tally bin, with an honest uncertainty | volume |
Model::volumes, volumes_to, instance_volumes |
| Gaps and overlaps, with volume and location | check |
Volumes::problems |
| Fingerprints of cells and universes; model diffs | fingerprint |
Model::fingerprints |
| A universe (a filler) as a model of its own | --universe |
Model::universe |
| Cell instances: each place a cell occupies, numbered | locate |
Model::instances |
| Results over the geometry: values per cell, instance or mesh voxel (CSV, meshtal, MCTAL, D1SUNED cuvmsh) | slice/render --field |
llevant_scene::field |
| An interactive viewer: 3D view and slice, picking, rules, cuts, fields, FMESH layout, card editing | llevant-viewer, llevant view |
crates/llevant-viewer |
| Python: models kept in memory, numpy batch queries, inline images, the viewer | python -m llevant |
crates/llevant-py |
What MCNP input is read, and what is not: Supported input.
Library
use ;
- Batches. Queries take batches and return flat arrays, ready for numpy: one label id per point or segment, with the labels interned.
- Indices and numbers. Labels refer to cells by index into
model.cells();describe,cell_idandsurface_idgive MCNP numbers. - Determinism. Results are identical for any number of threads.
- Errors. Bad arguments are an
Error, never a panic.
The API is on docs.rs (views, volumes and images included),
and docs/contracts.md lists what each query guarantees.
Layout
| Path | Purpose |
|---|---|
crates/llevant |
The engine (pure Rust, geometry only) |
crates/llevant-scene |
What frontends build from a model: cell rules, hidden cells, material looks, field data and tally files, the input's cards, the cache of compiled models |
crates/llevant-render |
Images: colours, colour scales, field looks, physically based shading, labels, PNG |
crates/llevant-gpu |
The GPU renderer (wgpu) |
crates/llevant-viewer |
The llevant-viewer desktop app and its egui widgets |
crates/llevant-cli |
The llevant command |
crates/llevant-py |
The Python module llevant (PyO3, abi3 wheels) |
tools/bench |
llevant-bench: benchmarks, checks against brute force and of the GPU against the CPU |
tools/mcnp-oracle |
Checks llevant against MCNP itself |
tools/synthetic |
Generators of benchmark models |
docs/ |
The documentation site's pages: user guides, and for developers the architecture, contracts, decisions, benchmarks and internals |
Develop
docs/CONTRIBUTING.md has the commands, the rules and how to
check against MCNP.
Licence: EUPL-1.2.

