lcpp-org / RustBCA

A free, open-source Binary Collision Approximation (BCA) code for ion-material interactions including sputtering, implantation, and reflection
https://github.com/lcpp-org/RustBCA/wiki
GNU General Public License v3.0
41 stars 14 forks source link

Most .toml examples in the examples/ directory won't run #242

Closed ddmcode closed 5 months ago

ddmcode commented 5 months ago

Description The examples/ directory contains a few .py examples along with a number of .toml examples. I can run the python examples, but the only .toml example I can run is layered_geometry.toml.

As an example, if I try to run the layered_geometry_1d.toml example as follows:

simulation_boundary_points = [ [ 0.6, -0.6,], [ -0.1, -0.6,], [ -0.1, 0.6,], [ 0.6, 0.6,], [ 0.6, -0.6,],]

I get the following error message:

Running "/home/derek/src/rust/rustBCA/target/release/RustBCA layered_geometry_1D.toml" thread 'main' panicked at src/input.rs:35:11:
called "Result::unwrap()" on an "Err" value: Could not parse TOML file. Be sure you are using the correct input file mode (e.g.,
          ./RustBCA SPHERE sphere.toml or RustBCA.exe 0D mesh_0d.toml).

Caused by:
    TOML parse error at line 50, column 1
       |
    50 | [geometry_input]
       | ^^^^^^^^^^^^^^^^
    missing field "energy_barrier_thickness"

If I add a value for it complains I need a value for "triangles". Using layered_geometry.toml as a template I need to add input for:

in order to get the simulation to run. However, it then complains about other issues, presumably because I have not chosen suitable default values for these inputs. I have been unable to find suitable values.

To Reproduce Checkout commit 1312dd367b215645681d85e5d7527d7407f631ea

Build and run any of the .toml examples (except layered_geometry.toml) following the instructions in the readme / wiki.

Expected behavior Not applicable.

Error messages, output files, or figures See above for typical error message.

System (please complete the following information): OS: Ubuntu linux 22.04.03 LTS

Additional context I failed to get some of the additional features to build, and I'm unfamiliar with building / running rust programs so there may be some learning / user issue here. I am however, as noted above, able to run the layered_geometry.toml.

drobnyjt commented 5 months ago

Hi @ddmcode - when you are running the 1D example, are you running it in the 1D input mode?

e.g.:

cargo run 1D layered_geometry_1D.toml
ddmcode commented 5 months ago

Hi @drobnyjt,

First, thanks for this clever code and your excellent thesis!

Your suggestion worked, thank you. I missed this detail in the docs I guess. I can now run most examples after a little trial and error. I have:

image

As shown, I was unable to figure out the option to run "multiple_interaction_potentials.toml" and "tungsten_twist_trimesh.toml".

Is there a rule / guide as to what option to used for a given .toml file?

Thanks,

Derek

drobnyjt commented 5 months ago

Great! While technically you can work backwards from the input file to determine which input mode to use (e.g., by comparing the listed options to each subsection on the input files page), you are correct that there's no obvious way.

While each example has its own wiki page that says which mode to use (e.g., tungsten_twist_trimesh requires RustBCA be built with the parry3d feature enabled and run in the TRIMESH input mode), it might be a good idea for me to add a comment to the top of each input file that says how to run it. Automatic detection is possible but would be difficult the way toml files are currently parsed, so that is unlikely to be added in the near future.

ddmcode commented 5 months ago

Sorry, I hadn't noticed the run instructions on the wiki, thanks.

I have most cases running now, I just have two issues:

I suspect this reflects some build issues I had, I will revisit.

I will close the issue now. Thanks for you very prompt assistance, I really apricate it :)

drobnyjt commented 5 months ago

@ddmcode you're very welcome.

To answer your two remaining questions, both of those reflect erroneous or out of date wiki entries; thanks for pointing them out so they can be fixed! I just fixed the former, where, as you note, the input mode keyword was simply omitted.

The second is out of date due to a change I made in version 2.8.4 where a netlib/Intel MKL/OpenBLAS linear algebra backend was replaced with a pure Rust linear algebra backend. You can run that input file with --features cpr_rootfinder; that page on the wiki has also been fixed.