Skip to main content

A fast general purpose monte carlo particle simulator (photons, electrons and positrons). Written in Cython, Python and C++.

Project description

The first stable realease will be version 0.1.

MontyCarlo (v0.1a0.dev2)

license pyversion architecture os

MontyCarlo is a python framework for setting up simulations and/or developing applications whose basis is the simulation of particle transport. It simulates the propagation and effects of ionizing radiation (photons, electrons and positrons with energies between 1keV and 1GeV) in matter of homogeneous density, filling constructive solid geometry models.

As of yet, this is an unstable version. This is a thesis project and, as a student, I am still learning!

This work has a poster presentation in the 3rd European Congress of Medical Physics and has been presented in a workshop organized by the Faculty of Sciences of the University of Porto and the Ludwig Maximilian University of Munich.

Try it out!

See here for instructions on installing the latest release.

Once you've installed MontyCarlo, clone or download the following repository: https://github.com/RuiFilipeCampos/MyCo-EXAMPLE1

Inside this repository folder simply run:

python main.py

Have fun exploring high energy particle tracks in a 3d environment!

  • White tracks: Photons
  • Blue tracks: electrons
  • Red tracks: positrons

The innermost sphere contains water, the outer sphere contains air and the rest of space is filled with gold.

ex01

Be sure to zoom in on every detail!

ex02

Bugs

This is a very early version of a fairly large code. Bugs are guaranteed! Submitting an issue is a great way to contribute to the project at this stage!

Available Features:

  • Construction of any material via a stochiometric formula and density water = Mat({1:2, 8:1}, 1);
  • Constructed materials are automatically cached in the folder your_project\mat.
  • Only spheres are available. This will remain as such until all this has been thoroughly tested:
    • Constructive Solid Geometry (CSG) using the | & and - operators;
    • linear transformations on the volumes (translation and rotation);
    • bounding volume hierarchy (BVH) constructed with the aid of the user;
    • a syntatic indication of the BVH using with statements;
    • a new method of particle transport that greatly accelerates the simulation of electrons and positrons;
  • The volumes surfaces are rendered and cached in your_project/geo;
  • Three particles are available:
    • Photons (analogue simulation);
      • Compton Scattering;
      • Rayleigh Scattering;
      • Photoelectric Effect;
      • Pair Production;
      • Triplet Production;
    • Electrons (class II condensed history);
      • Elastic Scattering (atom is not affected): Angular Deflection + Bremstrahlung Production;
      • Inelastic Scattering (atom is affected): Interaction with an individual atom + with the condensed medium as a whole;
    • Positrons (class II condensed history);
      • Elastic Scattering (atom is not affected): Angular Deflection + Bremstrahlung Production;
      • Inelastic Scattering (atom is affected): Interaction with an individual atom + with the condensed medium as a whole;
      • Anihilation (positron meets electron);
  • The simulation is coupled (e.g. supports secondary particle creation)
  • Supports simulation of post-ionization relaxation effects;
  • Two particle sources are available:
    • Isotropic point source: emits particles from a point with randomized directions - IsotropicPoint
    • Directional point source: emits particles from a point towards a specified direction - Beam
  • Automated database download on first import;
  • 3d plotting of particle trajectories;
  • 3d plotting of the constructed geometry;
  • simultaneous plotting of both geometry and trajectories;
  • One tally is available:
    • Z_TALLY - calculates PDD's
  • Automatic generation of *.html output files (work in progress though)

Possible Future Work

  • Sources
  • Tallying
    • Energy Deposition (1d, 2d, 3d, 4d(spatial + temporal) )
    • Flux
    • Others
  • Variance reduction
  • Image Detectors
  • Extension to E < 1keV (for laser applications)
  • Extension to E > 1GeV (for thermonuclear applications)
  • Implementation of other particles
    • Protons
    • Neutrons
    • etc...
  • Dedicated graphics engine (w/sphere tracing)
  • An auto-cad like GUI for CSG modeling
  • Geant4 like API
  • GPU accelaration
  • CPU multiprocessing/multithreading
  • Advanced data vizualization (w/ ParaView)
  • Distributed Cloud Computing
  • Dedicated python notebook (like Jupyter)

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

MontyCarlo-0.1a0.dev2-cp39-cp39-win_amd64.whl (17.8 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

MontyCarlo-0.1a0.dev2-cp39-cp39-macosx_10_14_x86_64.whl (21.9 MB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

MontyCarlo-0.1a0.dev2-cp38-cp38-win_amd64.whl (16.3 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

MontyCarlo-0.1a0.dev2-cp38-cp38-macosx_10_14_x86_64.whl (21.8 MB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

MontyCarlo-0.1a0.dev2-cp37-cp37m-win_amd64.whl (17.7 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

MontyCarlo-0.1a0.dev2-cp37-cp37m-macosx_10_14_x86_64.whl (21.7 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

Supported by

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