Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python LEAPR interface #2588

Closed
wants to merge 1 commit into from
Closed

Conversation

gridley
Copy link
Contributor

@gridley gridley commented Jul 4, 2023

Description

This provides a simple object-oriented interface to LEAPR that has type and enum checking and better documentation of the parameters. Like other NJOY stuff, it is painful to write inputs by hand. It isn't necessarily something that I think we should merge, but want to get others' opinions on if this is desirable. I may just put it into its own standalone repo.

Here is an example of generating an S(a, b) table for water. As you can see, much easier to understand than a plain old NJOY input.

lr = openmc.data.njoy.LeaprRun()
lr.title = 'water from GROMACS MD run'

lr.material_number = 1
lr.delta_rho = 1e-3
lr.n_rho = 501
lr.zaid = 1001
lr.free_atom_xs = 20.478
lr.awr = .99917 
lr.n_scattering_atoms = 1

# Amelia found these to be good alpha/beta grids.
lr.alphas = [1.0023e-05, ... 1.5810e+03]
lr.betas  = [0.0000e+00, ... 3.9526e+02]

# These are the output from GROMACS. Note that the translational component is subtracted out,
# hence having the first value as zero.
rho_293 = [0.0000e+00, ... 5.3943e-02]
rho_400 = [0.0000e+00,... 7.7357e-02]
rho_500 = [0.0000e+00,..., 9.7432e-02]

lr.add_temperature_point(293, rho_293,
                         twt=1.0014e-02, c=3.1640e+00)
lr.add_temperature_point(400, rho_400,
                         twt=2.0212e-02, c=7.4306e+00)
lr.add_temperature_point(500, rho_500,
                         twt=2.8092e-02, c=1.2537e+01)
lr.run()

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@gridley gridley requested a review from paulromano as a code owner July 4, 2023 00:03
@gridley gridley marked this pull request as draft July 4, 2023 00:03
Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gridley Thanks for bringing this up. I can definitely empathize with you on the pain of writing NJOY inputs. I do worry a little bit about scope creep in OpenMC and personally feel this particular use case would be better suited as a standalone repo.

@gridley
Copy link
Contributor Author

gridley commented Jul 11, 2023

Thanks Paul! Yeah I agree, will just put it on my account, then. 😃

@gridley gridley closed this Jul 11, 2023
@gridley gridley deleted the add-leapr-run branch July 11, 2023 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants