Skip to content

docs: recipe-building guide, supported features, engine citations - #12

Merged
Adam Corrao (AdamCorrao) merged 6 commits into
NSLS2:mainfrom
AdamCorrao:docs/recipe-helper
Oct 27, 2026
Merged

Adam Corrao (AdamCorrao) merged 6 commits into
NSLS2:mainfrom
AdamCorrao:docs/recipe-helper

Conversation

@AdamCorrao

@AdamCorrao Adam Corrao (AdamCorrao) commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Docs-only update aimed at people building their own recipes.

  • Building Recipes guide (docs/building-recipes.md): why PowderLine ships no recipe builder, what a recipe contains (sections, the [value, refine_flag, min, max] format, units), where to start (template, the nine examples, Materials Project), how to validate, and what validation does not catch.
  • Recipe helper code and LLM prompt (docs/recipe-helpers.md): a small I/O module (CIF / .instprm / pattern → recipe sections, numpy + gemmi only) and a prompt template, adapted from the v0.1.0 tester bundle and updated for the current code. Both are explicitly marked as guidance, not an authoritative builder.
  • Supported Features (docs/capabilities.md): a per-engine table (GSAS-II / TOPAS / easydiffraction) and a "not yet supported" list (e.g. Pawley/Le Bail, anisotropic broadening, preferred orientation, user constraints/restraints).
  • Citations: ask users to cite the refinement engine as well as PowderLine (GSAS-II + scripting interface, TOPAS, easydiffraction) in the README, a new Citing page, and CITATION.cff references.
  • ESD terminology: a note that esd follows the engines' terminology and denotes a standard uncertainty (IUCr 1995; NIST TN 1297). Column and key names are unchanged.
  • Fixes:
    • The Getting Started example recipe validated but failed at run time; it now runs.
    • The integration guide listed validate() / load_recipe_asset() as available without GSAS-II.
    • Simulation unit-cell reports have an empty esd column, not 0.0.

Testing

  • pixi run docs builds with no warnings.
  • The helper module and usage example, as extracted from the page, build recipes that pass powderline.validate and validate_only on all three engines.
  • Helper-built recipes run in GSAS-II: LaB6 Rietveld (Rwp 6.00%, matching example_LaB6), single-peak fitting, and a simulation.
  • The Getting Started snippet runs.

Code issues found (documented here, not changed in this PR)

  • easydiffraction converts the zero shift as if it were in centidegrees, but GSAS-II's Zero is in degrees. Values are 100× off; flagged on the Supported Features page.
  • TOPAS ignores flagged zero shift, axial divergence, and polarization without a warning.
  • An instrument.parameterization without broadening or corrections passes validation but crashes the GSAS-II run.
  • easydiffraction drops flagged size/strain with only a warning.

Assisted-by: claude-code:claude-opus-5-5

PowderLine deliberately ships no recipe builder. Document why, what a
recipe contains, where to start (template, nine examples, Materials
Project), how to validate, and what validation does not catch.

Add a helper page with a small I/O module (CIF, .instprm, pattern ->
recipe sections) and an LLM prompt template, adapted from the v0.1.0
tester bundle and updated for the current code. Both are explicitly
non-authoritative guidance.

Add a per-engine supported-features page listing what is not yet
supported, and link both pages from the README and Quickstart.

Assisted-by: claude-code:claude-opus-5-5
Add GSAS-II (and its scripting interface), TOPAS, and easydiffraction
references to the README citation section, a new Citing page in the
Sphinx docs, and the references list in CITATION.cff.

Assisted-by: claude-code:claude-opus-5-5
Keep the engines' 'esd' wording and column names, but note that the
quantity is a standard uncertainty (IUCr 1995; NIST TN 1297).

Assisted-by: claude-code:claude-opus-5-5
- Getting Started: the example recipe had an empty instrument block
  and no corrections block, so it validated but failed at run time; it
  now runs. Point to the Building Recipes guide.
- Integration guide: validate() and load_recipe_asset() are exported
  only when GSAS-II is installed, so they are not on the schema-only
  track.
- Simulation unit-cell reports have an empty esd column, not 0.0.

Assisted-by: claude-code:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings October 26, 2026 23:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The copyable helpers have input-handling defects, and some recipe guidance could produce invalid or unintended refinement models.

5 open issues
What changed in this PR

This documentation-focused PR helps users build their own PowderLine recipes, understand engine limitations, and cite the software used for refinement.

Changes:

  • Adds recipe-building guidance, copyable I/O helpers, and an LLM prompt template.
  • Documents per-engine capabilities and adds engine citation metadata.
  • Repairs the Getting Started recipe and clarifies validation availability and uncertainty terminology.
File Description
README.md Links new guides and adds engine citations.
examples/​CONTRIBUTING_EXAMPLES.md Corrects simulation uncertainty-column documentation.
docs/​recipe-helpers.md Adds recipe I/O helpers and an LLM prompt.
docs/​quickstart.md Links the recipe-building guide.
docs/​integration-guide.md Clarifies which validation APIs require GSAS-II.
docs/​index.rst Adds new guides to documentation navigation.
docs/​getting-started.rst Repairs example instrument settings and explains uncertainties.
docs/​DEVELOPMENT.md Corrects simulation uncertainty-column documentation.
docs/​citing.md Provides PowderLine and engine citation guidance.
docs/​capabilities.md Documents engine support and current limitations.
docs/​building-recipes.md Explains recipe structure, units, and validation.
CITATION.cff Adds machine-readable engine references.

Review effort: Balanced

