Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7ddd574
Working parry3d::Ball example - runs with same input file as RustBCA'…
drobnyjt Mar 15, 2021
d64e19f
Working TriMesh input.
drobnyjt Mar 15, 2021
79b5882
Small fix to boron_nitride_trimesh.toml; updates to plotting routines.
drobnyjt Mar 15, 2021
8492970
Updates to boundary calculation - now uses bounding box.
drobnyjt Mar 16, 2021
cf70397
Final changes to core geometry with parry3d.
drobnyjt Mar 16, 2021
9f51c5d
Made sure to add new worfklow before i forget.
drobnyjt Mar 16, 2021
353c527
Acclerated vacuum transport was breaking the momentum conservation te…
drobnyjt Mar 16, 2021
4653945
Cargo.toml update to keep up with semantic versioning.
drobnyjt Mar 16, 2021
5e7852a
Added some tests of the parry3d geometry.
drobnyjt Mar 16, 2021
738e235
Updated workflow.
drobnyjt Mar 16, 2021
c71d10b
Merge pull request #118 from lcpp-org/parry3d
drobnyjt Mar 16, 2021
950c667
Add files via upload
drobnyjt Mar 16, 2021
3db7d02
Cleanup of some redundant traits.
drobnyjt Mar 19, 2021
a40e1bf
Merge pull request #120 from lcpp-org/trait_cleanup
drobnyjt Mar 19, 2021
0aa5c46
Removed nearest_to_* functions, and instead wrapped that functionalit…
drobnyjt Mar 19, 2021
ff05ef5
Ion acceleration outside of targets was not functioning correctly - f…
drobnyjt Mar 19, 2021
6a18951
Update rustbca_compile_check.yml
drobnyjt Mar 19, 2021
caac29c
Merge pull request #121 from lcpp-org/geometry_cleanup
drobnyjt Mar 19, 2021
1d655e2
Made sure progress bar always finishes, even for tiny simulations.
drobnyjt Mar 19, 2021
2f42ce2
Merge pull request #122 from lcpp-org/progress_bar_fix
drobnyjt Mar 19, 2021
da76aba
update
drobnyjt Mar 19, 2021
b0a899f
Added unneeded but necessary-to-compile options.
drobnyjt Mar 19, 2021
1c3a3f3
More files necessary for bindings to work.
drobnyjt Mar 19, 2021
01a8a00
Fixes for when built with distributions.
drobnyjt Mar 19, 2021
4ab8cfc
Workflow fix
drobnyjt Mar 19, 2021
666297e
Merge pull request #124 from lcpp-org/bindings
drobnyjt Mar 19, 2021
f2b7dc7
Added ability to run lists of energy-angle coords for simple_bca.
drobnyjt Mar 20, 2021
8d1d93f
Updates to bindings.
drobnyjt Mar 22, 2021
bd7dca1
Delete RustBCA.c
drobnyjt Mar 22, 2021
4831a46
Merge pull request #126 from lcpp-org/bindings_2
drobnyjt Mar 22, 2021
8511c65
First pass of library error messages.
drobnyjt Mar 23, 2021
01c9b7b
Merge pull request #129 from lcpp-org/library_error_messages
drobnyjt Mar 24, 2021
2811710
Added context to toml unpack that hints to the user they may have for…
drobnyjt Mar 26, 2021
5d81514
Progress bar .finish() call was not in the right place.
drobnyjt Mar 26, 2021
ea05921
Added C list version.
drobnyjt Mar 29, 2021
347bc24
Updates to C bindings.
drobnyjt Mar 29, 2021
7634de3
Fix to filter out stopped, non-incident ions.
drobnyjt Mar 30, 2021
1778359
Merge pull request #131 from lcpp-org/cxx_investigation
drobnyjt Mar 30, 2021
322aad7
Added package.py for spack compatibility.
drobnyjt Jun 11, 2021
bb36666
Minor updates to scripts.
drobnyjt Jul 22, 2021
e19a54f
Fix issuen #139
drobnyjt Jul 22, 2021
efc5d3b
Merge branch 'master' into dev
drobnyjt Jul 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/rustbca_compile_check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: rustBCA Compile check
name: RustBCA Compile check

