← Modern Nuclear Data Processing · Learning AMPX by example

Learning AMPX · tips and lessons

AMPX tips, tricks and lessons learned

What went wrong, or nearly wrong, while processing ENDF/B-VIII.1 with AMPX on one laptop, and what fixed it. Each lesson gives the symptom you would see, the cause as far as it was found, the fix used, and the numbers behind it.

Most of this work, including this page, was generated with AI (Claude, Anthropic) under the direction of Ian H; it has not been independently reviewed. Numbers are from the projects' work logs and comparison outputs (CE library, covariances). They describe this AMPX build (SCALE 7.0 beta 3 public source) and may not hold for other versions.

Lessons 20 Tags accuracy time and memory failure workflow Updated 21 October 2026

Accuracy

1 · BROADEN with a list of temperatures accumulates error

accuracyBROADEN
Symptom
A 1/v cross section changes with temperature, which Doppler broadening must not do. O-16 capture at 0.0253 eV: +0.25 % at 600 K and +0.50 % at 2500 K; H-2 capture +0.26 % at 600 K. At first it looked like an approximation in BROADEN's kernel that hurts light nuclides (the error scaled roughly as 1/A).
Cause
Given several temperatures, BROADEN broadens each one from the previous result, so the error of every step is carried into the next.
Fix
Broaden each temperature directly from the 0 K file, keep only its functions with PICKEZE and merge with ZEST (the input).
Evidence
Broadened directly: O-16 capture +0.002 % at 600 K and +0.012 % at 2500 K. H-2 at 600 K: capture 0.00050566 b against NJOY's 0.00050567 b, elastic 5.0295 against 5.0296 b.

2 · One tolerance does not fit every step

accuracytime and memoryY12JAMAICAN
Symptom
With 1e-4 everywhere, O-16's fast distributions were still in Y12 after 45 minutes (2 minutes at 1e-3), and at 1e-3 the D-in-D₂O distributions reached 4.2 GB after 75 minutes. With the distributions at 1e-3, the whole library would have taken months on the laptop.
Cause
Y12's tolerance sets how densely every secondary distribution is tabulated, and everything downstream pays for it: H-2's (n,2n) break-up has 49 million outgoing-energy points at 1e-3 against 3.9 million at 1e-2. JAMAICAN's own tolerance hardly matters (3.7 h against about 4.5 h).
Fix
Cross sections at 1e-3 (POLIDENT, BROADEN and a Y12 point= pass for each thermal cross section), distributions from Y12 at 1e-2, JAMAICAN at 1e-3.
Evidence
Y12 at 1e-2 against 1e-3 for H-2 elastic: average cosine within 0.003, average outgoing energy within 0.28 % (median 0.08 %). The free-gas cross section is more sensitive (0.09–0.13 % median, 0.06–0.15 % in the integral below 5 eV), which is why cross sections get their own 1e-3 pass. BROADEN at 1e-4 against 1e-3 changed U-238's resonance integrals by about 0.01 %.

3 · Thermal kernels with a sharp peak converge slowly in Y12

accuracytime and memoryY12S(α,β)
Symptom
D in D₂O against NJOY: median 0.05–0.27 % up to 573.6 K, then at 1 eV +0.87 %, +2.17 % and +3.87 % at 600, 623.6 and 650 K (at Y12 eps 1e-3, and about ten times more at 1e-2).
Cause
From 600 K the evaluation's quasi-elastic peak (β = 0, smallest α) is 10–40 times stronger: S·α at the smallest α is 8.7, 20.6 and 35.7, against at most 0.97 below. Y12 integrates S(α,β) adaptively to its tolerance and converges slowly on such a narrow peak. An independent integration (sab_integral.py) with Y12's lookup rules, converged, agrees with NJOY within 0.1 % from 0.0253 to 2 eV at every temperature; with NJOY's rules it reproduces NJOY within 0.03 %. So it is neither the evaluation nor a difference of conventions.
Fix
A tighter point= pass at those three temperatures only (ce_chain.py --eps-at). 5e-4 was the tightest that fitted: Y12 used 4.59–5.00 GB; 3e-4 and 1e-4 went over 6 GB.
Evidence
At 5e-4: medians 0.29, 0.58 and 0.82 %; +0.43, +1.07 and +1.90 % at 1 eV. Halving the tolerance halved the excess. The remaining excess is documented and accepted; a converged result would need about 1e-4 at 600 K.

