Skip to content

[bug] Issue with generate_rustbca_input in scripts #230

Not planned
@nickschw2

Description

@nickschw2

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.

Activity

drobnyjt

drobnyjt commented on Dec 6, 2023

@drobnyjt
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @drobnyjt@nickschw2

        Issue actions

          [bug] Issue with generate_rustbca_input in scripts · Issue #230 · lcpp-org/RustBCA