on:
push:
Expand Down Expand Up @@ -37,15 +37,15 @@ jobs:
sudo apt install libhdf5-dev
- name: Test RustBCA
run: |
cargo test --features cpr_rootfinder_netlib,hdf5_input,distributions
cargo test --features cpr_rootfinder_netlib,hdf5_input,distributions,parry3d
- name: Run Examples
run: |
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
./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
./target/release/rustBCA examples/boron_nitride.toml
./target/release/rustBCA examples/layered_geometry.toml
./target/release/RustBCA examples/boron_nitride.toml
./target/release/RustBCA examples/layered_geometry.toml
cat 2000.0eV_0.0001deg_He_TiO2_Al_Sisummary.output
./target/release/rustBCA SPHERE examples/boron_nitride_sphere.toml

./target/release/RustBCA SPHERE examples/boron_nitride_sphere.toml
cargo run --release --features parry3d TRIMESH examples/tungsten_twist_trimesh.toml
18 changes: 15 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
[package]
name = "rustBCA"
version = "1.0.0"
name = "RustBCA"
version = "1.1.0"
authors = ["Jon Drobny <drobny2@illinois.edu>"]
edition = "2018"

[[bin]]
name="rustBCA"
name="RustBCA"

[lib]
name = "libRustBCA"
path = "src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
rand = "0.8.3"
Expand All @@ -22,6 +27,11 @@ netlib-src = {version = "0.8", optional = true}
intel-mkl-src = {version = "0.6.0", optional = true}
rcpr = { git = "https://github.com/drobnyjt/rcpr", optional = true}
ndarray = {version = "0.14.0", features = ["serde"], optional = true}
parry3d-f64 = {version = "0.2.0", optional = true}

[dependencies.pyo3]
version = "0.13.2"
features = ["extension-module"]

[dev-dependencies]
float-cmp = "0.8.0"
Expand All @@ -39,3 +49,5 @@ cpr_rootfinder_netlib = ["rcpr", "netlib-src"]
cpr_rootfinder_intel_mkl = ["rcpr", "intel-mkl-src"]
distributions = ["ndarray"]
no_list_output = []
parry3d = ["parry3d-f64"]
accelerated_ions = []
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include Cargo.toml
recursive-include src *
105 changes: 105 additions & 0 deletions RustBCA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>
#include <cmath>

static const double PI = M_PI;

static const double FRAC_2_SQRT_PI = M_2_PI;

static const double SQRT_2 = M_SQRT2;

///Fundamental charge in Coulombs.
static const double Q = 1.602176634e-19;

/// One electron-volt in Joules.
static const double EV = Q;

/// One atomic mass unit in kilograms.
static const double AMU = 1.66053906660e-27;

/// One Angstrom in meters.
static const double ANGSTROM = 1e-10;

/// One micron in meters.
static const double MICRON = 1e-6;

/// One nanometer in meters.
static const double NM = 1e-9;

/// One centimeter in meters.
static const double CM = 1e-2;

/// Vacuum permitivity in Farads/meter.
static const double EPS0 = 8.8541878128e-12;

/// Bohr radius in meters.
static const double A0 = 5.29177210903e-11;

/// Electron mass in kilograms.
static const double ME = 9.1093837015e-31;

/// sqrt(pi).
static const double SQRTPI = (2. / FRAC_2_SQRT_PI);

/// sqrt(2 * pi).
static const double SQRT2PI = ((2. * SQRT_2) / FRAC_2_SQRT_PI);

/// Speed of light in meters/second.
static const double C = 299792458.;

/// Bethe-Bloch electronic stopping prefactor, in SI units.
static const double BETHE_BLOCH_PREFACTOR = ((((((4. * PI) * ((Q * Q) / ((4. * PI) * EPS0))) * ((Q * Q) / ((4. * PI) * EPS0))) / ME) / C) / C);

/// Lindhard-Scharff electronic stopping prefactor, in SI units.
static const double LINDHARD_SCHARFF_PREFACTOR = (((1.212 * ANGSTROM) * ANGSTROM) * Q);

/// Lindhard reduced energy prefactor, in SI units.
static const double LINDHARD_REDUCED_ENERGY_PREFACTOR = ((((4. * PI) * EPS0) / Q) / Q);

struct OutputBCA {
uintptr_t len;
double (*particles)[9];
};

struct InputSimpleBCA {
uintptr_t len;
// vx vy vz [m/s]
double (*velocities)[3];
double Z1;
double m1;
double Ec1;
double Es1;
double Z2;
double m2;
double n2;
double Ec2;
double Es2;
double Eb2;
};

extern "C" {

OutputBCA simple_bca_list_c(InputSimpleBCA input);

OutputBCA simple_bca_c(double x,
double y,
double z,
double ux,
double uy,
double uz,
double E1,
double Z1,
double m1,
double Ec1,
double Es1,
double Z2,
double m2,
double Ec2,
double Es2,
double n2,
double Eb2);

} // extern "C"
Empty file added cbindgen.toml
Empty file.
Binary file added docs/triangular_mesh/castellated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/triangular_mesh/cube_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/triangular_mesh/mayavi_two_of_them.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/triangular_mesh/tungsten_twist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions examples/tungsten_tiles_trimesh.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[options]
name = "tungsten_tiles_"
track_trajectories = true
track_recoils = true
track_recoil_trajectories = true
write_buffer_size = 8000
weak_collision_order = 0
suppress_deep_recoils = false
high_energy_free_flight_paths = false
num_threads = 4
num_chunks = 5
use_hdf5 = false
electronic_stopping_mode = "LOW_ENERGY_NONLOCAL"
mean_free_path_model = "LIQUID"
interaction_potential = [["KR_C"]]
scattering_integral = [["MENDENHALL_WELLER"]]
root_finder = [[{"NEWTON"={max_iterations=100, tolerance=1E-3}}]]
track_displacements = false
track_energy_losses = false

[material_parameters]
energy_unit = "EV"
mass_unit = "AMU"
Eb = [ 3.0,]
Es = [ 8.79,]
Ec = [ 1.0,]
Z = [ 74 ]
m = [ 183.84 ]
interaction_index = [0]
surface_binding_model = {"PLANAR"={calculation="TARGET"}}
bulk_binding_model = "AVERAGE"

[particle_parameters]
length_unit = "1e-8"
energy_unit = "EV"
mass_unit = "AMU"
N = [ 10 ]
m = [ 4.008 ]
Z = [ 2 ]
E = [ 250.0 ]
Ec = [ 1.0 ]
Es = [ 0.0 ]
pos = [ [ 0.35, 1.0, 0.5,] ]
dir = [ [ 0.98, -0.3, 0.0,] ]
interaction_index = [ 0 ]

[geometry_input]
length_unit = "1e-8"
electronic_stopping_correction_factor = 1.0
densities = [60000]
vertices = [
[0.00000000, 0.00000000, 0.00000000],
[0.00000000, 0.00000000, 0.20000000],
[0.00000000, 0.00000000, 0.40000000],
[0.00000000, 0.00000000, 0.60000000],
[0.00000000, 0.00000000, 0.80000000],
[0.00000000, 0.00000000, 1.00000000],
[0.00000000, 1.00000000, 0.00000000],
[0.00000000, 1.00000000, 0.20000000],
[0.00000000, 1.00000000, 0.40000000],
[0.00000000, 1.00000000, 0.60000000],
[0.00000000, 1.00000000, 0.80000000],
[0.00000000, 1.00000000, 1.00000000],
[0.20000000, 0.55000000, 0.00000000],
[0.20000000, 0.55000000, 1.00000000],
[0.40000000, 0.20000000, 0.00000000],
[0.40000000, 0.20000000, 0.20000000],
[0.40000000, 0.20000000, 0.40000000],
[0.40000000, 0.20000000, 0.60000000],
[0.40000000, 0.20000000, 0.80000000],
[0.40000000, 0.20000000, 1.00000000],
[0.40000000, 1.00000000, 0.00000000],
[0.40000000, 1.00000000, 0.20000000],
[0.40000000, 1.00000000, 0.40000000],
[0.40000000, 1.00000000, 0.60000000],
[0.40000000, 1.00000000, 0.80000000],
[0.40000000, 1.00000000, 1.00000000],
[0.60000000, 0.20000000, 0.00000000],
[0.60000000, 0.20000000, 0.20000000],
[0.60000000, 0.20000000, 0.40000000],
[0.60000000, 0.20000000, 0.60000000],
[0.60000000, 0.20000000, 0.80000000],
[0.60000000, 0.20000000, 1.00000000],
[0.60000000, 1.00000000, 0.00000000],
[0.60000000, 1.00000000, 0.20000000],
[0.60000000, 1.00000000, 0.40000000],
[0.60000000, 1.00000000, 0.60000000],
[0.60000000, 1.00000000, 0.80000000],
[0.60000000, 1.00000000, 1.00000000],
[0.80000000, 0.55000000, 0.00000000],
[0.80000000, 0.55000000, 1.00000000],
[1.00000000, 0.00000000, 0.00000000],
[1.00000000, 0.00000000, 0.20000000],
[1.00000000, 0.00000000, 0.40000000],
[1.00000000, 0.00000000, 0.60000000],
[1.00000000, 0.00000000, 0.80000000],
[1.00000000, 0.00000000, 1.00000000],
[1.00000000, 1.00000000, 0.00000000],
[1.00000000, 1.00000000, 0.20000000],
[1.00000000, 1.00000000, 0.40000000],
[1.00000000, 1.00000000, 0.60000000],
[1.00000000, 1.00000000, 0.80000000],
[1.00000000, 1.00000000, 1.00000000],
]
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]]
52 changes: 52 additions & 0 deletions examples/tungsten_twist_trimesh.toml

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install rustbca
#
# You can edit this file again by typing:
#
# spack edit rustbca
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------

from spack import *


class Rustbca(Package):
"""FIXME: Put a proper description of your package here."""

# FIXME: Add a proper url for your package's homepage here.
homepage = "https://www.github.com/lcpp-org/RustBCA/wiki"
url = "https://github.com/lcpp-org/RustBCA/archive/refs/tags/v1.0.0.tar.gz"
git = "https://www.github.com/lcpp-org/RustBCA.git"

# FIXME: Add a list of GitHub accounts to
# notify when the package is updated.
# maintainers = ['github_user1', 'github_user2']

version('dev', branch='dev')
version('1.0.0', sha256='99dcac7c7a78e6cd17da63a0dcbb3c36bca523ffafbb0425128b0c971b1a6829')
depends_on('rust')

# FIXME: Add dependencies if required.
# depends_on('foo')

def install(self, spec, prefix):
cargo = which('cargo')
cargo('build', '--release', '--lib', '--target-dir', prefix)
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "setuptools-rust"]
11 changes: 11 additions & 0 deletions scripts/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
'Es': 1.5,
}

lithium = {
'symbol': 'Li',
'name': 'lithium',
'Z': 3,
'm': 6.941,
'Ec': 1.0,
'Es': 1.64,
'Eb': 0.0,
'n': 4.63E28
}

nitrogen = {
'symbol': 'N',
'name': 'nitrogen',
Expand Down
Loading