Skip to content

Switch to parry2d #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open
8 changes: 4 additions & 4 deletions .github/workflows/rustbca_compile_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ jobs:
cargo run --release 0D examples/boron_nitride_0D.toml
./target/release/RustBCA 0D examples/titanium_dioxide_0D.toml
./target/release/RustBCA 1D examples/layered_geometry_1D.toml
cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
echo "layered geometry 1D:"; cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
./target/release/RustBCA examples/layered_geometry.toml
cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
echo "layered geometry 2D:"; cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
./target/release/RustBCA SPHERE examples/boron_nitride_sphere.toml
cargo run --release --features parry3d TRIMESH examples/tungsten_twist_trimesh.toml
./target/release/RustBCA examples/boron_nitride_wire.toml
cat boron_nitride_summary.output
echo "boron nitride 2D:"; cat boron_nitride_summary.output
./target/release/RustBCA HOMOGENEOUS2D examples/boron_nitride_wire_homogeneous.toml
cat boron_nitride_h_summary.output
echo "boron nitride 2D Homogeneous:"; cat boron_nitride_h_summary.output
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ default-run = "RustBCA"
authors = ["Jon Drobny <[email protected]>", "Jon Drobny <[email protected]>"]
edition = "2021"



[[bin]]
name = "RustBCA"
path = "src/main.rs"
Expand All @@ -28,6 +30,7 @@ hdf5 = {version = "0.7.1", optional = true}
rcpr = { git = "https://github.com/drobnyjt/rcpr", optional = true}
ndarray = {version = "0.14.0", features = ["serde"], optional = true}
parry3d-f64 = {optional = true, version="0.2.0"}
parry2d-f64 = {optional = false, version="0.17.0"}

[dependencies.pyo3]
version = "0.19.0"
Expand All @@ -41,7 +44,7 @@ float-cmp = "0.8.0"
lto = "fat"
codegen-units = 1
opt-level = 3
debug = false
debug = 1

[features]
hdf5_input = ["hdf5"]
Expand Down
32 changes: 12 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ By discretizing the collision cascade into a sequence of binary collisions,
between an energetic ion and a target material. This includes reflection,
implantation, and transmission of the incident ion, as well as sputtering
and displacement damage of the target. Generally, [BCA] codes can be
valid for incident ion energies between approximately ~1 eV/nucleon
valid for incident ion energies between approximately ~1 eV/nucleon
to <1 GeV/nucleon. Improvements to RustBCA have expanded the regime
of validity for some quantities, such as reflection coefficients, below
of validity for some quantities, such as reflection coefficients, below
1 eV/nucleon.

Check out the `RustBCA` [Wiki] for detailed information, installation
Expand Down Expand Up @@ -160,7 +160,7 @@ Windows, MacOS, and Linux systems.
* [rcpr], a CPR and polynomial rootfinder, required for using attractive-repulsive interaction potentials such as Lennard-Jones or Morse.
* For manipulating input files and running associated scripts, the following are required:
* [Python] 3.6+
* The [Python] libraries: `numpy`, `matplotlib`, `toml` (must build from source), `shapely`, and `scipy`.
* The [Python] libraries: `numpy`, `matplotlib`, `toml`, `shapely`, and `scipy`.

### Detailed instructions for Ubuntu 18.04 LTS

Expand All @@ -187,36 +187,28 @@ git clone https://github.com/uiri/toml.git
cd toml
python3 setup.py install
```
7. (Optional) Install software for [rcpr]:
```bash
sudo apt-get install gcc gfortran build-essential cmake liblapack-dev libblas-dev liblapacke-dev
```
8. (Optional - should come with rustup) Install `cargo`:
7. (Optional - should come with rustup) Install `cargo`:
```bash
sudo apt-get install cargo
```
9. Build `RustBCA`:
8. Build `RustBCA`:
```bash
git clone https://github.com/lcpp-org/rustBCA
cd RustBCA
cargo build --release
```
10. (Optional) Build `RustBCA` with optional dependencies, `hdf5` and/or `rcpr` (with your choice of backend: `openblas`, `netlib`, or `intel-mkl`):
9. (Optional) Build `RustBCA` with optional dependencies, `hdf5` and/or `rcpr`:
```bash
cargo build --release --features cpr_rootfinder_netlib,hdf5_input
cargo build --release --features cpr_rootfinder_openblas,hdf5_input
cargo build --release --features cpr_rootfinder_intel_mkl,hdf5_input
cargo build --release --features cpr_rootfinder,hdf5_input
```
11. `input.toml` is the input file - see [Usage](https://github.com/lcpp-org/RustBCA/wiki/Usage,-Input-File,-and-Output-Files) for more information
12. Run the required tests using:
10. `input.toml` is the input file - see [Usage](https://github.com/lcpp-org/RustBCA/wiki/Usage,-Input-File,-and-Output-Files) for more information
11. Run the required tests using:
```bash
cargo test
```
13. (Optional) Run the required and optional tests for the desired backend(s):
12. (Optional) Run the required and optional tests for the desired backend(s):
```bash
cargo test --features cpr_rootfinder_netlib
cargo test --features cpr_rootfinder_openblas
cargo test --features cpr_rootfinder_intel_mkl
cargo test --features cpr_rootfinder
```

### Detailed instructions for Fedora 33
Expand Down Expand Up @@ -275,7 +267,7 @@ command line argument.
./RustBCA /path/to/input.toml
```

