Skip to content

Annihilate positrons below the positron energy cutoff - #4157

Open
GuySten wants to merge 2 commits into
openmc-dev:developfrom
GuySten:claude/positron-cutoff-annihilation
Open

GuySten wants to merge 2 commits into
openmc-dev:developfrom
GuySten:claude/positron-cutoff-annihilation

Conversation

@GuySten

@GuySten GuySten commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Description

Positrons created by pair production are handled at the photon collision site by process_charged_secondary. That function returned immediately for any charged particle below its energy cutoff, before reaching the positron annihilation step. With a nonzero energy_positron cutoff, positrons below the cutoff therefore never produced their two 511 keV annihilation photons. That energy was silently lost from the photon field. Positrons from a source were not affected, since sample_positron_reaction always annihilates.

The energy cutoff now only suppresses thick-target bremsstrahlung for a charged particle below the cutoff; its kinetic energy is deposited locally as before. A positron always annihilates, whatever its kinetic energy. Behavior with the default positron cutoff of 0 is unchanged.

I also clarified the energy_positron cutoff description in the settings documentation.

The new test test_positron_cutoff_annihilation runs a 10 MeV photon source in lead with local energy deposition, without a positron cutoff and with one above the source energy. With local energy deposition the positron cutoff should have no effect, so the photon flux tallies must match. On develop, the flux in the bin containing 511 keV drops from 0.33 to 0.004 when the cutoff is set; with this fix the two runs give identical results.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 18) 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)

claude added 2 commits October 2, 2026 20:03
process_charged_secondary returned early for charged particles below
their energy cutoff before reaching the positron annihilation step. With
a nonzero positron cutoff, positrons from pair production below the
cutoff therefore never produced their two 511 keV annihilation photons,
losing that energy from the photon field (source positrons, handled in
sample_positron_reaction, always annihilated). The cutoff now only
suppresses thick-target bremsstrahlung, and positrons always annihilate.

Behavior with the default cutoff of zero is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RN7JroEkrbkLKVHbMDap9
@GuySten GuySten added the Bugs label Oct 2, 2026
@GuySten
GuySten marked this pull request as ready for review October 2, 2026 20:48
@GuySten
GuySten requested a review from paulromano October 2, 2026 20:48

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants