OpenMC Python Tutorial & Guide

Open-source, Python-first Monte Carlo for reactor physics and radiation transport. Tutorials cover the full API — geometry, materials, tallies, and depletion.

Start Learning OpenMC →

Last Updated: April 2026

Why engineers choose OpenMC

A high-performance transport engine paired with the full Python ecosystem — popular in research groups, startups, and university courses alike. Runnable copies of selected tutorial models are published under caalh/ReactorMC (openmc-examples/).

Python-first design

Model geometry, materials, and tallies with a clean Python API that works seamlessly with NumPy, pandas, and matplotlib.

High-performance engine

MPI & OpenMP parallelism plus support for continuous-energy and multigroup tallies make OpenMC scale on modern clusters.

Research friendly

Open source on GitHub with transparent development, extensive documentation, and an active community.

Modern tooling

Native plotting helpers, statepoint readers, and compatibility with Jupyter notebooks accelerate post-processing.

Quick start guides

Python API Example

Create a simple pin cell model using OpenMC's intuitive Python API:

python
import openmc

# Materials definitions
fuel = openmc.Material(name='Fuel')
fuel.add_nuclide('U235', 0.05)
fuel.add_nuclide('U238', 0.95)
fuel.add_nuclide('O16', 2.0)
fuel.set_density('g/cm3', 10.4)

clad = openmc.Material(name='Cladding')
clad.add_element('Zr', 1.0)
clad.set_density('g/cm3', 6.55)

water = openmc.Material(name='Water')
water.add_nuclide('H1', 2.0)
water.add_nuclide('O16', 1.0)
water.set_density('g/cm3', 1.0)

materials = openmc.Materials([fuel, clad, water])
materials.export_to_xml()

# Geometry definitions
fuel_radius = 0.4
clad_radius = 0.46
pin_pitch = 1.26

fuel_outer = openmc.ZCylinder(r=fuel_radius)
clad_outer = openmc.ZCylinder(r=clad_radius)

fuel_region = -fuel_outer
clad_region = +fuel_outer & -clad_outer
water_region = +clad_outer

pin_cells = []

# Create fuel pin cell
fuel_cell = openmc.Cell(fill=fuel, region=fuel_region)
clad_cell = openmc.Cell(fill=clad, region=clad_region)
water_cell = openmc.Cell(fill=water, region=water_region)

universe = openmc.Universe(cells=[fuel_cell, clad_cell, water_cell])

# Run settings
settings = openmc.Settings()
settings.batches = 100
settings.inactive = 30
settings.particles = 10000

# Create source
source = openmc.IndependentSource(
    space=openmc.stats.Box((-0.63, -0.63, -1), (0.63, 0.63, 1))
)
settings.source = source
settings.export_to_xml()

# Run OpenMC
openmc.run()

Tutorial snippet — no separate file in examples repo

Frequently Asked Questions

How do I install OpenMC?
OpenMC can be installed via conda: conda install -c conda-forge openmc. This includes the Python API and all necessary dependencies.
What Python version is required?
OpenMC supports Python 3.7+ and is regularly tested with the latest Python versions. We recommend using Python 3.8 or newer.
Where do I get nuclear data?
OpenMC provides scripts to download pre-processed nuclear data libraries. You can also process your own data using NJOY.

Ready to Master OpenMC?

Work through the Python tutorials from installation to full-core depletion.