Additionally, `RustBCA` accepts an input file type (one of: `0D`, `1D`, `2D`, `TRIMESH`, `SPHERE` - see the wiki for more details):
Additionally, `RustBCA` accepts an input file type (one of: `0D`, `1D`, `2D`, `TRIMESH`, `SPHERE`, `HOMOGENEOUS2D` - see the wiki for more details):
```bash
./RustBCA 0D /path/to/input.toml
```
Expand Down
2 changes: 1 addition & 1 deletion examples/boron_nitride_wire_homogeneous.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Use with 0D geometry option only
#Use with HOMOGENEOUS geometry option only
[options]
name = "boron_nitride_h_"
weak_collision_order = 0
Expand Down
5 changes: 3 additions & 2 deletions examples/layered_geometry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Use with 2D geometry option only
[options]
name = "2000.0eV_0.0001deg_He_TiO2_Al_Si"
track_trajectories = false
track_trajectories = true
track_recoils = true
track_recoil_trajectories = false
write_buffer_size = 8000
Expand Down Expand Up @@ -54,7 +54,8 @@ points = [[0.0, -0.5], [0.01, -0.5], [0.04, -0.5], [0.5, -0.5], [0.5, 0.5], [0.0
triangles = [[0, 1, 6], [0, 6, 7], [1, 2, 5], [1, 5, 6], [2, 3, 4], [2, 4, 5]]
densities = [ [ 3.0e+10, 6.0e+10, 0.0, 0.0,], [ 3.0e+10, 6.0e+10, 0.0, 0.0,], [ 0.0, 0.0, 6.026e+10, 0.0,], [ 0.0, 0.0, 6.026e+10, 0.0,], [ 0.0, 0.0, 0.0, 4.996e+10,], [ 0.0, 0.0, 0.0, 4.996e+10,],]
boundary = [0, 3, 4, 7]
simulation_boundary_points = [ [ 0.6, -0.6,], [ -0.1, -0.6,], [ -0.1, 0.6,], [ 0.6, 0.6,], [ 0.6, -0.6,],]
#simulation_boundary_points = [ [ 0.6, -0.6,], [ -0.1, -0.6,], [ -0.1, 0.6,], [ 0.6, 0.6,],]
simulation_boundary_points = [[0.6, 0.6], [-0.1, 0.6], [-0.1, -0.6], [0.6, -0.6]]
electronic_stopping_correction_factors = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
energy_barrier_thickness = 2.2E-4

Expand Down
2 changes: 1 addition & 1 deletion examples/multiple_interaction_potentials.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ length_unit = "MICRON"
triangles = [ [ 0.0, 0.01, 0.0, 0.5, 0.5, -0.5,], [ 0.0, 0.01, 0.01, -0.5, 0.5, -0.5,], [ 0.01, 0.01, 0.04, -0.5, 0.5, -0.5,], [ 0.01, 0.04, 0.04, 0.5, 0.5, -0.5,], [ 0.04, 0.5, 0.04, 0.5, 0.5, -0.5,], [ 0.04, 0.5, 0.5, -0.5, 0.5, -0.5,],]
densities = [ [ 3.0e+10, 6.0e+10, 0.0, 0.0,], [ 3.0e+10, 6.0e+10, 0.0, 0.0,], [ 0.0, 0.0, 6.026e+10, 0.0,], [ 0.0, 0.0, 6.026e+10, 0.0,], [ 0.0, 0.0, 0.0, 4.996e+10,], [ 0.0, 0.0, 0.0, 4.996e+10,],]
material_boundary_points = [ [ 0.0, 0.5,], [ 0.5, 0.5,], [ 0.5, -0.5,], [ 0.0, -0.5,],]
simulation_boundary_points = [ [ 0.6, -0.6,], [ -0.1, -0.6,], [ -0.1, 0.6,], [ 0.6, 0.6,], [ 0.6, -0.6,],]
simulation_boundary_points = [ [ 0.6, -0.6,], [ -0.1, -0.6,], [ -0.1, 0.6,], [ 0.6, 0.6,],]
electronic_stopping_correction_factors = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

[material_parameters]
Expand Down
4 changes: 2 additions & 2 deletions src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ use super::*;
pub enum MaterialType {
MESH0D(material::Material<geometry::Mesh0D>),
MESH1D(material::Material<geometry::Mesh1D>),
MESH2D(material::Material<geometry::Mesh2D>),
MESH2D(material::Material<geometry::ParryMesh2D>),
SPHERE(material::Material<sphere::Sphere>),
#[cfg(feature = "parry3d")]
BALL(material::Material<parry::ParryBall>),
#[cfg(feature = "parry3d")]
TRIMESH(material::Material<parry::ParryTriMesh>),
HOMOGENEOUS2D(material::Material<geometry::HomogeneousMesh2D>)
HOMOGENEOUS2D(material::Material<geometry::ParryHomogeneousMesh2D>)
}

#[derive(Deserialize, PartialEq, Clone, Copy)]
Expand Down
Loading