-
Notifications
You must be signed in to change notification settings - Fork 16
Source Code
Rustbca includes doc comments. Documentation for the source code can be built using cargo docs --no-deps
and with the flag --all-features
if one wants to build documentation for HDF5 input or the CPR rootfinder.
Once built with cargo docs
, documentation can be found in target/docs/rustBCA/index.html
.
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, including the core physics loop. main()
contains the geometry match arms that take command line input.
input.rs
handles the processing of the toml-format input file and creates the Material and Particle array.
output.rs
includes the routines for creating output files, processing particles to produce, e.g., sputtered energy distributions, and printing the processed particle data to file.
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.
geometry.rs
contains the Geometry
and GeometryElement
traits and the Mesh0D
, Mesh1D
, and Mesh2D
structs and associated data structures and functions for handling inhomogeneous composition of materials.
sphere.rs
contains the implementation of the Geometry
trait for the Sphere geometry type.
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 geometry correctly handles distances and inside/outside checks on the various geometry types.
These hold simulation-wide enums, constants, and structs (such as Vector).