Closed crivaronicolini closed 1 year ago
Hi @crivaronicolini! Quick clarifying question: are you referring to the Python bindings (compound_bca_list_py, simple_bca_list_py, simple_bca_py) or to the Python scripts for generating input files for use with the standalone code?
Hi! Thanks for the quick answer. Yes I mean the python bindings, in particular, the examples/test_rustbca.py file. Which one of the ways you mention is the recommended way of running the program?
Gotcha - so right now, all of the bindings only implement the "0D" composition model, so there's no way to set up a layered target at present. The bindings are really intended for code-coupling; the recommended way to use the code for all other use cases is the standalone version, where .toml input files (e.g., RustBCA/examples/layered_geometry_1D.toml) are given to the executable. The Python bindings are noticeably slower than running the standalone code, mostly (but not entirely) because you lose multithreading.
I don't think it would be terribly difficult to add that feature, it just hasn't come up yet. The bindings in general could use an ergonomics pass, but I've been reluctant to since it would break compatibility... I'll open an issue later this morning to add a layered target version of the python bindings, and hopefully it will also be easier to use than the existing versions.
Issue opened. I don't have an exact timeline for it, but I'll try to find the time to work on this issue in the next 1-2 weeks.
Hi @crivaronicolini, I've added a new function to the Python bindings that includes a layered, 1D target.
In test_rustbca.py, starting from this line, is an example of its usage. You can also call help on the function:
>>> from libRustBCA.pybca import *
>>> help(compound_bca_list_1D_py)
Help on built-in function compound_bca_list_1D_py in module libRustBCA.pybca:
compound_bca_list_1D_py(...)
compound_bca_list_1D_py(ux, uy, uz, energies, Z1, m1, Ec1, Es1, Z2, m2, Ec2, Es2, Eb2 n2, dx)
runs a BCA simulation for a list of particles and outputs a list of sputtered, reflected, and implanted particles.
Args:
ux (list(f64)): initial ion directions x. ux != 0.0 to avoid gimbal lock
uy (list(f64)): initial ion directions y.
uz (list(f64)): initial ion directions z.
energies (list(f64)): initial ion energies in eV.
Z1 (list(f64)): initial ion atomic numbers.
m1 (list(f64)): initial ion masses in amu.
Ec1 (list(f64)): ion cutoff energies in eV. If ion energy < Ec1, it stops in the material.
Es1 (list(f64)): ion surface binding energies. Assumed planar.
Z2 (list(f64)): target material species atomic numbers.
m2 (list(f64)): target material species masses in amu.
Ec2 (list(f64)): target material species cutoff energies in eV. If recoil energy < Ec2, it stops in the material.
Es2 (list(f64)): target species surface binding energies. Assumed planar.
Eb2 (list(f64)): target material species bulk binding energies in eV.
n2 (list(list(f64))): target material species atomic number densities in inverse cubic Angstroms.
dx (list(f64)): target material layer thicknesses starting at surface.
Returns:
output (NX9 list of f64): each row in the list represents an output particle (implanted,
sputtered, or reflected). Each row consists of:
[Z, m (amu), E (eV), x, y, z, (angstrom), ux, uy, uz]
incident (list(bool)): whether each row of output was an incident ion or originated in the target
stopped (list(bool)): whether each row of output is associated with a particle that stopped in the target
I've done some light testing of it, but haven't put it all the way through its paces - let me know if this feature works for you and if you run into any issues.
Going to close this for now; @crivaronicolini, please feel free to comment here if you have any further questions on this topic!
Hi! I was wondering how can I set up a layered target from the python side. I've looked at the example input for the layered target, but it's difficult to see how to set it up in python. Thanks!