Skip to content

Commit 326c6d4

Browse files
authored
Merge pull request #140 from lcpp-org/dev
Merge development branch towards RustBCA 1.1.0
2 parents 1c4e230 + efc5d3b commit 326c6d4

31 files changed

+6437
-4950
lines changed

.github/workflows/rustbca_compile_check.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: rustBCA Compile check
1+
name: RustBCA Compile check
22

33
on:
44
push:
@@ -37,15 +37,15 @@ jobs:
3737
sudo apt install libhdf5-dev
3838
- name: Test RustBCA
3939
run: |
40-
cargo test --features cpr_rootfinder_netlib,hdf5_input,distributions
40+
cargo test --features cpr_rootfinder_netlib,hdf5_input,distributions,parry3d
4141
- name: Run Examples
4242
run: |
4343
cargo run --release 0D examples/boron_nitride_0D.toml
44-
./target/release/rustBCA 0D examples/titanium_dioxide_0D.toml
45-
./target/release/rustBCA 1D examples/layered_geometry_1D.toml
44+
./target/release/RustBCA 0D examples/titanium_dioxide_0D.toml
45+
./target/release/RustBCA 1D examples/layered_geometry_1D.toml
4646
cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
47-
./target/release/rustBCA examples/boron_nitride.toml
48-
./target/release/rustBCA examples/layered_geometry.toml
47+
./target/release/RustBCA examples/boron_nitride.toml
48+
./target/release/RustBCA examples/layered_geometry.toml
4949
cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
50-
./target/release/rustBCA SPHERE examples/boron_nitride_sphere.toml
51-
50+
./target/release/RustBCA SPHERE examples/boron_nitride_sphere.toml
51+
cargo run --release --features parry3d TRIMESH examples/tungsten_twist_trimesh.toml

Cargo.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
[package]
2-
name = "rustBCA"
3-
version = "1.0.0"
2+
name = "RustBCA"
3+
version = "1.1.0"
44
authors = ["Jon Drobny <drobny2@illinois.edu>"]
55
edition = "2018"
66

77
[[bin]]
8-
name="rustBCA"
8+
name="RustBCA"
9+
10+
[lib]
11+
name = "libRustBCA"
12+
path = "src/lib.rs"
13+
crate-type = ["cdylib"]
914

1015
[dependencies]
1116
rand = "0.8.3"
@@ -22,6 +27,11 @@ netlib-src = {version = "0.8", optional = true}
2227
intel-mkl-src = {version = "0.6.0", optional = true}
2328
rcpr = { git = "https://github.com/drobnyjt/rcpr", optional = true}
2429
ndarray = {version = "0.14.0", features = ["serde"], optional = true}
30+
parry3d-f64 = {version = "0.2.0", optional = true}
31+
32+
[dependencies.pyo3]
33+
version = "0.13.2"
34+
features = ["extension-module"]
2535

2636
[dev-dependencies]
2737
float-cmp = "0.8.0"
@@ -39,3 +49,5 @@ cpr_rootfinder_netlib = ["rcpr", "netlib-src"]
3949
cpr_rootfinder_intel_mkl = ["rcpr", "intel-mkl-src"]
4050
distributions = ["ndarray"]
4151
no_list_output = []
52+
parry3d = ["parry3d-f64"]
53+
accelerated_ions = []

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include Cargo.toml
2+
recursive-include src *

