# Monte Carlo code

## Downloading

Version 3 of the Monte Carlo code can be downloaded here.

Just unzip the archive into a new folder and follow the instructions in `README.html`

.

## Description

Some of the things this code can do are:

- Calculate the free evolution of a magnetic atom in a magnetic field.
- Calculate a Monte-Carlo trajectory of a magnetic atom in a cell with a magnetic field present, subject to collisions from a background gas. The user can also perform the same calculation without a magnetic field.
- Make a histogram of the number of Monte-Carlo atoms having left a cell volume vs. time, for magnetic atoms in a cell, starting from a given distribution.
- Calculate a Monte-Carlo distribution of atoms after a specified number of collisions or after an amount of time, starting from a given distribution.

The calculations are performed by first generating a spatial and velocity distribution of dipoles. Each dipole then evolves by classical kinematics. The dipole evolves under the influence of a local magnetic field. After a time, randomly chosen from an exponential distribution, the dipole collides with a random buffer gas atom, with velocity randomly chosen from a Boltzmann distribution. The dipole then evolves under the magnetic field until its next collision. The evolution continues until either a fixed number of collisions has been reached, a set amount of time has passed, or the dipole leaves the geometry of interest.

## Help

For help with the code, please first see the code's `README.html`

file. If that fails, questions may be directed to Nathan Brahms.