/fusion:sfrescofrom fusion
Fits FRESCO calculations to experimental data using SFRESCO, the MINUIT chi-squared minimizer. Builds .search files, selects variables, runs batch fits, reads errors and correlations. Use for optical potential fitting, phase-shift fitting, R-matrix width fitting, and dataset normalisation.
Ships in fusion. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
SFRESCO wraps FRESCO in a MINUIT chi-squared minimizer. You give it a working FRESCO deck, a list of parameters to vary, and one or more experimental data sets; it repeats the whole FRESCO calculation at each trial point and searches for the chi-squared minimum. The binary contains FRESCO, so there is no separate call and no coupling file: sfresco alone runs everything.
This skill covers the fitting layer only. Building and verifying the deck itself is the fresco skill's job, and you must go through it first.
hcm, rmatch, jtmax, bin counts first, per fresco/references/verification.md. Convergence is checked once, before the fit, not after.ChiSq/N printed by SFRESCO is per data point, not per degree of freedom. N is the total number of points over all datasets, with no subtraction of the number of free parameters. Say which N you used when you quote it.hesse says ERROR MATRIX ACCURATE. SFRESCO calls MINUIT with set strategy 0, so a plain migrad leaves ERR MATRIX APPROXIMATE, and those errors mean nothing. See the standard session below.p-cd example the fitted V and r0 come out correlated at -0.921 and W against W_d at -0.930, and in nalpha the two strengths reach -0.996. A parameter pair at |rho| > 0.95 is one number, not two, no matter what the error column says.pline is not the input line number (see below). The single most common failure is fitting the wrong parameter, and the fit still converges, so nothing warns you. Run scripts/potmap.py instead of counting by eye.sfresco contains FRESCO, so this one binary runs everything. scripts/run_sfresco.sh looks at $SFRESCO_BIN, then ~/bin/sfresco, then PATH, and if none exists it calls the fresco skill's install_fresco.sh, which clones https://github.com/I-Thompson/fresco and builds fresco and sfresco together with gfortran (about 2 minutes, needs gfortran, git, make; macOS: brew install gcc). Verified cold start: from an empty bin dir the installer produced both binaries and the p90zr-closure fit then recovered its true parameters. The installer is not called with --force, so it never overwrites binaries you already have.~/bin on this machine is 3.4 from 2023. Both reproduce the example anchors (chi-squared and fitted parameters agree; the MINUIT error column differs in the last digits because the two versions walk the valley differently). To upgrade, run install_fresco.sh --force yourself: it overwrites ~/bin/fresco and ~/bin/sfresco, so that is a decision to make deliberately, not a side effect of a fit.<out>-init, <out>-trace, <out>-snap, search.plot, minuit-saved.dat and about 20 fort.* files into the current directory. Always run in a scratch dir, which scripts/run_sfresco.sh does for you.sfresco < case.min). Interactive mode exists but is not reproducible.nalpha fit and 344 for the 4-parameter p-cd fit, so budget roughly 60 to 90 runs per free parameter including hesse. Time the deck first (fresco < deck > out) and multiply. Anything above a few seconds per FRESCO run belongs on a remote box, not this laptop.type=9 (ANC) needs the new binary. The 2023 FRES 3.4 in ~/bin rejects it with Unrecognised data type 9 and then fits nothing; FRES 3.5 reads it (verified: test/b8-gs-fit.search, an 8B = 7Be + p ANC fit, starts at chi2/N = 10.3593). Types 7 and 8 (Brune-basis pole energy and formal width) are marked not implemented in the source of both. If a fit needs ANC data, build 3.5 first.deck.in FRESCO input, already verified by the fresco skill
case.search what to vary + the data <- the fitting problem
case.min the command sequence for sfresco <- the fitting session
case.search starts with the deck name and the counts, then one &variable per parameter and one &data (plus its data) per dataset:
'deck.in' 'deck.frout' <- FRESCO input, FRESCO output to write
4 1 <- nvariables, ndatasets
&variable kind=1 name='V' kp=1 pline=2 col=1 potential=52.5 step=0.1 /
&variable kind=1 name='r0' kp=1 pline=2 col=2 potential=1.17 step=0.01 valmin=0.9 valmax=1.5 /
&variable kind=1 name='W' kp=1 pline=2 col=4 potential=3.5 step=0.1 /
&variable kind=1 name='WD' kp=1 pline=3 col=4 potential=8.5 step=0.1 /
&data type=0 idir=1 iscale=-1 lab=F abserr=T energy=27.90 /
22. 0.548 0.044
26. 0.475 0.024
...
& <- ends the data block
Omit potential= and the starting value is taken from the deck. step=0 fixes a variable. valmin/valmax must both be present or both absent.
pline is the order of the expanded &potl records for that kp, not the line number in your file. One alias-style &pot kp=1 v=... w=... wd=... vso=... / expands into four records, so pline runs 1 to 4 for what looks like one line. A second subtlety: for deformed potentials read in as matrix elements (TYPE 12 to 17), each following &step namelist also advances the counter (frxx2.f:331), and a variable that lands on a &step varies that step's strength str, with col ignored. Get the mapping from the deck with
python3 scripts/potmap.py deck.in # table of kp / pline / col / value
python3 scripts/potmap.py deck.in --emit 2.1 3.4 # ready-to-paste &variable lines
python3 scripts/potmap.py deck.in --emit 2.3.4 # KP.PLINE.COL when the deck has several kp
python3 scripts/potmap.py fort.3 --fort3 # ground truth, from a completed run
&variable kind=)| kind | varies | fields it needs | typical use |
|---|---|---|---|
| 1 | a potential parameter | kp, pline, col, potential | optical-model fits, binding potentials, deformation lengths |
| 2 | a spectroscopic amplitude | nafrac (which &cfp in the deck), afrac | transfer strengths, SF extraction |
| 3 | an R-matrix pole energy | term, jtot, par, energy, nopot | resonance positions |
| 4 | an R-matrix partial width | term, channel, width | resonance widths, ANCs via reduced widths |
| 5 | a dataset normalisation | dataset, datanorm | absolute-scale uncertainty of an experiment |
col indexes p(1:7) of that record, so for a type=1 line col 1,2,3 are V, r_V, a_V and col 4,5,6 are W, r_W, a_W; for type=2 col 4,5,6 are W_d, r_d, a_d; for type=3 col 1,2,3 are V_so, r_so, a_so. Full table in references/search-file-format.md.
&data type=)| type | data are | x column | notes |
|---|---|---|---|
| 0 | angular distribution at one energy | angle | the common case; energy= sets the lab energy |
| 1 | angle and energy distribution | energy, then angle per row | four columns: E, theta, value, error |
| 2 | excitation function at fixed angle | lab energy | angle= gives the angle |
| 3 | integrated cross section vs energy | lab energy | ic=0: ia=0 fusion, ia=1 reaction, ia=-1 angle-integrated elastic, ia=-2 total |
| 4 | phase shift vs energy | lab energy | jtot=, par=, channel= select the partial wave |
| 5 | bound-state search factor | state index | binding energy or potential scale, per isc |
| 6 | a constraint on a search parameter | (no data) | par= which variable, value=, error= |
| 9 | ANC of a bound state | state index | rejected by the 2023 binary, needs a current build |
Units and frames are set per dataset by four flags, and getting them wrong is silent:
idir: 0 absolute, 1 ratio to Rutherford, 2 absolute converted to ratio, -1 S-factors converted to absolute.iscale: -1 dimensionless, 0 fm^2/sr, 1 b/sr, 2 mb/sr (default), 3 microbarn/sr. Note idir=1 forces iscale=-1.abserr: T means the third column is an absolute error; the default F means it is a fraction of the datum. Forgetting abserr=T on data with absolute errors turns a 5% measurement into a 0.05% one, and chi-squared explodes by 10^4 with no message.lab: T for lab angles and cross sections, default F for cm.scripts/run_sfresco.sh generates exactly this when you do not pass a .min:
case.search <- line 1 is always the search file name
q <- echo the starting parameters
plot case-init.plot <- data + starting theory, for the before/after figure
min <- enter MINUIT
set strategy 2 <- accurate derivatives; strategy 0 is SFRESCO's default
migrad <- the actual minimization
hesse <- recompute the covariance properly: this is what makes errors real
end <- leave MINUIT
q <- fitted parameters WITH errors (before `end` you get the starting values)
show <- per-point data, theory, chi contribution
plot case-fit.plot <- data + fitted theory
ex
Add minos after hesse for asymmetric errors on a hard case. Full command list, including scan, set, fix, step, read, escan, in references/commands.md.
fresco skill, converge it, check the cross section is physical. Note the runtime.python3 scripts/potmap.py deck.in, and cross-check against fort.3 from step 1 if the deck uses alias-style &pot lines.case.search. Data go inline after &data (data_file='=', the default) or in a separate file (data_file='exp.dat'). Set idir, iscale, abserr, lab deliberately, and state in a comment what the source of the data was..min of just q / show / plot init.plot / ex. Confirm the theory column in show is neither zero nor absurd, and that the number of data points read equals what you wrote. A silent truncation here is common (see failure modes).scripts/run_sfresco.sh case.search [case.min].scripts/fitreport.py: chi2 before and after, parameters with errors, ERROR MATRIX ACCURATE, correlations. If the matrix is not accurate, the fit is not finished.fitreport.py case-fit.plot --dat case writes plain columns; plot them through the nature-figure skill. A chi2/N of 9 that follows the diffraction pattern and a chi2/N of 9 that misses the first minimum are different results.All three run with bash scripts/run_sfresco.sh examples/<case>.search examples/<case>.min on ~/bin/sfresco (FRES 3.4, 2023 build).
| Case | Physics | Fitted | Anchor |
|---|---|---|---|
examples/p-cd-manual.* | published reference case: p + 112Cd at 27.9 MeV, the 12 points of FRESCO: getting started Boxes 7 and 8 | V, r0, W, W_d | reproduces every digit the manual prints: V = 52.5280 (published 52.53), r0 = 1.17958 (1.179), W = 3.46041 (3.46), W_d = 7.42937 (7.43), chi2/N 643.19 -> 2.1910 (2.19). Started from r0 = 1.0, a 15% displacement, so this is a fit and not a re-echo |
examples/p-cd.* | the same system as the distribution's own test case, 28 points | V, r0, W, W_d | chi2/N 20.5232 -> 8.935; V = 52.184, r0 = 1.1814, W = 2.8957, W_d = 8.1819; corr(V,r0) = -0.921, corr(W,W_d) = -0.930 |
examples/nalpha.* | n + 4He phase shifts, 3 partial waves, 78 points | V, V_so | chi2/N 26021.14 -> 392.80; V = 44.210, V_so = 9.727; corr = -0.996 (degenerate pair) |
examples/p90zr-closure.* | closure test: KD02 p + 90Zr at 30 MeV fitted to pseudo-data generated from itself | V, W_d | recovers V = 49.0229 (true 49.023171) and W_d = 7.2155 (true 7.215552), chi2/N 463.58 -> 0.000 |
Two of these are worth running for different reasons. p-cd-manual is the published-work check: the target numbers are in print, in the code author's own manual, so agreeing with them tests the skill against the literature rather than against the code. p90zr-closure is the internal check to run after any change to the scripts or the environment: it proves the whole chain (pline/col mapping, units flags, minimizer) end to end, because the right answer is known exactly.
p-cd is the same system as p-cd-manual but with the distribution's own 28-point test file and start values, and it reproduces the distribution's reference output test/Outputs/ss-fit.plot: chi2/N = 8.935 exactly, r0 and V to 5 digits, W and W_d to 4 (that reference ran at MINUIT strategy 0 without hesse, so the last digits follow a different path down the same valley). Keep both: one anchors to the paper, the other to the shipped code. nalpha reproduces the distribution's initial chi2 (26021.11) to 6 digits but ends at a different, better minimum than the reference (392.80 against 414.94): MIGRAD is path dependent, so the converged parameters of a multi-minimum fit are not a reproducibility anchor, only the starting chi2 is.
scripts/potmap.py <deck.in> [--kp N] [--emit [KP.]PLINE.COL ...] [--fort3]: maps every potential parameter to its (kp, pline, col) triple, emulating FRESCO's &pot to &potl expansion, and emits &variable lines. It reproduces the awkward parts of the Fortran on purpose: p(0:8) indexing, null array elements (p(1:3)=50,,0.65 puts 0.65 in col 3), n*value repeats, kp=-4 counting as kp=4, and &step records taking their own pline. Use --fort3 fort.3 to read the expansion FRESCO itself produced, and compare the two on any deck you did not write yourself.scripts/run_sfresco.sh <case.search> [case.min] [runname]: copies the search file, the deck named on its first line, and any external data files into a fresh scratch dir, runs SFRESCO with the standard session if no .min is given, and prints the fit summary.scripts/fitreport.py <run.log>: chi2 history, fitted parameters, MINUIT table, error-matrix verdict, correlations, and warnings when the errors are not trustworthy or two parameters are degenerate. --dat PREFIX on a search.plot splits it into data and theory columns for plotting.references/search-file-format.md: every field of &variable and &data, with defaults, ground-truthed against sfresco.f, plus where the printed manual disagrees with the code.references/commands.md: SFRESCO commands and the MINUIT subset that matters, with what each one costs in FRESCO runs.references/fitting-strategy.md: how to stage a fit, what the optical-model ambiguities do to it, when a low chi-squared is lying, normalisation fitting, and what to report.references/failure-modes.md: symptom to cause to fix, each entry observed rather than guessed.references/output-files.md: what SFRESCO writes and how to read search.plot, -trace, -snap.SFRESCO does chi-squared minimization with MINUIT over FRESCO parameters. It does not do Bayesian inference, model selection, or emulation: for posteriors on a CDCC calculation use the user's DREAM line, not this. It does not fit anything FRESCO cannot compute, so inclusive non-elastic breakup (IAV/NEB) is out of scope; that is smoothie. For building or debugging the underlying deck, use the fresco skill.
AGENTS.md (opens in a new tab)examples/README.md (opens in a new tab)examples/nalpha.min (opens in a new tab)examples/nalpha.nin (opens in a new tab)examples/nalpha.search (opens in a new tab)examples/p-cd-manual.in (opens in a new tab)examples/p-cd-manual.min (opens in a new tab)examples/p-cd-manual.search (opens in a new tab)examples/p-cd.min (opens in a new tab)examples/p-cd.nin (opens in a new tab)examples/p-cd.search (opens in a new tab)examples/p90zr-closure.in (opens in a new tab)examples/p90zr-closure.min (opens in a new tab)examples/p90zr-closure.search (opens in a new tab)references/commands.md (opens in a new tab)references/failure-modes.md (opens in a new tab)references/fitting-strategy.md (opens in a new tab)references/output-files.md (opens in a new tab)references/search-file-format.md (opens in a new tab)scripts/fitreport.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
sfresco, fresco, minuit, chi-squared, optical-potential, nuclear-physics
29 skills in this plugin
/azure2Drive AZURE2, the Notre Dame multichannel R-matrix code of Azuma et al. (Phys. Rev. C 81, 045805 (2010); GPL-3.0). Write, run and verify .azr configuration files for low-energy charged-particle reactions in nuclear astrophysics: radiative capture, elastic scattering, resonance and subthreshold contributions, external (direct) capture normalised by ANCs, S-factor extrapolation to stellar energies, and reaction rates. Use for 跑AZURE2, AZURE2 input, .azr, R-matrix, R矩阵, 天体物理S因子, astrophysical S factor, direct capture, external capture, ANC, 渐近归一化系数, subthreshold state, CNO cycle capture, resonance analysis./bandBayesian uncertainty quantification for nuclear physics with the BAND framework (Bayesian Analysis of Nuclear Dynamics, bandframework v1.0.0): calibrate a model's parameters against data with surmise, build a fast reduced-basis emulator of nucleon-nucleus elastic scattering with rose, and combine several models' predictions with Bayesian model mixing in Taweret; also routes to the other BAND tools (jitr, Bfrescox, OpenBT, parMOO, PUQ, pybmc, LCGP, mooGP, Smooth Emulator). Use for Bayesian calibration, 贝叶斯校准, 参数后验, posterior, MCMC, emulator, 仿真器, surrogate model, Gaussian process emulator, reduced basis, reduced-order model, ROSE, optical potential calibration, 光学势不确定度, uncertainty quantification, UQ, 不确定度量化, model mixing, 模型混合, Bayesian model averaging, BMM, Taweret, surmise, BAND framework, experimental design. For running FRESCO itself use the `fresco` skill; for fitting a FRESCO deck by chi-squared use `sfresco`./ccfullDrive CCFULL, the all-order coupled-channels code for near-barrier heavy-ion fusion (K. Hagino, N. Rowley, A.T. Kruppa, CPC 123 (1999) 143). Write, run, and verify CCFULL input for fusion excitation functions, barrier distributions, and mean angular momenta with vibrational or rotational couplings and pair transfer. Use for 跑ccfull, CCFULL input, heavy-ion fusion, near-barrier fusion, coupled-channels fusion, fusion excitation function, barrier distribution, 熔合截面./cgmfDrive CGMF, the LANL fission-fragment de-excitation Monte Carlo code of Talou, Stetcu, Jaffke, Rising, Lovell and Kawano (Comput. Phys. Commun. 269, 108087 (2021); BSD-3-Clause). Run and analyse event-by-event simulations of prompt fission neutrons and gammas emitted by excited fission fragments, for spontaneous fission (Cf-252/254, Pu-238/240/242/244) and neutron-induced fission (U-233/234/235/238, Np-237, Pu-239/241) from thermal to 20 MeV: average and distributional neutron and gamma multiplicities, spectra, fragment mass/charge/TKE yields, and n-gamma correlations. Use for 跑CGMF, CGMF input, 裂变, fission, prompt fission neutrons, PFNS, prompt fission gammas, nu-bar, 中子多重性, neutron multiplicity, fission fragment yields, Hauser-Feshbach fission, 252Cf spontaneous fission, event-by-event fission./cnokDrive CNOK, the C++ Glauber-model single-nucleon knockout code of Y.Z. Sun and S.T. Wang (Comput. Phys. Commun. 288, 108726 (2023); GPL-3.0, gitee.com/asiarabbit/cnok). Compute single-particle removal cross sections (stripping + diffractive dissociation) and parallel (longitudinal) momentum distributions of the heavy residue (core) in one-nucleon knockout from intermediate-energy (30 MeV/u to 2 GeV/u) stable and radioactive beams on a light composite target, via the eikonal/sudden Glauber model with a t-rho-rho optical potential; supports batch mode over valence configurations (C2S-weighted inclusive cross sections and momentum distributions, spectroscopic-factor / quenching studies). Use for 跑CNOK, CNOK input, Glauber, 敲出, knockout, single-nucleon removal, stripping, diffractive dissociation, 动量分布, momentum distribution, sigma_sp, single-particle cross section, spectroscopic factor, 谱因子, C2S, quenching, eikonal, sudden approximation, t-rho-rho, 16C knockout, exotic nuclei knockout, MOMDIS./colossDrive COLOSS, the complex-scaled optical and Coulomb scattering solver (Liu Junzhe, Lei, Ren; CPC 311, 109568, 2025). Write, run, and verify COLOSS input for two-body elastic scattering with local or Perey-Buck nonlocal optical potentials, computing S-matrices and cross sections by complex scaling. Use for 跑coloss, COLOSS input, complex scaling scattering, 复标度散射, bound-state technique scattering, S-matrix from Lagrange-Laguerre basis.npx claudepluginhub jinleiphys/fusion --plugin fusionOther plugins' skills for the same job