RustBCA.h

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#include <cstdarg>
2+
#include <cstdint>
3+
#include <cstdlib>
4+
#include <ostream>
5+
#include <new>
6+
#include <cmath>
7+
8+
static const double PI = M_PI;
9+
10+
static const double FRAC_2_SQRT_PI = M_2_PI;
11+
12+
static const double SQRT_2 = M_SQRT2;
13+
14+
///Fundamental charge in Coulombs.
15+
static const double Q = 1.602176634e-19;
16+
17+
/// One electron-volt in Joules.
18+
static const double EV = Q;
19+
20+
/// One atomic mass unit in kilograms.
21+
static const double AMU = 1.66053906660e-27;
22+
23+
/// One Angstrom in meters.
24+
static const double ANGSTROM = 1e-10;
25+
26+
/// One micron in meters.
27+
static const double MICRON = 1e-6;
28+
29+
/// One nanometer in meters.
30+
static const double NM = 1e-9;
31+
32+
/// One centimeter in meters.
33+
static const double CM = 1e-2;
34+
35+
/// Vacuum permitivity in Farads/meter.
36+
static const double EPS0 = 8.8541878128e-12;
37+
38+
/// Bohr radius in meters.
39+
static const double A0 = 5.29177210903e-11;
40+
41+
/// Electron mass in kilograms.
42+
static const double ME = 9.1093837015e-31;
43+
44+
/// sqrt(pi).
45+
static const double SQRTPI = (2. / FRAC_2_SQRT_PI);
46+
47+
/// sqrt(2 * pi).
48+
static const double SQRT2PI = ((2. * SQRT_2) / FRAC_2_SQRT_PI);
49+
50+
/// Speed of light in meters/second.
51+
static const double C = 299792458.;
52+
53+
/// Bethe-Bloch electronic stopping prefactor, in SI units.
54+
static const double BETHE_BLOCH_PREFACTOR = ((((((4. * PI) * ((Q * Q) / ((4. * PI) * EPS0))) * ((Q * Q) / ((4. * PI) * EPS0))) / ME) / C) / C);
55+
56+
/// Lindhard-Scharff electronic stopping prefactor, in SI units.
57+
static const double LINDHARD_SCHARFF_PREFACTOR = (((1.212 * ANGSTROM) * ANGSTROM) * Q);
58+
59+
/// Lindhard reduced energy prefactor, in SI units.
60+
static const double LINDHARD_REDUCED_ENERGY_PREFACTOR = ((((4. * PI) * EPS0) / Q) / Q);
61+
62+
struct OutputBCA {
63+
uintptr_t len;
64+
double (*particles)[9];
65+
};
66+
67+
struct InputSimpleBCA {
68+
uintptr_t len;
69+
// vx vy vz [m/s]
70+
double (*velocities)[3];
71+
double Z1;
72+
double m1;
73+
double Ec1;
74+
double Es1;
75+
double Z2;
76+
double m2;
77+
double n2;
78+
double Ec2;
79+
double Es2;
80+
double Eb2;
81+
};
82+
83+
extern "C" {
84+
85+
OutputBCA simple_bca_list_c(InputSimpleBCA input);
86+
87+
OutputBCA simple_bca_c(double x,
88+
double y,
89+
double z,
90+
double ux,
91+
double uy,
92+
double uz,
93+
double E1,
94+
double Z1,
95+
double m1,
96+
double Ec1,
97+
double Es1,
98+
double Z2,
99+
double m2,
100+
double Ec2,
101+
double Es2,
102+
double n2,
103+
double Eb2);
104+
105+
} // extern "C"

cbindgen.toml

Whitespace-only changes.
68.5 KB
Loading

docs/triangular_mesh/cube_2.png

