RustBCA icon indicating copy to clipboard operation
RustBCA copied to clipboard

[bug] Issue with generate_rustbca_input in scripts

Open nickschw2 opened this issue 1 year ago • 1 comments
trafficstars

generate_rustbca_input in rustbca.py produces toml files that cannot be run with cargo run --release <filename>. The errors I have identified include the following

  • root_finder, interactional_potential, and scattering_integral require that the values be contained within double quotes
  • The new method of 2D mesh input has not been updated in this function

This issue is likely also true for a few other functions in the script, but I've only used this one.

nickschw2 avatar Dec 06 '23 04:12 nickschw2

Hi @nickschw2 - yeah, that function just hasn't been kept up to date with RustBCA's input files. I encountered an issue with the toml Python library's handling of nested inline tables and, not being able to figure out an effective fix, essentially deprecated generate_rustbca_input by attempting to remove every mention of it from the Wiki and the readme (let me know if I missed a place).

If you'd like to fix it and open a pull request, I'd be happy to approve it; I'm not sure when I would be able to get around to taking another stab at it, and honestly might just as soon delete it as fix and keep it.

If you want a workaround, you can skip the toml library by making the entire input file a multi-line f-string that gets printed to a file instead of a dictionary that needs to be processed by the toml library, like so:

some_value = 5

input file = f'''
[options]
some_option = {some_value}
'''
with open('input.toml', 'w') as file:
    file.write(input_file)

This is used for example in test_morse.py.

drobnyjt avatar Dec 06 '23 04:12 drobnyjt