Skip to content

Prevent plasma ionization past the atomic number#1343

Merged
MaxThevenet merged 4 commits into
Hi-PACE:developmentfrom
AlexanderSinn:Prevent_plasma_ionization_past_the_atomic_number
Jan 15, 2026
Merged

Prevent plasma ionization past the atomic number#1343
MaxThevenet merged 4 commits into
Hi-PACE:developmentfrom
AlexanderSinn:Prevent_plasma_ionization_past_the_atomic_number

Conversation

@AlexanderSinn
Copy link
Copy Markdown
Member

@AlexanderSinn AlexanderSinn commented Jan 9, 2026

@lucafedeli88 found an out-of-bounds memory access in #1340 which could have caused ions to ionize to higher levels than they would have had electrons. In my quick test, the probability of ionizing too high ended up being zero, however this was not guaranteed. This changes the RNG results for ionization.

  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn linked an issue Jan 9, 2026 that may be closed by this pull request
@AlexanderSinn AlexanderSinn added the bug Something isn't working label Jan 9, 2026
@lucafedeli88
Copy link
Copy Markdown
Contributor

Thanks for the quick fix, @AlexanderSinn . I am testing your solution here: #1344

@lucafedeli88
Copy link
Copy Markdown
Contributor

After your fix the sanitizer does not find any other error.

Copy link
Copy Markdown
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

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

Thanks for this fix!

@MaxThevenet MaxThevenet merged commit 9bc21f8 into Hi-PACE:development Jan 15, 2026
11 checks passed
Copy link
Copy Markdown
Contributor

@lucafedeli88 lucafedeli88 left a comment

Choose a reason for hiding this comment

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

Thanks for this quick fix, @AlexanderSinn

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential bug in the IonizationModule

3 participants