4 · A zero at 20 MeV that is not in the evaluation

accuracyPLATINUMopen
Symptom
The NJOY comparison flagged a 94 % difference in the total at 2 × 10⁷ eV. In 110 of 458 finished files, elastic (and capture, sometimes fission) end with a doubled point: 19 999 999.998 eV with the right value, then 19 999 999.999999996 eV with 0. In 37 files, threshold reactions end with a zero at 20.00001 MeV, outside the evaluated range.
Cause
PLATINUM, in the final assembly. A single-temperature B-11 run that kept the intermediate cross-section files showed POLIDENT's and BROADEN's output, and the merged cross sections, ending at exactly 20 MeV with the right values; only the final file has the zero, and only for the broadened reactions. Candidates in the public source are the discontinuity handling of CEResource/UnionGridMaker.cpp and ReactionXsSummer.cpp; the exact line was not pinned down.
Fix
None applied yet. It covers the last 2 × 10⁻³ eV below 20 MeV, where no fission or moderated system has neutrons. A post-processing fix is possible but would change the library files.
Tip
When a module's output looks wrong, rerun one nuclide at one temperature with the intermediate files copied out (the last block of the B-11 input does this for the cross sections) and find the first file where it appears.

5 · Differences from NJOY that are not errors

accuracycomparison

The largest numbers in any AMPX–NJOY comparison came from these. Knowing them saves days.

What you seeWhy
20–48 % at 20 keV in U-238, up to 40 % at 2.25 keV in U-235the end of the resolved range: a step, and the codes take different sides of it
11–33 % at O-16's 2.889 MeV resonance, growing with temperatureAMPX broadens it (2.70 → 2.54 b from 293.6 to 600 K); the NJOY-processed reference was not broadened at MeV energies. The integral over the window agrees within 0.007 %.
probability-table totals a median 1.34 % apart above 45 keV (U-238)AMPX's table "total" holds only elastic, capture and fission; NJOY's also includes the smooth inelastic cross section
self-shielded cross sections up to 9 % apart at a 1 b backgroundboth codes sample resonance ladders at random (PURM, PURR); band averages agree within 0.01 % (median)
up to 24 % between 2.25 and 8 keV in U-235's unresolved rangepoint data reconstructed on different grids (2272 against 655 points); integrals within 0.11 %
thermal data end at 5.05 eV, not 10 eVY12's default emax; the OpenMC library goes to 10 eV

Inputs and modules

6 · Y12 cannot read ENDF/B-VIII.1's new MF6 MT18 subsections

failureY12ENDF/B-VIII.1
Symptom
Y12 reports the subsections as not yet handled, and X10 then fails (covariance chain).
Cause
ENDF/B-VIII.1 adds neutron-multiplicity subsections with LAW −5 to MF6 MT18 of U-235, U-238 and Pu-239.
Fix
Give Y12 a copy without MF6 MT18 (the section, its SEND record and its MF1 directory entry), written by y12copy.py; the fission spectrum then comes from MF5 MT18. Every other module reads the original. Record the change (modifications.csv).
Evidence
Th-232, Pa-231 and Pa-233 also have their fission spectrum only in MF6 MT18, but as LAW 1: a Y12 and JAMAICAN test of each ran without error, so they need no copy. An early note had assumed they would need a conversion.

7 · Three settings JAMAICAN needs from Y12

failureY12JAMAICAN
Symptom
"Invalid ZAI"; or "Equiprobable exiting energy is no longer supported".
Fix
id=1 in Y12: jamaican_new expects the kinematics labelled with the incident particle (1 = neutron), not the MAT. zap=1.0 awp=1.0: outgoing neutrons only, because Y12's empty charged-particle distributions turn into equiprobable bins. equi=false in jamaican_new. And call jamaican_new and platinum_new: jamaican and platinum are the legacy modules.

8 · PURM labels its tables with the ENDF ZA

failuretime and memoryPURMmetastable nuclides
Symptom
After PURM, PURM_UP writes an empty file and PLATINUM stops with "Empty input stream in InTab1Container".
Cause
PURM labels its probability tables with the ZA of the ENDF file, which has no metastable flag. PURM_UP's matp was first the MAT (U-238 failed after 98 hours of PURM), then the SCALE ID, which is right only for ground states (Am-242m, 1095242 instead of 95242, failed after 35 hours).
Fix
matp and PLATINUM's ptable id are the ENDF ZA; matf stays the MAT; the SCALE ID still names the nuclide and its file. Copy PURM's output out of the working directory as soon as it exists.
Evidence
Because PURM's output had been kept, Am-242m's tables were recovered by running PURM_UP alone: 3 seconds, 6.6 MB of tables at all 15 temperatures. After the fix, the 557 generated inputs were compared with the old ones: only the 12 metastable nuclides with an unresolved range changed.

9 · A negative background stops PURM

failurePURM
Symptom
Na-22: "error: sampling a positive cross section … after 100 tries", at 15 keV and 2500 K.
Cause
The evaluation adds its File 3 background to the unresolved resonances, and that background is negative at 15 keV (about −0.04 b), so no ladder gives a positive total.
Fix
Na-22 (an activation product, half-life 2.6 years) is processed without probability tables: smooth cross sections in its unresolved range (15–100 keV). The driver now names purm_up(no probability tables) first among a run's failures, so the real cause is not hidden behind PLATINUM's error.

10 · Some units are big-endian

failurescalerteX10
Symptom
X10 crashes when reading the group structure.
Cause
scalerte makes gfortran units 21–26, 33, 77–80, 88 and 89 big-endian, and X10 always reads the group structure from unit 77.
Fix
Keep your own files off those units; give X10 a byte-swapped copy of group.bounds on unit 77.

Time and memory

11 · Memory, not CPU, is the limit

time and memoryworkflow
Symptom
bad_alloc under a memory cap; or, without a cap, a prototype that pushed other running work into swap.
Cause
Y12, JAMAICAN and BROADEN of heavy nuclides need gigabytes for a short time: jamaican_new needed more than 2.25 GB for O-16's 282 MB of fast distributions. Virtual size runs far ahead of resident memory (a 1.4 GB cap stopped a job that peaked at 654 MB resident). OpenBLAS reserves large buffers per thread.
Fix
OPENBLAS_NUM_THREADS=1; ulimit -v at about twice the expected peak; oom_score_adj=1000 so AMPX is killed before anything else (run_ampx.sh). Start a new job only while enough memory is free (3.5 GB here). Under WSL, raise its memory limit: by default it took half of the laptop's 15.7 GB; .wslconfig now gives it 12 GB and 8 GB of swap.
Evidence
With these settings ten jobs ran side by side. SCALE's data loader needed a 12 GB address-space limit for Pu-240 (5.1 GB peak); at 8 GB it stopped after loading every temperature.

12 · Process thermal kernels one temperature at a time

time and memoryY12S(α,β)
Symptom
D in D₂O with all 17 temperatures in one Y12 call: 4.2 GB of distributions at 1e-3, too much for jamaican_new.
Fix
tsl_split.py writes one ENDF file per temperature: each β row of MF7/MT4 keeps its α grid with that temperature's S values (LT = 0), the other temperatures are dropped, and the B array, effective temperatures and MF1 are copied unchanged. One Y12 and JAMAICAN call per temperature; free gas the same way.
Evidence
Read back with the OpenMC ENDF reader, S(α,β), the β grid, B and the effective temperatures of all 17 files equal the original value for value. Note that the MF1 directory line counts are left stale.

13 · Most of the time is PURM

time and memoryPURM
Numbers
14–26 minutes per unresolved-range energy for all 15 temperatures (actinides); 7 518 such energies in the library (median 19 per nuclide, Pu-239 51). U-238 took about 26 hours in all, Zr-91 61 hours.
Tip
PURM runs at about 0.2 GB, so many jobs fit side by side; the memory-hungry steps are short. Order the queue by what you need first (here the CANDU lattice nuclides), then by file size. Keep PURM's output: a failure after it then costs minutes.

