Metadata-Version: 2.4
Name: yamc
Version: 0.28.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Dist: cadquery>=2.8.0 ; extra == 'all'
Requires-Dist: numpy ; extra == 'all'
Requires-Dist: h5py ; extra == 'all'
Requires-Dist: cadquery>=2.8.0 ; extra == 'cad'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: maturin>=1.14 ; extra == 'dev'
Requires-Dist: cadquery>=2.8.0 ; extra == 'dev'
Requires-Dist: numpy ; extra == 'dev'
Requires-Dist: matplotlib ; extra == 'dev'
Requires-Dist: tqdm ; extra == 'dev'
Requires-Dist: pyarrow ; extra == 'dev'
Requires-Dist: pandas>=2.2 ; extra == 'pandas'
Requires-Dist: polars>=0.20 ; extra == 'polars'
Requires-Dist: h5py ; extra == 'viz'
Requires-Dist: numpy ; extra == 'viz'
Requires-Dist: xarray ; extra == 'xarray'
Requires-Dist: pandas>=2.2 ; extra == 'xarray'
Provides-Extra: all
Provides-Extra: cad
Provides-Extra: dev
Provides-Extra: pandas
Provides-Extra: polars
Provides-Extra: viz
Provides-Extra: xarray
License-File: LICENSE-APACHE
License-File: THIRD-PARTY-LICENSES.html
Summary: Yet Another Monte Carlo: neutron and photon transport with mesh geometry support
Keywords: nuclear,monte-carlo,neutronics,transport,fusion,shielding
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://fusion-neutronics.github.io/yamc-and-yani/yamc/
Project-URL: Homepage, https://fusion-neutronics.github.io/yamc-and-yani/yamc/
Project-URL: Issues, https://github.com/fusion-neutronics/yamc-and-yani/issues
Project-URL: Repository, https://github.com/fusion-neutronics/yamc-and-yani

# YAMC

**Y**et **A**nother **M**onte **C**arlo. Geometry, materials and a neutron or
photon source in; fluxes, heating, tritium production, transmuted materials and
shutdown dose rates out.

[Try it online](https://fusion-neutronics.github.io/yamc-online/) 🌐 |
[Documentation](https://fusion-neutronics.github.io/yamc-and-yani/yamc/) 📝 |
[PyPI](https://pypi.org/project/yamc/) 🐍

The browser version needs no install and no account. It is the same Rust
transport engine compiled to WebAssembly, against the same continuous-energy
data. The simulation runs on your machine; nothing is uploaded.

```bash
pip install yamc
```

```python
import yamc

# pick a neutron data library, downloaded on demand
yamc.neutron_cross_section_data = "endf-b8.1"

# make your own or use inbuilt material definitions
steel = yamc.materials.pnnl.material("Steel, Stainless 316")
breeder = yamc.Material(
    composition={"Li": yamc.enriched(2.0, target="Li6", percent=60.0), "Si": 1.0, "O": 4.0},
    density=2.4,
)

# build the geometry from surfaces and cells
first_wall = yamc.Sphere(radius=100.0)
blanket = yamc.Sphere(radius=101.0)
outer = yamc.Sphere(radius=150.0, boundary="vacuum")
plasma_cell = yamc.Cell(region=first_wall.below)
wall_cell = yamc.Cell(region=first_wall.above & blanket.below, material=steel)
blanket_cell = yamc.Cell(region=blanket.above & outer.below, material=breeder)
geometry = yamc.Geometry([plasma_cell, wall_cell, blanket_cell])

# a 14.06 MeV D-T fusion neutron point source
source = yamc.NeutronSource(energy=14.06e6)

# score tritium production in the blanket and heating in each cell
tbr = yamc.Tally(scores=["H3-production"], cells=blanket_cell)
heating = yamc.Tally(scores=["heating"], cells=[wall_cell, blanket_cell])

# run on every CPU core until every tally bin passes its statistical checks
model = yamc.Model(geometry=geometry, source=source, tallies=[tbr, heating])
results = model.simulate_transport()

# every result carries its statistical uncertainty
print("TBR", results[tbr].mean, "+/-", results[tbr].standard_deviation)
print("heating", results[heating].mean, "eV per source neutron")
```

## What it solves

Continuous-energy neutron and photon transport over CSG, CAD or mesh geometry,
on CPU or GPU, with tallies, variance reduction, transport-coupled transmutation
and shutdown dose rates. The solver is Rust; the wheel needs no compiler and no
external toolchain.

## Transmutation without transport

If you already have a spectrum and do not need transport, install
[yani](https://fusion-neutronics.github.io/yamc-and-yani/yani/) instead. It uses the same
materials, schedules and nuclear data, without the geometry.

## Licence

Dual-licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
- MIT license ([LICENSE-MIT](LICENSE-MIT))

at your option.

