Closed HexSygon closed 1 month ago
Hey @HexSygon - thanks for opening an issue. The easiest way to learn what the arguments do is to refer to the docstrings using help(compound_bca_list_1D_py), although I admit there are likely other functions missing docstrings in libRustBCA:
>>> help(compound_bca_list_1D_py)
Help on built-in function compound_bca_list_1D_py in module libRustBCA:
compound_bca_list_1D_py(ux, uy, uz, energies, Z1, m1, Ec1, Es1, Z2, m2, Ec2, Es2, Eb2, n2, dx)
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
>>>
In this case, the last argument, dx
, is a list that contains the thickness of each layer in the target. That is, the first layer is 50 angstroms and the second layer is 1e6 angstroms. It looks like the documentation is missing the unit in the docstring, so I'll be sure to fix that for the next version. Hope this helps.
Thank you for this, very helpful. @drobnyjt
Is there a way to make a mixed layer of two materials?
I thought that this code was doing this, but it appears that it is just one layer stacked on top of a different material layer correct?
You're very welcome; the answer is yes, and the documentation should probably be updated to make that clear.
When you define the material parameters, e.g., the atomic numbers, like so:
Z2 = [1, 16, 22],
each element become a species included in the simulation.
Compounds made up of those elements are specified using the n2
argument, for the number densities. In the 1D material case, n2
is a list of lists made up of the number density of each element of each layer. If you have 5 layers, len(n2)=5
, one for each layer. The index of each sub-list of n2
corresponds to the elements specified in Z2, m2, etc, so if you have three elements specified in Z2
, len(n2[i])=3
for i = 0, 1, 2
.
For example, if Z2 = [1, 16, 22]
, and I want a material with 3 layers, one of TiO, one of TiH2, and one of pure titanium (assuming a constant number density of titanium for convenience):
n2 = [
[0.0, 0.0567, 0.0567], # 0 Hydrogen, 1 Oxygen, 1 Titanium
[0.1134, 0.0, 0.0567]. # 2 Hydrogen, 0 Oxygen, 1 Titanium
[0.0, 0.0, 0.0567], # 0 Hydrogen, 0 Oxygen, 1 Titanium
]
Hopefully this way of specifying the composition of each layer makes sense.
Is this part of the code under line 153 of test_rustbca.py correct?
[[target['n']/1030, target['n']/1030], [target['n']/10**30, 0.0]], [50.0, 1e6]
It's commented that the target is tungsten with a 50 Angstrom layer of W-H on top, but does that match the code above?
Is [target['n']/1030, target['n']/1030] supposed to refer to [n(tungsten), n(hydrogen)] ?
Yes, that's correct - the material properties are listed as [tungsten, hydrogen]
, so n has the following structure:
[
[n(W), n(H)], #number densities of first layer in 1/Å^3
[n(W), n(H)] #number densities of second layer in 1/Å^3
]
output, incident, stopped = compound_bca_list_1D_py( ux, uy, uz, energies_eV, [ion['Z']]number_ions, [ion['m']]number_ions, [ion['Ec']]number_ions, [ion['Es']]number_ions, [target['Z'], 1.0], [target['m'], 1.008], [target['Ec'], 1.0], [target['Es'], 1.5], [target['Eb'], 0.0], [[target['n']/1030, target['n']/1030], [target['n']/10**30, 0.0]], [50.0, 1e6]