14 · Compress, then prove nothing changed

diskHDF5
Numbers
0.28–0.46 GB per nuclide file uncompressed, about 190 GB for the library.
Fix
h5repack -f SHUF -f GZIP=4, keeping the result only if h5diff finds the contents identical.
Evidence
O-16 428 → 170 MB; about 80 GB expected for the library. SCALE's data loader gave identical output for the compressed and the uncompressed O-16.

Long runs

15 · The laptop will sleep

failureworkflow
Symptom
On 14 October the laptop slept for nearly 13 hours and WSL stopped: the driver and its 10 jobs were killed, all in PURM, about 83 job-hours lost. Nothing restarted the driver, and its command line had to be pieced together. That night WSL stopped again.
Cause
Sleep stops WSL and everything in it. SCALE's working directories are in /tmp, which a restart empties, so an interrupted job starts again from scratch.
Fix
A script that holds the exact approved command and starts the driver only if none is running, no STOP file exists and work remains; a systemd user service that runs it at WSL start, a timer that runs it every 15 minutes, and lingering enabled so it survives closing the terminal. The driver adopts jobs still running from a previous one. Only Windows' power settings stop the sleep itself.
Evidence
On 15 October the service relaunched the driver at 08:35 without intervention.

16 · scalerte runs on after a failed module

failurescalerte
Symptom
A run "finishes" with the real error buried in the middle of the output; after Am-242m's PURM_UP failed, the rest of its chain still ran for 13 minutes.
Fix
After each expensive step, a shell line that tests the file it must have written (test -s ft48f001 || echo 'ERROR: …'); after the run, read each module's completion status from the output and list the first failure first. The library driver writes a status.json per nuclide.

17 · Generate inputs, then diff them

workflow
Why
One nuclide's input is 580–670 lines; a library is 557 of them.
Tip
Write every input from one generator (ce_chain.py) and after any change to it, regenerate all inputs and compare them with the previous ones. The metastable fix changed exactly the 12 inputs it should; adding bound nuclides left the free nuclides' inputs byte for byte the same (checked for U-238 and H-1).

18 · Write the master library file yourself

workflowHDF5
Symptom
The public ce_simonize only links photonuclear data into an existing library; it does not merge nuclide files.
Fix
Write the master file directly with h5py: the metadata, one nuclide_md table with every nuclide's rows, one external link per nuclide and temperature. Create the table with PLATINUM's exact on-disk compound type: with h5py's own type, SCALE's reader fails with "no conversion path".
Evidence
A three-nuclide master loaded in SCALE's data loader (45 nuclide-temperatures, no warnings); the full master has 458 nuclides and 6 872 links in 1.2 MB.

19 · Copy the index and its directory

workflow
Symptom
A nuclide file that opens but has no data.
Fix
jamaican_new and PLATINUM write a small .h5 of external links plus a directory with the data; copy both (cp -r n_0005011*).

Checking

20 · Checks that found real problems

accuracyverification

No transport code that reads the SCALE 6.3/7 format was available here, so every check is at the data level.

CheckWhat it showed
1/v invariance. Capture at 0.0253 eV of a light nuclide must not change with temperature.the sequential-broadening error (lesson 1)
Exact free gas. The free-gas cross section of a constant cross section has a closed form.O-16's free-gas data within a median 0.016 % at all 15 temperatures
Analytic moments. H-2 elastic at 10⁻⁵ eV: average cosine 2/(3A), average E′/E = (A² + 1)/(A + 1)².validated the script that compared distributions at different tolerances: 0.3335 against 0.3339, 0.5553 against 0.5553
NJOY-processed data of the same evaluation (the official OpenMC library) at common temperatures.the D₂O excess at 600–650 K (lesson 3) and the zero at 20 MeV (lesson 4); medians of 0.02–0.12 % elsewhere
An independent integration with each code's rules.that the D₂O excess is Y12's tolerance, not the data (lesson 3)
SCALE's own data loader (CELibraryReader with the corrector) on every file.all 458 finished files load at every temperature with no corrector warnings
A single-temperature run keeping every intermediate.which module introduces the 20 MeV zero (lesson 4)