97.9 KB
Loading
206 KB
Loading
108 KB
Loading
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
[options]
2+
name = "tungsten_tiles_"
3+
track_trajectories = true
4+
track_recoils = true
5+
track_recoil_trajectories = true
6+
write_buffer_size = 8000
7+
weak_collision_order = 0
8+
suppress_deep_recoils = false
9+
high_energy_free_flight_paths = false
10+
num_threads = 4
11+
num_chunks = 5
12+
use_hdf5 = false
13+
electronic_stopping_mode = "LOW_ENERGY_NONLOCAL"
14+
mean_free_path_model = "LIQUID"
15+
interaction_potential = [["KR_C"]]
16+
scattering_integral = [["MENDENHALL_WELLER"]]
17+
root_finder = [[{"NEWTON"={max_iterations=100, tolerance=1E-3}}]]
18+
track_displacements = false
19+
track_energy_losses = false
20+
21+
[material_parameters]
22+
energy_unit = "EV"
23+
mass_unit = "AMU"
24+
Eb = [ 3.0,]
25+
Es = [ 8.79,]
26+
Ec = [ 1.0,]
27+
Z = [ 74 ]
28+
m = [ 183.84 ]
29+
interaction_index = [0]
30+
surface_binding_model = {"PLANAR"={calculation="TARGET"}}
31+
bulk_binding_model = "AVERAGE"
32+
33+
[particle_parameters]
34+
length_unit = "1e-8"
35+
energy_unit = "EV"
36+
mass_unit = "AMU"
37+
N = [ 10 ]
38+
m = [ 4.008 ]
39+
Z = [ 2 ]
40+
E = [ 250.0 ]
41+
Ec = [ 1.0 ]
42+
Es = [ 0.0 ]
43+
pos = [ [ 0.35, 1.0, 0.5,] ]
44+
dir = [ [ 0.98, -0.3, 0.0,] ]
45+
interaction_index = [ 0 ]
46+
47+
[geometry_input]
48+
length_unit = "1e-8"
49+
electronic_stopping_correction_factor = 1.0
50+
densities = [60000]
51+
vertices = [
52+
[0.00000000, 0.00000000, 0.00000000],
53+
[0.00000000, 0.00000000, 0.20000000],
54+
[0.00000000, 0.00000000, 0.40000000],
55+
[0.00000000, 0.00000000, 0.60000000],
56+
[0.00000000, 0.00000000, 0.80000000],
57+
[0.00000000, 0.00000000, 1.00000000],
58+
[0.00000000, 1.00000000, 0.00000000],
59+
[0.00000000, 1.00000000, 0.20000000],
60+
[0.00000000, 1.00000000, 0.40000000],
61+
[0.00000000, 1.00000000, 0.60000000],
62+
[0.00000000, 1.00000000, 0.80000000],
63+
[0.00000000, 1.00000000, 1.00000000],
64+
[0.20000000, 0.55000000, 0.00000000],
65+
[0.20000000, 0.55000000, 1.00000000],
66+
[0.40000000, 0.20000000, 0.00000000],
67+
[0.40000000, 0.20000000, 0.20000000],
68+
[0.40000000, 0.20000000, 0.40000000],
69+
[0.40000000, 0.20000000, 0.60000000],
70+
[0.40000000, 0.20000000, 0.80000000],
71+
[0.40000000, 0.20000000, 1.00000000],
72+
[0.40000000, 1.00000000, 0.00000000],
73+
[0.40000000, 1.00000000, 0.20000000],
74+
[0.40000000, 1.00000000, 0.40000000],
75+
[0.40000000, 1.00000000, 0.60000000],
76+
[0.40000000, 1.00000000, 0.80000000],
77+
[0.40000000, 1.00000000, 1.00000000],
78+
[0.60000000, 0.20000000, 0.00000000],
79+
[0.60000000, 0.20000000, 0.20000000],
80+
[0.60000000, 0.20000000, 0.40000000],
81+
[0.60000000, 0.20000000, 0.60000000],
82+
[0.60000000, 0.20000000, 0.80000000],
83+
[0.60000000, 0.20000000, 1.00000000],
84+
[0.60000000, 1.00000000, 0.00000000],
85+
[0.60000000, 1.00000000, 0.20000000],
86+
[0.60000000, 1.00000000, 0.40000000],
87+
[0.60000000, 1.00000000, 0.60000000],
88+
[0.60000000, 1.00000000, 0.80000000],
89+
[0.60000000, 1.00000000, 1.00000000],
90+
[0.80000000, 0.55000000, 0.00000000],
91+
[0.80000000, 0.55000000, 1.00000000],
92+
[1.00000000, 0.00000000, 0.00000000],
93+
[1.00000000, 0.00000000, 0.20000000],
94+
[1.00000000, 0.00000000, 0.40000000],
95+
[1.00000000, 0.00000000, 0.60000000],
96+
[1.00000000, 0.00000000, 0.80000000],
97+
[1.00000000, 0.00000000, 1.00000000],
98+
[1.00000000, 1.00000000, 0.00000000],
99+
[1.00000000, 1.00000000, 0.20000000],
100+
[1.00000000, 1.00000000, 0.40000000],
101+
[1.00000000, 1.00000000, 0.60000000],
102+
[1.00000000, 1.00000000, 0.80000000],
103+
[1.00000000, 1.00000000, 1.00000000],
104+
]
105+
indices = [[0, 14, 12], [26, 40, 38], [46, 32, 38], [20, 6, 12], [0, 40, 14], [6, 0, 12], [40, 46, 38], [40, 26, 14], [32, 26, 38], [14, 20, 12], [1, 0, 40], [1, 40, 41], [2, 1, 41], [2, 41, 42], [3, 2, 42], [3, 42, 43], [4, 3, 43], [4, 43, 44], [5, 4, 44], [5, 44, 45], [41, 40, 46], [41, 46, 47], [42, 41, 47], [42, 47, 48], [43, 42, 48], [43, 48, 49], [44, 43, 49], [44, 49, 50], [45, 44, 50], [45, 50, 51], [47, 46, 32], [47, 32, 33], [48, 47, 33], [48, 33, 34], [49, 48, 34], [49, 34, 35], [50, 49, 35], [50, 35, 36], [51, 50, 36], [51, 36, 37], [33, 32, 26], [33, 26, 27], [34, 33, 27], [34, 27, 28], [35, 34, 28], [35, 28, 29], [36, 35, 29], [36, 29, 30], [37, 36, 30], [37, 30, 31], [27, 26, 15], [26, 14, 15], [28, 27, 16], [27, 15, 16], [29, 28, 17], [28, 16, 17], [30, 29, 18], [29, 17, 18], [31, 30, 19], [30, 18, 19], [15, 14, 20], [15, 20, 21], [16, 15, 21], [16, 21, 22], [17, 16, 22], [17, 22, 23], [18, 17, 23], [18, 23, 24], [19, 18, 24], [19, 24, 25], [21, 20, 6], [21, 6, 7], [22, 21, 7], [22, 7, 8], [23, 22, 8], [23, 8, 9], [24, 23, 9], [24, 9, 10], [25, 24, 10], [25, 10, 11], [7, 6, 0], [7, 0, 1], [8, 7, 1], [8, 1, 2], [9, 8, 2], [9, 2, 3], [10, 9, 3], [10, 3, 4], [11, 10, 4], [11, 4, 5], [5, 19, 13], [31, 45, 39], [51, 37, 39], [25, 11, 13], [5, 45, 19], [11, 5, 13], [45, 51, 39], [45, 31, 19], [37, 31, 39], [19, 25, 13]]

0 commit comments

Comments
 (0)