Comment thread docs/recipe-helpers.md Resolved
Comment thread docs/recipe-helpers.md Resolved
Comment thread docs/building-recipes.md Resolved
Comment thread docs/building-recipes.md Resolved
Comment thread docs/building-recipes.md Resolved
- Helper module: keep missing anisotropic CIF components as None (fall
  back to Uiso with a warning) instead of raising TypeError; reject
  infinite esd values, which would otherwise become zero weights.
- Scope symmetry-linked refinement to GSAS-II; note that TOPAS only
  groups cell lengths and refines flagged symmetry-fixed parameters
  with a warning.
- Microstrain is (delta d / d) x 10^6.
- Materials Project recipes start in simulation mode; raise
  refinement_cycles before refining.

Assisted-by: claude-code:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings October 26, 2026 23:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The published helpers can misidentify CIF elements and misparse instrument files, producing incorrect structures or invalid recipes.

No open issues 🎉

3 previously missed issues

In code that hasn't changed since last review

Medium severity Incorrect element inference from uppercase two-letter atom labels

docs/​recipe-helpers.md:141

When a CIF omits the optional _atom_site_type_symbol column and uses uppercase two-letter atom labels, this fallback silently changes the element: FE1 becomes F, SI1 becomes S, and CL1 becomes C. read_cif() emits no warning for this fallback, and schema validation accepts the resulting chemically incorrect structure. Handle case-insensitive two-letter symbols or reject ambiguous labels and require an explicit type symbol rather than silently shortening them to one letter.

Medium severity Fail to parse multiple semicolon-separated instprm pairs

docs/​recipe-helpers.md:344

GSAS-II .instprm files can contain multiple semicolon-separated key:value pairs on one line, but this reader treats the whole line as one pair. For example, Type:PXC;Bank:1 corrupts Type, and a combined wavelength/profile line leaves Lam nonnumeric and drops profile parameters, producing an invalid recipe. Split each non-comment line on semicolons before parsing the individual pairs.

Low severity Kicker ignores selected engine and always invokes GSAS-II

docs/​recipe-helpers.md:556

pixi run kicker always invokes GSAS-II; it does not use the engine selected earlier in this prompt. For a user who selected TOPAS or easydiffraction, this shell alternative therefore runs a different engine from the one just validated, or fails if GSAS-II is unavailable. Mark this command as GSAS-II-only, give topas-kicker for TOPAS, and retain the explicit-engine Python call for easydiffraction.

5 resolved since last review

Review effort: Balanced

- Read two-letter element symbols case-insensitively (FE1 -> Fe, not
  F) and warn when the element is taken from the atom label.
- Split .instprm lines on ';' as GSAS-II does.
- Note that pixi run kicker runs GSAS-II only; topas-kicker runs TOPAS.

Assisted-by: claude-code:claude-opus-5-5
Copilot AI balanced review requested due to automatic review settings October 27, 2026 00:07

@AdamCorrao Adam Corrao (AdamCorrao) left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Docs-only changes reviewed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The helper can silently alter fit weights, and two engine-specific documentation claims can lead users to configure unintended models.

No open issues 🎉

3 previously missed issues

In code that hasn't changed since last review

Medium severity Document structure precedence over parameterization starting values

docs/​building-recipes.md:67

Please qualify this for easydiffraction: its builder reads phase cell and atom starting values only from structure, ignoring non-null values in their parameterization leaves. For example, changing parameterization.unit_cell.a[0] while leaving structure.unit_cell.a unchanged still uses the old lattice parameter, even with refinement disabled. Document this exception and tell users to update structure as well; otherwise following this guidance can silently calculate a different model than intended.

Medium severity Document easydiffraction's differing oblique-cell parameter grouping

docs/​building-recipes.md:79

easydiffraction groups symmetry-equal cell lengths, but it does not apply GSAS-II's additional grouping for oblique cells. For a monoclinic cell with unique axis b, flagging only a refines a, c, and beta in GSAS-II but only a in easydiffraction. Document this distinction so users do not assume identical flags select identical parameters across engines.

Medium severity Reject numeric rows with more than three columns

docs/​recipe-helpers.md:427

Please reject numeric rows with more than three columns rather than silently truncating them. PowderLine's eight-column fit_profile.txt, for example, has y_weights third, so this reader treats weights as standard uncertainties and replaces them with 1 / y_weights**2. The resulting recipe can pass validation but uses incorrect fit weights.

Review effort: Balanced

@AdamCorrao
Adam Corrao (AdamCorrao) merged commit 03e0d7c into NSLS2:main Oct 27, 2026
3 checks passed
Adam Corrao (AdamCorrao) added a commit to AdamCorrao/PowderLine that referenced this pull request Nov 4, 2026
From upstream PR NSLS2#12, adapted to 0.2.0:
- CITATION.cff references: GSAS-II (2013, scripting interface 2018),
  TOPAS (2018), easydiffraction 0.21.1 (zenodo.22905049, the release
  record), CrysPy (Phys. Rev. Research 2019), CrysFML2008, gemmi (JOSS
  2022); README section and docs/citing.md
- input-guidance: a nine-step 'Building a recipe' workflow, the
  no-builder rationale extended, and the unsupported list completed
  (Pawley/Le Bail, restraints, magnetic, extinction, minimizer choice)
- getting-started: the standard-uncertainty note
The 0.26.0 recipe guide, capabilities page and recipe helpers are not
ported (they describe the old schema).

Assisted-by: claude-code:claude-opus-5-5
@AdamCorrao
Adam Corrao (AdamCorrao) deleted the docs/recipe-helper branch November 9, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants