Skip to content

Bindings: Python

Jon Drobny edited this page Feb 1, 2022 · 55 revisions

Note: PyO3 May not build correctly on MacOS. See Issue #143

First, the Python bindings require the following Python3 modules to be installed:

  • setuptools_rust
  • testresources
  • And the Rust compiler, rustc, must be available on your system PATH.
  • On Windows machines, you may need to install the Visual Studio C++ development tools.

Running: python3 -m pip install .

Will compile RustBCA as a library, construct the Python bindings, and build a python module, libRustBCA.pybca, that can be immediately imported into any Python script:

import numpy as np
import matplotlib.pyplot as plt
from libRustBCA.pybca import simple_bca_py, simple_bca_list_py

...
particles_out = simple_bca_py(x, y, z, ux, uy, uz, E, Z1, M1, Ec1, Es1, Z2, M2, Ec2, Es2, n2, Eb2)

Parameters for Simple BCA (Py and C)

  • x, y, z: starting position in angstroms (Recommended: 0, 0, 0)
  • ux, uy, uz: initial direction
  • E: energy in eV
  • Z1: atomic number of incident ion
  • M1: atomic mass of incident ion (amu)
  • Ec1: cutoff energy of incident ion (eV)
  • Es1: surface binding energy of incident ion (eV)
  • Z2: atomic number of material
  • M2: atomic mass of material (amu)
  • Ec2: cutoff energy of material (eV)
  • Es2: surface binding energy of material (eV)
  • n2: number density of material (1/angstrom^3)
  • Eb2: bulk binding energy of material (eV)

Output format

The output of simple_bca_list_py is a list of output particles with the following parameters:

[[Z, m (amu), E (eV) x (Angstrom), y (Angstrom), z (Angstrom), ux, uy, uz], ...]

Note that this includes implanted particles (with E = 0), reflected particles, and sputtered particles.

Click Pages above to see all pages in the Wiki.

Start Here

Home page

Installation

Selected Benchmarks

Frequently Asked Questions

FAQ

This page is a work in progress.

Using the Standalone Code

Input Files

Output Files

Error Messages

Interaction Potentials

Standalone Code Examples

Layered Targets

2D Geometry

Spherical Geometry

3D Geometry

Gaseous Targets

Multiple Interaction Potentials

Output Histograms

Bindings

Python

C/C++

Fortran

Clone this wiki locally