-
Notifications
You must be signed in to change notification settings - Fork 17
Source Code
RustBCA is structured, wherever possible, to enhance readability, especially compared to legacy codes that precede it. It is broken up into several modules: main.rs,
particle.rs
, material.rs
, mesh.rs
, bca.rs
, interactions.rs
, and tests.rs
. Each of these modules is relatively self contained. Functions that can fail use the anyhow crate to return Result
s, so that error handling is precise and explanatory.
main.rs
includes the core code loop, I/O, error handling on input (e.g., making sure that incompatible interaction potentials and root-finders are not used together), constants and imports, enums for controlling various code options, and the data structures Vector
and Vector4
.
particle.rs
includes the Particle
struct, used for tracking ions and atoms in the code. Functions for rotation, advancement in space, and refraction of particles at material surfaces are also included.
material.rs
contains the Material
struct and associated functions. Material includes methods for determining the electronic stopping power, pulling information from the mesh, and determining whether points are inside or outside of the material.
mesh.rs
contains the Mesh2D
struct and associated data structures and functions for handling inhomogeneous composition of materials.
bca.rs
contains the main BCA algorithms that involve both particles and materials, including distance of closest approach rootfinding calculation, and scattering angle determination.
interactions.rs
contains the interatomic potentials used in the code, the distance of closest approach functions, polynomial solver helper functions, scaling functions, and various screening lengths associated with the interatomic potentials in the code.
tests.rs
contains all testing routines, including both unit tests and integration tests. Writing tests for rustbca is a work in progress. Currently, the code checks that momentum is conserved during an entire BCA step, that the numerical quadratures agree with one another, that the distance of closest approach algorithms agree with one another, and that the mesh correctly handles distances and inside/outside checks on the mesh.
Click Pages above to see all pages in the Wiki.
This page is a work in progress.