Skip to main content

Material builder for Monte Carlo simulations

Project description

Materials for MC

Make materials for use in neutronics workflows.

🦀Rust back end for speed 🐍Python API for ease of use 🕸️WASM API for online deployment

General features:

  • Build Nuclides
    • Get microscopic cross sections
  • Build up Materials
    • Set densities
    • Add nuclides
    • Add elements
    • Get macroscopic cross sections
  • Set the nuclear data paths
    • Per nuclide, material or globally
    • Using local JSON files
    • On the fly downloading
    • Caches nuclides to avoid duplicate reading

Features speciffically for usage Monte Carlo Tranport

  • Get unified energy grid for material
  • Calculate MT reactions cross sections at specified energy
  • Calculate total macroscopic cross section
  • Calculate mean free path

User install

Install as a Python package if you want to use the package with your own Python code

pip install materials_for_mc

Install the Rust crate if you want to use the package with your own Rust code

cargo install materials_for_mc

Developer install

Depending on your usage you may need to Rust, Python

git clone git@github.com:fusion-neutronics/materials_for_mc.git
cd materials_for_mc

Example python usage

python3.11 -m venv .materials_for_mc_env

source .materials_for_mc_env/bin/activate

pip install maturin

maturin develop --features pyo3

python examples/use_in_python.py

Example rust usage

cargo build
cd example_use
cargo build
cargo run

WebAssembly Support

The package can be compiled to WebAssembly for use in web browsers:

to test the wasm bindings

wasm-pack test --headless --firefox
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack build --target web --features wasm
cp -r pkg examples/wasm/
# Serve the demo pages locally
python -m http.server 8000
# Open the demo pages in your browser, I use firefox here but others should also work.
firefox http://localhost:8000/examples/wasm/reaction_plotter.html

The WebAssembly demos include:

  • Material creation and manipulation
  • Cross section calculation and visualization
  • Predefined materials
  • Interactive plotting with Plotly

Testing

Tests are present for both the core Rust code and the Python wrapper

cargo test
pytest

WebAssembly (WASM) Testing

To run tests for the WASM bindings, you must enable the optional wasm-test feature and use a browser (e.g., Firefox):

cargo test --features wasm-test
wasm-pack test --headless --firefox --features wasm-test

This ensures that WASM-specific tests and dependencies are only included when needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

materials_for_mc-0.1.0-cp311-cp311-win_amd64.whl (373.6 kB view details)

Uploaded CPython 3.11Windows x86-64

materials_for_mc-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (484.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

materials_for_mc-0.1.0-cp310-cp310-win_amd64.whl (373.6 kB view details)

Uploaded CPython 3.10Windows x86-64

materials_for_mc-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (484.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

materials_for_mc-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (537.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file materials_for_mc-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for materials_for_mc-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3192ade1c7c97f89b984b9d50cbc7ed3fee4ca48f1b1c9b87ad2f1d9aa74db55
MD5 999c83eda76354f17aa8a3157e28b117
BLAKE2b-256 aa030294ef2e64ab2d946d611d67a8ef18b0ab3199464a7a3e0f3ba9376a915b

See more details on using hashes here.

Provenance

The following attestation bundles were made for materials_for_mc-0.1.0-cp311-cp311-win_amd64.whl:

Publisher: ci-python.yml on fusion-neutronics/materials_for_mc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file materials_for_mc-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for materials_for_mc-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 508455e6abef556e4cdce54b5277fa12d5ace9a897cf402e7d98197063b5aad3
MD5 f722edbc0d3764280fae86b50f744d3f
BLAKE2b-256 a429cd9e8f2eb634985e8a169905270bdccf9145807957de29d1bf5232db25ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for materials_for_mc-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: ci-python.yml on fusion-neutronics/materials_for_mc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file materials_for_mc-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for materials_for_mc-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8eb1c661a02eff3cb587656f90acd945923497df0ec37a714be7dad646919322
MD5 234a94538cb538c29bd8dd4dae2c819b
BLAKE2b-256 79c9fac788fe0848638051fdb0158f8759d445bfe9f4a93d784b93ac9f5ae3b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for materials_for_mc-0.1.0-cp310-cp310-win_amd64.whl:

Publisher: ci-python.yml on fusion-neutronics/materials_for_mc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file materials_for_mc-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for materials_for_mc-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fe1eee78f67890caa0a6d8ecefb2e519fed1ba98d0cfec3dd27a7ad4a9e121e
MD5 35ba76d416e5b344ae692289370d28a6
BLAKE2b-256 9999b9d6bbe04549d7f12d76160780f21ffb4e4b79119fa0ecfd85be0789f64a

See more details on using hashes here.

Provenance

The following attestation bundles were made for materials_for_mc-0.1.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: ci-python.yml on fusion-neutronics/materials_for_mc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file materials_for_mc-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for materials_for_mc-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 df7c3b27ec5987c16b426932693387deecd79ec7e21264fb3a1d869f630dbd60
MD5 35ebf971d873981c7e75147e1ca0816a
BLAKE2b-256 e4b64b86bded62b5b378a7b5411ab425f9ac527d0f7d0f397ca9c2a74882169a

See more details on using hashes here.

Provenance

The following attestation bundles were made for materials_for_mc-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci-python.yml on fusion-neutronics/materials_for_mc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page