pegs4.exe fails silently (exit code 16/18/21, no output) for specific elements/media when using classic MIXT/ELEM card format #1435
Replies: 9 comments 3 replies
|
Update: I've now ruled out data corruption as the cause. I built a completely independent PEGS4 dataset for the same 57 media using PEGS4GUI (manual entry through the GUI, not the command-line free-format input I mentioned above), and it produces the identical crash — same SIGSEGV, same exact source line, same "monotone = F F" pattern reported by HATCH for all 57 media. Source: 100 keV max-energy photon beam (CT localizer-style) Is this a known limitation/edge case with very-low-energy photon sources? Should ECUT be set much higher for this kind of low-energy work, or is there a bounds-check missing in that loop? |
|
Update 2: Confirmed the exact trigger. Setting ECUT=2.0 MeV (far above any physically possible secondary-electron energy for this 100 keV photon source) avoids the crash entirely and the run completes successfully , but at the cost of suppressing electron transport completely (N_step=0, PRESTA-II steps/total = NaN). This confirms the crash is specifically triggered when secondary electrons are actually transported near the low-energy floor of the range table, exactly matching the unguarded WHILE loop I found earlier in $COMPUTE-ELOSS-G. |
|
Update 4: Ran a full production-scale simulation (10,000,000 histories, ~47 min) at ECUT=0.7 to confirm the smaller test wasn't a fluke. Same result: N_step=0, no electron transport, despite the run completing without crashing. This confirms at scale that ECUT=0.7 avoids the crash only by suppressing electron transport entirely (as expected, since 0.7 MeV total energy / ~189 keV kinetic is well above the ~28 keV Compton-edge maximum for this 100 keV photon source). |
|
Tested another proposed workaround — lowering the PEGS4 AE parameter to 0.512 MeV (1 keV kinetic, EGSnrc's absolute minimum) while keeping AE < ECUT (ECUT=0.521 MeV), to give the range table a small buffer below the cutoff rather than having AE and ECUT coincide exactly. Result: this does not crash, but instead hangs indefinitely — 50+ minutes of CPU time at ~100% usage for only 10,000 histories (versus ~47 minutes for a full 10,000,000-history run at a working ECUT), never reaching the first batch print. Confirmed via strace -c -p over a 15-second window: zero system calls observed, indicating a tight, I/O-free computational loop rather than genuine (if slow) progress — consistent with a different known EGSnrc failure mode (#634, "Infinite loop in g application if pegs4 data too low in energy"). AE = ECUT = 0.521 → SIGSEGV (reported in Updates 1-3) |
|
I recommend running pegs4 through egs_gui. It has a pegs4 tab, and if you uncheck "ICRU density correction", then you can create pegs4dat files by typing in elements, like you're doing. Note that pegs4dat files use an approximation of density corrections. A better calculation uses NIST ESTAR, but their website is currently not working properly. The 2026 EGSnrc release will have density corrections from ESTAR directly integrated, so you will be able to define materials right in your input file and get the most accurate results. H, N, and O need to be diatomic molecules, so pegs4 is meant to fail with an error message telling you this. It works for me when I run it through egs_gui. Mg and Ca should work, so let me know if you also have issues with them when using egs_gui. If it also fails for you, then it might be an issue with newer compilers. |
|
Subject: DOSXYZnrc — correct global energy balance but per-voxel .3ddose values off by ~20 orders of magnitude (phase-space source, isource=2) Hi all, I'm running into a persistent issue with DOSXYZnrc that I can't resolve Setup
SymptomDOSXYZnrc's own global energy-balance report is physically sensible: But the resulting .3ddose file (and the raw per-voxel depth-dose tables For comparison, a validated water-phantom test case (much smaller grid, What I've ruled out so far
QuestionGiven correct global energy accounting but per-voxel dose values off by I'm currently planning to break with gdb directly at the dose-accumulation System details: Thanks in advance, |
|
Subject: BEAMnrc/DOSXYZnrc — phase-space particle weights show geometric decay in powers of (1/n_split), consistent with recycling compounding the splitting weight-reduction Hi all, I've tracked down a specific, reproducible issue in a BEAMnrc-generated Setup
Symptom (downstream, in DOSXYZnrc)DOSXYZnrc's global energy-balance accounting is physically sensible Root cause, isolated via gdb + direct binary inspectionBreaking directly at the phase-space read statement in DOSXYZnrc I then wrote a script to scan the raw phase-space file directly Critically, the minimum observed weight (2.22e-19) is very close to My interpretationThis pattern is consistent with the 1/n_split weight reduction being QuestionDoes this match a known issue with combining bremsstrahlung splitting and I'm happy to share the phase-space file, the full .egsinp for both the System details:
Thanks in advance, Appendix: ruled out before reaching this diagnosis (in case relevant):
|
|
Subject: BEAMnrc — phase-space particle weights show geometric decay in powers of (1/n_split), specifically tied to multi-batch runs (single-batch runs are clean) Hi all, Follow-up to my earlier post (below) with a much more precise finding after Refined diagnosisI initially suspected combining bremsstrahlung splitting (NBRSPL=500) with However, rerunning the same accelerator (photon forcing still off, The minimum observed weight (2.22e-19) is close to (1/500)^7 = 1.28e-19. This points to something specific to carrying particles across batch QuestionDoes this match a known issue with phase-space output across multiple As a workaround, restricting a run to complete within a single batch (by System details:
Thanks again for the help so far -- the ihowfarless and $DOSEZERO pointers Felix Original post:Subject: BEAMnrc/DOSXYZnrc — phase-space particle weights show geometric decay in powers of (1/n_split), consistent with recycling compounding the splitting weight-reduction Hi all, I've tracked down a specific, reproducible issue in a BEAMnrc-generated Setup
Symptom (downstream, in DOSXYZnrc)DOSXYZnrc's global energy-balance accounting is physically sensible Root cause, isolated via gdb + direct binary inspectionBreaking directly at the phase-space read statement in DOSXYZnrc I then wrote a script to scan the raw phase-space file directly Critically, the minimum observed weight (2.22e-19) is very close to My interpretationThis pattern is consistent with the 1/n_split weight reduction being QuestionDoes this match a known issue with combining bremsstrahlung splitting and I'm happy to share the phase-space file, the full .egsinp for both the System details:
Thanks in advance Appendix: ruled out before reaching this diagnosis (in case relevant):
|
FINAL UPDATE — ResolvedFalse alarm on both the "photon forcing" and "batch boundary" theories above Explicitly deleting the .egsphsp1 file before each fresh run immediately Apologies for the noise on the two intermediate theories -- leaving them Thanks again for the ihowfarless and $DOSEZERO help, both of which remain Update 2:Subject: BEAMnrc — phase-space particle weights show geometric decay in powers of (1/n_split), specifically tied to multi-batch runs (single-batch runs are clean) Hi all, Follow-up to my earlier post (below) with a much more precise finding after Refined diagnosisI initially suspected combining bremsstrahlung splitting (NBRSPL=500) with However, rerunning the same accelerator (photon forcing still off, The minimum observed weight (2.22e-19) is close to (1/500)^7 = 1.28e-19. This points to something specific to carrying particles across batch QuestionDoes this match a known issue with phase-space output across multiple As a workaround, restricting a run to complete within a single batch (by System details:
Thanks again for the help so far -- the ihowfarless and $DOSEZERO pointers Felix Original post:Subject: BEAMnrc/DOSXYZnrc — phase-space particle weights show geometric decay in powers of (1/n_split), consistent with recycling compounding the splitting weight-reduction Hi all, I've tracked down a specific, reproducible issue in a BEAMnrc-generated Setup
Symptom (downstream, in DOSXYZnrc)DOSXYZnrc's global energy-balance accounting is physically sensible Root cause, isolated via gdb + direct binary inspectionBreaking directly at the phase-space read statement in DOSXYZnrc I then wrote a script to scan the raw phase-space file directly Critically, the minimum observed weight (2.22e-19) is very close to My interpretationThis pattern is consistent with the 1/n_split weight reduction being QuestionDoes this match a known issue with combining bremsstrahlung splitting and I'm happy to share the phase-space file, the full .egsinp for both the System details:
Thanks in advance, Appendix: ruled out before reaching this diagnosis (in case relevant):
|
Uh oh!
There was an error while loading. Please reload this page.
I'm generating a custom PEGS4 dataset for ICRP143 paediatric tissue media (57 materials) and running into pegs4.exe failing with no diagnostic output whatsoever — just a nonzero exit code and an empty log.
Setup: Linux64 build, invoked as:
pegs4.exe -i
What works: Standard example inputs (h2o700.pegs4inp, p4imixt.pegs4inp, p4icomp.pegs4inp) all compile fine with exit code 0.
What fails: When I test individual elements as pure ELEM records (classic card format):
ELEM
&INP &END
ENER
&INP AE=0.521,UE=50.511,AP=0.010,UP=50.000 &END
TEST
&INP &END
PWLF
&INP &END
DECK
&INP &END
Results:
C, P → exit 0, valid output (~100-200KB)
H, N, O → exit 21, zero-byte output, zero log output (stdout/stderr both empty)
Mg, Ca → exit 16, zero-byte output, zero log output
No fort.* unit files are created in the working directory on failure either. AE=0.521/UE=50.511/AP=0.010/UP=50.000 is the energy range in all cases.
Questions:
What do exit codes 16/18/21 mean for pegs4.exe?
Why would H/N/O/Mg/Ca fail as pure elements when C/P (and O as part of a mixture in p4imixt/h2o700) succeed?
Is there a required data file or environment setup I might be missing that's element-specific?
All reactions