MCNP geometry for ray-trace

Running SRTC from the release bundle. These docs are written against the srtc command line. In the distributed bundle that command lives inside the container, so run it through Compose from the unpacked bundle directory:

docker compose run --rm -v "$PWD":/io backend srtc --help

Files you pass in should sit under the mounted /io, and that is also where to write outputs. On Linux the container runs as an unprivileged user, so add --user "$(id -u):$(id -g)" when writing to a mounted directory or the run fails with a permission error creating the output directory:

docker compose run --rm --user "$(id -u):$(id -g)" -v "$PWD":/io backend \
  srtc -i examples/fwd_transport/oltaris_al_si.deck -o /io/out/results.out \
     --depth-g-cm2 1.0 --histories 100000 --seed 1

The physics libraries are already in place, and the shipped example decks resolve against them, so the examples below run as written. See Downloads to get the bundle, and the Viewer guide for the browser GUI, which needs none of this.

Ray-trace mode can use MCNP-style cell/surface definitions instead of analytic sphere/cube/slab models. Geometry is parsed by the geometry crate (same CSG engine as 3D Monte Carlo) and walked ray-by-ray to accumulate areal depth τ [g/cm²] per material.

See also: raytrace.md, examples/raytrace/mcnp_cube.deck.


Enabling

docker compose run --rm backend srtc raytrace -i examples/raytrace/mcnp_cube.deck

Set RAYTRACE GEOMETRY=MCNP and supply geometry via one of the deck cards below.


Deck cards

MCNP_GEOMETRY

Inline block or external file:

MCNP_GEOMETRY BEGIN
1  182 -2.699  -1           imp:n=1   $ Al cube
2  0          1           imp:n=0   $ outside world
c
1  RPP -0.5 0.5 -0.5 0.5 -0.5 0.5
END
MCNP_GEOMETRY FILE=shield.mcnp

SURFACES / CELLS

Alternative section syntax (lines are appended to the MCNP geometry text):

SURFACES
1  RPP -0.5 0.5 -0.5 0.5 -0.5 0.5
2  PZ 0.0
END

CELLS
1  182 -2.699  -1 -2
2  27  -8.96   -1  2
3  0          1
END

MCNP_MATERIAL

Map traditional MCNP m1, m2, … numbers to srtc materials:

MCNP_MATERIAL ID=1 MATERIAL=IRON
MCNP_MATERIAL ID=2 MATERIAL=WATER

Alternatively, put the srtc MaterialKind numeric id directly in the cell card (e.g. 182 for aluminium).

Detector position (Cartesian)

Detector origin [cm] for ray casting:

DETECTOR MATERIAL=SI THICKNESS_CM=0.01 X=0 Y=0 Z=0
RAYTRACE DETECTOR_X=0 DETECTOR_Y=0 DETECTOR_Z=0

FC point detectors inside MCNP geometry blocks are also parsed (FC1 TYPE POINT 0 0 0).


Surface types (phase 1)

MCNP Meaning
PX d Plane x = d
PY d Plane y = d
PZ d Plane z = d
SO r Sphere at origin, radius r
S cx cy cz r General sphere
CX/CY/CZ r Infinite cylinder on axis
RPP xmin xmax ymin ymax zmin zmax Rectangular parallelepiped (macrobody)
SPH cx cy cz r Sphere macrobody
RCC vx vy vz hx hy hz r Right circular cylinder macrobody

Additional types (P, GQ, KX/KY/KZ, TX/TY/TZ) are supported by the parser but are less used in verification decks.


Cell syntax

<cell_id>  <material_id>  <density>  <surface senses...>  [imp:...=value]

Example — Al shell between r = 5 and r = 10 cm:

1  271 -7.874  -1
2  11  -1.0     1 -2
3  0            2 -3
4  0            3           imp:n=0
c
1  SO 5.0
2  SO 10.0
3  SO 20.0

Geometry build rules

Rules a deck must satisfy for the 3D MC / adjoint transport and the web viewer to load and score it correctly.

World region + graveyard

World auto-sizing (viewer)

When a deck is saved through the viewer, the world surface is resized automatically (viewer-server auto_size_world):

Coordinates

Materials

Macrobodies and senses

Detectors


Ray-trace path

From the detector point, each ray direction is walked through CSG regions. Every non-void segment contributes τ = ρ · ℓ [g/cm²]. Results feed the same dose-depth and spectrum estimators as analytic geometry modes.


Gaps vs full MCNP

Supported Not yet
Planes PX/PY/PZ, spheres SO/S, cylinders CX/CY/CZ Full surface catalog (ellipsoids, cones with transforms, …)
Macrobodies RPP, SPH, RCC Arbitrary lattice/universe fills
Cell booleans :, #, parentheses Periodic surfaces, embedded universes
FC point/surface/volume detectors Full tally card suite
Cartesian detector from deck Rotated/transformed surfaces (TR cards)

Incremental additions can extend crates/geometry/src/surface.rs and the deck parser without changing the ray-trace API.