# openmc-dev/openmc architecture

> Architecture diagram of the GitHub repository openmc-dev/openmc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openmc-dev/openmc
- Repository: https://github.com/openmc-dev/openmc

## Overview

OpenMC is a Monte Carlo particle-transport code with a Python API for defining and running models and a C++ transport engine. The principal workflow is model setup, execution of particle transport against geometry and cross-section data, tallying, and result output. Python modules also provide multi-group cross-section and depletion workflows. The graph includes these documented and indexed subsystems; unsampled implementation details are omitted, and unverified runtime handoffs are dashed.

Main entry points: [`include/openmc/simulation.h`](https://github.com/openmc-dev/openmc/blob/develop/include/openmc/simulation.h) (Simulation state), [`src/tallies/tally_scoring.cpp`](https://github.com/openmc-dev/openmc/blob/develop/src/tallies/tally_scoring.cpp) (Tally scoring), [`openmc/mgxs/mgxs.py`](https://github.com/openmc-dev/openmc/blob/develop/openmc/mgxs/mgxs.py) (Multi-group XS), [`openmc/model/model.py`](https://github.com/openmc-dev/openmc/blob/develop/openmc/model/model.py) (Model API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modeling["Modeling and execution"]
  node_model["Model API<br/>[model.py]"]
  node_executor["Run executor<br/>[executor.py]"]
  node_native["Native entry<br/>[main.cpp]"]
  node_settings["Run settings<br/>[settings.h]"]
end

subgraph group_transport["Transport engine"]
  node_simulation["Simulation state<br/>[simulation.h]"]
  node_geometry["Geometry navigation<br/>[geometry.cpp]"]
  node_materials["Materials<br/>[material.cpp]"]
  node_crosssections["Cross sections<br/>[cross_sections.cpp]"]
  node_particle["Particle tracking<br/>[particle.cpp]"]
  node_physics["Transport physics<br/>[physics.cpp]"]
  node_mesh["Mesh operations<br/>[mesh.cpp]"]
end

subgraph group_results["Scoring and results"]
  node_tallies["Tally scoring<br/>[tally_scoring.cpp]"]
  node_tallydata["Tally results<br/>[tally.cpp]"]
  node_statepoint["Statepoint output<br/>[state_point.cpp]"]
end

subgraph group_analysis["Nuclear data analysis"]
  node_mgxs["Multi-group XS<br/>[mgxs.py]"]
  node_data["Nuclear data<br/>[reaction.py]"]
end

subgraph group_depletion["Depletion"]
  node_deplete["Depletion integrators<br/>[abc.py]"]
  node_depleteoperator["Transport operator<br/>[openmc_operator.py]"]
end

node_user(("Model user"))

node_user -.->|"defines model"| node_model
node_model -->|"runs model"| node_executor
node_executor -.->|"launches engine"| node_native
node_native -.->|"uses settings"| node_settings
node_simulation -.->|"uses geometry"| node_geometry
node_simulation -.->|"uses materials"| node_materials
node_simulation -.->|"tracks particles"| node_particle
node_particle -.->|"transports through"| node_physics
node_materials -.->|"uses data"| node_crosssections
node_simulation -->|"uses meshes"| node_mesh
node_tallies -->|"scores into"| node_tallydata
node_tallydata -.->|"writes results"| node_statepoint
node_mgxs -->|"uses tallies"| node_tallies
node_mgxs -->|"uses nuclear data"| node_data
node_deplete -->|"uses operator"| node_depleteoperator
node_depleteoperator -.->|"generates tallies"| node_tallies

click node_model "https://github.com/openmc-dev/openmc/blob/develop/openmc/model/model.py"
click node_executor "https://github.com/openmc-dev/openmc/blob/develop/openmc/executor.py"
click node_native "https://github.com/openmc-dev/openmc/blob/develop/src/main.cpp"
click node_settings "https://github.com/openmc-dev/openmc/blob/develop/include/openmc/settings.h"
click node_simulation "https://github.com/openmc-dev/openmc/blob/develop/include/openmc/simulation.h"
click node_geometry "https://github.com/openmc-dev/openmc/blob/develop/src/geometry.cpp"
click node_materials "https://github.com/openmc-dev/openmc/blob/develop/src/material.cpp"
click node_crosssections "https://github.com/openmc-dev/openmc/blob/develop/src/cross_sections.cpp"
click node_particle "https://github.com/openmc-dev/openmc/blob/develop/src/particle.cpp"
click node_physics "https://github.com/openmc-dev/openmc/blob/develop/src/physics.cpp"
click node_mesh "https://github.com/openmc-dev/openmc/blob/develop/src/mesh.cpp"
click node_tallies "https://github.com/openmc-dev/openmc/blob/develop/src/tallies/tally_scoring.cpp"
click node_tallydata "https://github.com/openmc-dev/openmc/blob/develop/src/tallies/tally.cpp"
click node_statepoint "https://github.com/openmc-dev/openmc/blob/develop/src/state_point.cpp"
click node_mgxs "https://github.com/openmc-dev/openmc/blob/develop/openmc/mgxs/mgxs.py"
click node_data "https://github.com/openmc-dev/openmc/blob/develop/openmc/data/reaction.py"
click node_deplete "https://github.com/openmc-dev/openmc/blob/develop/openmc/deplete/abc.py"
click node_depleteoperator "https://github.com/openmc-dev/openmc/blob/develop/openmc/deplete/openmc_operator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_model,node_executor,node_native,node_settings,node_user toneBlue
class node_simulation,node_geometry,node_materials,node_crosssections,node_particle,node_physics,node_mesh toneAmber
class node_tallies,node_tallydata,node_statepoint toneMint
class node_mgxs,node_data toneRose
class node_deplete,node_depleteoperator toneIndigo
```

## Components

### Modeling and execution

- [Model API](https://github.com/openmc-dev/openmc/blob/develop/openmc/model/model.py): `openmc/model/model.py`
- [Run executor](https://github.com/openmc-dev/openmc/blob/develop/openmc/executor.py): `openmc/executor.py`
- [Native entry](https://github.com/openmc-dev/openmc/blob/develop/src/main.cpp): `src/main.cpp`
- [Run settings](https://github.com/openmc-dev/openmc/blob/develop/include/openmc/settings.h): `include/openmc/settings.h`

### Transport engine

- [Simulation state](https://github.com/openmc-dev/openmc/blob/develop/include/openmc/simulation.h): `include/openmc/simulation.h`
- [Geometry navigation](https://github.com/openmc-dev/openmc/blob/develop/src/geometry.cpp): `src/geometry.cpp`
- [Materials](https://github.com/openmc-dev/openmc/blob/develop/src/material.cpp): `src/material.cpp`
- [Cross sections](https://github.com/openmc-dev/openmc/blob/develop/src/cross_sections.cpp): `src/cross_sections.cpp`
- [Particle tracking](https://github.com/openmc-dev/openmc/blob/develop/src/particle.cpp): `src/particle.cpp`
- [Transport physics](https://github.com/openmc-dev/openmc/blob/develop/src/physics.cpp): `src/physics.cpp`
- [Mesh operations](https://github.com/openmc-dev/openmc/blob/develop/src/mesh.cpp): `src/mesh.cpp`

### Scoring and results

- [Tally scoring](https://github.com/openmc-dev/openmc/blob/develop/src/tallies/tally_scoring.cpp): `src/tallies/tally_scoring.cpp`
- [Tally results](https://github.com/openmc-dev/openmc/blob/develop/src/tallies/tally.cpp): `src/tallies/tally.cpp`
- [Statepoint output](https://github.com/openmc-dev/openmc/blob/develop/src/state_point.cpp): `src/state_point.cpp`

### Nuclear data analysis

- [Multi-group XS](https://github.com/openmc-dev/openmc/blob/develop/openmc/mgxs/mgxs.py): `openmc/mgxs/mgxs.py`
- [Nuclear data](https://github.com/openmc-dev/openmc/blob/develop/openmc/data/reaction.py): `openmc/data/reaction.py`

### Depletion

- [Depletion integrators](https://github.com/openmc-dev/openmc/blob/develop/openmc/deplete/abc.py): `openmc/deplete/abc.py`
- [Transport operator](https://github.com/openmc-dev/openmc/blob/develop/openmc/deplete/openmc_operator.py): `openmc/deplete/openmc_operator.py`

### Other components

- **Model user**

## Connections

- Model user → Model API: defines model
- Model API → Run executor: runs model (evidence: `openmc/model/model.py`)
- Run executor → Native entry: launches engine
- Native entry → Run settings: uses settings
- Simulation state → Geometry navigation: uses geometry
- Simulation state → Materials: uses materials
- Simulation state → Particle tracking: tracks particles
- Particle tracking → Transport physics: transports through
- Materials → Cross sections: uses data
- Simulation state → Mesh operations: uses meshes (evidence: `include/openmc/simulation.h`)
- Tally scoring → Tally results: scores into (evidence: `src/tallies/tally_scoring.cpp`)
- Tally results → Statepoint output: writes results
- Multi-group XS → Tally scoring: uses tallies (evidence: `openmc/mgxs/mgxs.py`)
- Multi-group XS → Nuclear data: uses nuclear data (evidence: `openmc/mgxs/mgxs.py`)
- Depletion integrators → Transport operator: uses operator (evidence: `openmc/deplete/abc.py`)
- Transport operator → Tally scoring: generates tallies
