Source-linked AI summary
A self-learning scientific agent for X-ray diffraction
Bin Cao, Huichi Zhou, Runyu Yang, Jingsong Li, Shuchen Sun, Yan Song, Hanyu Gao, Zhongwei Yu, Tong-Yi Zhang, Jun Wang
TL;DR
A diffraction analysis may resolve one sample without improving the procedure used on the next. Gan Jiang makes measurement-to-structure analysis an object of learning, and frozen learned workflows improve refinement beyond expert-designed procedures in held-out comparisons.
Problem
A diffraction analysis can resolve one sample yet fail to improve the next, so analytical experience must become reusable knowledge tested beyond its originating episode.
Source: Main · p. 3Method
Gan Jiang makes the procedure connecting measurements to structural conclusions an explicit learning target and integrates diffraction tools with a persistent skill library.
Source: Discussion · p. 16Results
Frozen learned workflows improve refinement beyond the original expert-designed procedures, with held-out comparisons demonstrating transfer.
Source: Discussion · p. 16Takeaways & Limitations
Incomplete opXRD patterns motivate extending agent learning beyond interpretation to data acquisition.
Source: Discussion · p. 16Incomplete patterns common in opXRD may leave structural ambiguity.
Source: Discussion · p. 16
Abstract
from arXiv · showhide
A central challenge for scientific agents is to turn analytical experience into reusable expertise grounded in physical evidence. Here we introduce Gan Jiang, a self-learning agent for powder X-ray diffraction built on a diffraction-analysis ecosystem we developed: XMatcher, XQueryer, XDecomposer and WPEM. Together, these engines span phase identification, multiphase decomposition and physics-constrained whole-pattern modelling. Gan Jiang converts analytical experience into executable skills by diagnosing failures, revising skill instructions and code, and validating revisions before reuse, without retraining the language model or changing the underlying physical models. Skills selected using development data and frozen before held-out evaluation achieve higher refinement scores than the original expert-designed skills across FullProf, GSAS-II and PyWPEM. The agent resolves strongly overlapping reflections, quantifies a five-phase ancient Egyptian cosmetic, tracks lattice evolution in an operating battery and compares atomic configurations in a disordered oxide catalyst. On DeltaXRDbench, it leads the evaluated methods in single- and multiphase identification across simulated and experimental data. Without supplied composition, single-phase top-1 accuracies reach 96.30\%, 81.78\% and 40.83\% on MP500, RRUFF and opXRD, respectively, compared with 58.00\%, 58.47\% and 26.45\% for the strongest comparator. These results demonstrate how an integrated scientific tool ecosystem can support agents that extract structural knowledge from measurements while accumulating validated analytical expertise that transfers to new samples.
Main
Powder X-ray diffraction is an ill-posed inverse problem: overlapping reflections, disorder, preferred orientation and incomplete measurements can make structural models difficult to distinguish. Gan Jiang turns evidence-based diffraction analysis into reusable skills, validating revisions before testing their transfer to unseen samples.
Main
- Overlapping reflections, disorder, preferred orientation and incomplete measurements make powder X-ray diffraction an ill-posed inverse problem in which different structural models can be difficult to distinguish.Peak positions, intensities and shapes carry structural information, but instrumental effects also influence the measured pattern.Source: Main · p. 3
- The need for reusable expertise grows as high-throughput measurements and autonomous laboratories increase demand for analysis, while machine-learning methods and agents connect phase prediction to numerical verification.The cited related work spans phase classification, structure retrieval, candidate generation, automated refinement and emerging agents.Source: Main · p. 3
- Gan Jiang makes analytical experience reusable by revising executable skills from diffraction evidence and validating candidate changes before reuse, without retraining the language model.One GSAS-II training episode led the revised skill to start from defaults and adjust one parameter group at a time after simultaneous changes worsened the fit.Source: Main · p. 3
- Gan Jiang tests whether skill revisions transfer beyond their originating episodes through held-out comparisons and demonstrations spanning materials applications, controlled learning and phase-identification benchmarks.The system couples measurement interpretation with improvement of the procedures used to interpret measurements.Source: Main · pp. 3–4
Results
The Results evaluate Gan Jiang’s diffraction identification and refinement workflows across benchmark tests and diverse analysis settings, including overlapping peaks, mixtures, battery operation and atomic disorder. They also examine transfer of learned skill revisions and multiphase identification under XRD-only and composition-assisted conditions, with incomplete angular ranges and low opXRD exact recovery as constraints.
Broad materials applications and leading performance
- Without supplied composition, Gan Jiang's single-phase top-1 accuracy was 96.30% on MP500, 81.78% on RRUFF and 40.83% on opXRD, exceeding the strongest comparator by 38.30, 23.31 and 14.38 percentage points, respectively.The comparisons are under the declared benchmark conditions.Source: Figure 1 · p. 4, Broad materials applications and… · p. 5
- Gan Jiang leads evaluated methods in multiphase precision, recall, F1 and exact-set recovery across MP500, RRUFF and opXRD, with and without composition assistance.Figure 1f reports sample-wise macro-F1 and heat maps for prediction coverage, exact-set recovery, precision, recall and F1.Source: Figure 1 · p. 4, Broad materials applications and… · p. 5
- For an operating O3-type cathode, successive refinements track c-axis expansion and high-voltage contraction; a Ru–Mn oxide comparison selects a diffraction-supported model within the tested configurations.The Ru–Mn oxide model reaches Rp = 1.447% and Rwp = 3.129%; the cathode's c-axis trajectory is consistent with peak motion in measured profiles.Source: Figure 1 · p. 4, Broad materials applications and… · pp. 5–6
- The refinement reaches Rp = 2.753% and Rwp = 5.926%, while the same approach quantifies a five-phase ancient Egyptian cosmetic powder; reported lattice parameters are a = 8.4851(0) Å, b = 5.4016(1) Å and c = 6.9643(3) Å.Source: Broad materials applications and… · p. 5
From diffraction fingerprints to structural explanations
- Completed analyses retain actions, diagnostics and corrections that can be distilled into revised skills, allowing experience from one analysis to change procedures for future materials.Gan Jiang tests structural hypotheses for the current material while also testing procedural improvements for future analyses.Source: From diffraction fingerprints to… · p. 8
An executable architecture for evidence-guided analysis
- Gan Jiang separates language-model planning, specialized numerical engines and explicit acceptance policies, while retaining each analysis's inputs, tool responses and policy version for traceability.The workflow supports identification, identification followed by refinement, and direct refinement of a supplied structure.Source: An executable architecture for… · p. 8
- Mixture analysis follows completed rejection of available single-phase hypotheses, not a failed tool call alone, and resulting phase sets undergo joint inspection.This distinguishes computational failure from evidence that the structural model is incomplete.Source: An executable architecture for… · p. 10
Self-improvement transfers analytical skills to unseen samples
- Gan Jiang updates reusable skills from diffraction residuals, execution outcomes and physical plausibility checks, with validation guarding revisions while language-model parameters remain fixed.The mechanism revises procedures for subsequent samples rather than changing a sample’s refined parameters alone.Source: Self-improvement transfers analytical… · pp. 10–11
- Held-out mean refinement scores rose for FullProf (46.90 to 72.38), GSAS-II (39.01 to 60.02) and PyWPEM (31.74 to 38.33).Scores summarize profile agreement, count failed or timed-out evaluations as zero, and are not structure-identification accuracies; the PyWPEM gain was smaller, showing benefits depend on the initial workflow, engine and permitted revisions.Source: Self-improvement transfers analytical… · p. 11, Figure 4 · p. 12
- Revisions added bounded profile-width and angular-offset searches in FullProf, saved-output checks in GSAS-II, and targeted divergence or timeout responses in PyWPEM.These turn execution experience into actionable rules with defined scope while preserving the skill interfaces.Source: Self-improvement transfers analytical… · p. 12
- Verified user episodes can propose updates for regression-checked, versioned release with monitoring and rollback; experiments demonstrate controlled frozen transfer, not longitudinal open-ended improvement.The experiments freeze selected procedures before held-out testing, separating revision selection from transfer assessment.Source: Self-improvement transfers analytical… · p. 13
Benchmark gains across single- and multiphase identification
- With composition, Gan Jiang’s top-1 accuracy reached 99.90%, 92.16% and 48.93%; XRD-only MRR@5 was 96.94%, 86.01% and 42.22% versus AutoXRD’s 60.17%, 60.89% and 27.48%.The gains span simulated and experimental measurements and remain substantial without reference composition.Source: Benchmark gains across single- and… · pp. 13–14, Table 1 · p. 14
- Without composition, XRD-only top-1 accuracy was 96.30%, 81.78% and 40.83% for Gan Jiang versus AutoXRD’s 58.00%, 58.47% and 26.45% on MP500, RRUFF and opXRD.Gan Jiang achieved the highest top-1, top-3, top-5 and MRR@5 scores on all three datasets under both input conditions.Source: Benchmark gains across single- and… · p. 13, Table 1 · p. 14
- Without supplied composition, Gan Jiang’s exact-set recovery was 22.80%, 15.90%, and 3.10% on MP500, RRUFF, and opXRD, versus AutoXRD’s 15.80%, 13.80%, and 1.30%.Source: Table 2 · p. 15, Benchmark gains across single- and… · p. 15
- Without supplied composition, Gan Jiang’s macro-F1 was 66.98%, 56.23%, and 27.04% on MP500, RRUFF, and opXRD, versus AutoAnalyzer’s 51.12%, 53.78%, and 20.14%.Source: Table 2 · p. 15, Benchmark gains across single- and… · p. 15
- With composition assistance, Gan Jiang reaches exact-set recovery of 69.70%, 38.20%, and 8.20%, and macro-F1 of 91.61%, 78.56%, and 38.21% on MP500, RRUFF, and opXRD.Source: Table 2 · p. 15, Benchmark gains across single- and… · pp. 15–16
- Gan Jiang leads exact-set recovery, precision, recall, and macro-F1 under both conditions on all three sources, with consistent rankings across conditions.Source: Benchmark gains across single- and… · pp. 15–16
- It returns a nonempty prediction for every evaluated mixture, but coverage alone does not establish correctness; incomplete opXRD angular ranges leave full mixture recovery difficult even with composition information.Source: Benchmark gains across single- and… · p. 16
Discussion
Gan Jiang makes the procedure linking diffraction measurements to structural conclusions an explicit object of learning, with applications and held-out comparisons demonstrating analytical capabilities. The discussion also identifies incomplete measurements as a boundary and proposes extending learning toward data acquisition.
Discussion
- Gan Jiang makes the procedure connecting measurements to structural conclusions an explicit object of learning, integrating diffraction tools with persistent executable skills.The applications extend beyond routine phase identification to archaeological materials, operating batteries and disordered catalysts, where structural hypotheses must be assessed against available evidence.Source: Discussion · p. 16
- Held-out comparisons of frozen workflow versions show learned skills improve refinement beyond original expert-designed procedures, alongside identification benchmarks and demonstrated analytical capabilities.The comparisons assess revisions to the original expert-designed procedures on held-out data.Source: Discussion · p. 16
- Analytical evidence can support procedure improvement and choices about what to measure next; an unresolved reflection may warrant a targeted scan to distinguish hypotheses.The longer-term goal is an agent that learns both how to interpret measurements and which measurements to make.Source: Discussion · p. 16
- Incomplete opXRD patterns may leave structural ambiguity when distinguishing information was never measured, motivating learning that extends from interpretation to data acquisition.The authors identify closing the analysis–experiment loop as a next step.Source: Discussion · p. 16
- By identifying missing or uncertain diffraction features, Gan Jiang could direct a diffractometer to acquire data, reassess its interpretation and incorporate experience into analytical skills.Prospective experiments will test whether this feedback improves experimental efficiency and structural inference.Source: Discussion · p. 16
Methods
The Methods section describes Gan Jiang’s externally editable skill loop and the crystal-library, benchmark, retrieval, decomposition, fitting and screening workflows used for diffraction analysis, producing component profiles and diagnostics for downstream analysis and delivery decisions.
Gan Jiang agent
- Skill procedures and code are revised using execution traces, diffraction agreement, structural plausibility and expert feedback; versioned revisions preserve analysis provenance while model parameters remain fixed.Candidate revisions can be tested before adoption.Source: Gan Jiang agent · p. 18
Evaluation of self-improvement
- Skill revisions were selected through paired development evaluation, frozen before held-out comparison, and assessed as workflow transfer rather than as the effect of individual edits.Failed or timed-out evaluations contributed zero to the mean score, and adaptation scopes differ across FullProf, GSAS-II and PyWPEM.Source: Evaluation of self-improvement · pp. 18–19
Gan Jiang crystal dataset
- Gan Jiang’s candidate library combines 100,315 MP500 structures with 2,007 experimental structures from RRUFF and opXRD/private data, spanning 80 elements and 141 space groups.Source identifiers, original CIF filenames and SHA-256 checksums preserve provenance and enable duplicate detection.Source: Gan Jiang crystal dataset · p. 19
XRD Benchmark
- DeltaXRDbench evaluates phase identification and profile agreement across 62,044 simulated and experimental patterns, including 12,044 single-phase patterns and 50,000 two- or three-phase mixtures.Multiphase predictions use maximum-cardinality one-to-one structural matching.Source: XRD Benchmark · pp. 19–20
XMatcher
- XMatcher ranks phases using peak-position and relative-intensity matching, while AutoMix estimates nonnegative peak contributions that are not Rietveld-refined mass or volume fractions.AutoMix fits combinations of leading single-phase candidates and penalizes unnecessary phases.Source: XMatcher · p. 21
XQueryer lightweight
- XQueryer Lightweight retrieves ranked MP500 structures with a compact convolutional model using diffraction traces, Fourier reconstructions and element-guided queries; it requires elemental input at inference.Source: XQueryer lightweight · p. 22
XDecomposer
- XDecomposer uses local and global pattern features with learnable phase queries to generate masked component profiles for up to four unknown phases without candidate lists or fixed ordering.Training uses permutation-invariant component assignment, slot-activity supervision, and mixture-reconstruction consistency.Source: XDecomposer · p. 22
- PyWPEM models strongly overlapping signals as non-negative mixtures of pseudo-Voigt peaks, using constrained soft assignments to fit coincident reflections and support refinement and phase-fraction analysis.Bragg-position and profile constraints link the statistical mixture to the crystallographic model; fitted peak positions, shapes, and integrated intensities support subsequent analysis.Source: WPEM · p. 22
XRDinspector
- XRDinspector screens identification and refinement outputs with peak-coverage, phase-support, profile-fit, and residual diagnostics, then applies a conservative four-level delivery policy.Acceptance indicates profile consistency, not structural uniqueness.Source: XRDinspector · p. 23
Additional information
The paper notes that supplementary information is available and directs correspondence and materials requests to the corresponding author.
- Supplementary information is available; correspondence and materials requests should be directed to the corresponding author.Source: Additional information · p. 24
Supplementary Note 1 Supplementary methods
The supplementary methods describe Gan Jiang as a stateful diffraction workflow that selects procedures and tools according to the objective, evidence and analysis stage. It revises reusable skills after diagnosing failures, with validation and evaluation procedures intended to distinguish transferable improvements from sample-specific attempts.
1.1 Gan Jiang agent
- Skills are external artefacts combining specifications, prompts and executable code; orchestration coordinates the language model, context, tools and library while deployment adaptation leaves model parameters fixed.Source: §1.1 · p. 31
- Each analysis episode tracks its objective, supplied data, constraints, history and intermediate outputs, so subsequent actions depend on the requested endpoint and accumulated evidence.A plausible phase candidate alone does not complete a task requiring refinement, and a refinement run alone does not establish that every mixture phase was identified.Source: §1.1 · pp. 31–32
- Skill retrieval combines sparse BM25 and dense search through reciprocal-rank fusion, optionally reranks candidates, and trains a router with synthetic queries and hard negatives.Source: §1.1 · p. 32
- Routing accounts for analysis stage and required inputs: refinement needs an initial structural model, while identification may obtain one; tools produce candidates, phase contributions or updated model parameters.Source: §1.1 · p. 32
- A common calculated-pattern description sums phase contributions with a background; residual features may prompt phase reassignment or calibration and lattice checks, but do not uniquely diagnose an error.The parameterization depends on the refinement engine, and interpretation also depends on experimental conditions and the current model.Source: §1.1 · pp. 32–33
- Trace-based failure attribution triggers targeted skill rewriting, while persistent low utility can prompt restructuring or discovery; proposed mutations may be tested and rolled back if validation fails.Reusable updates should encode when a correction is appropriate rather than generalize a sample-specific answer.Source: §1.1 · p. 33
- Feedback distinguishes execution status, diffraction agreement, structural plausibility and expert assessment, which address completion, fit, physical credibility and support for interpretation.Source: §1.1 · p. 33
- Adaptation evaluation should distinguish revisiting a sample from transfer to unseen samples and specify the skill-library version and whether testing updates are enabled.This separates extra attempts on one pattern from reusable procedural improvement.Source: §1.1 · pp. 33–34
1.2 DeltaXRDbench: a reproducible benchmark
DeltaXRDbench provides a reproducible, inspectable framework for evaluating single- and multiphase XRD identification and refinement across simulated and experimental data. It specifies structure-based scoring, sampling conventions, refinement metrics and a portable data and evaluation interface.
- DeltaXRDbench unifies simulated and experimental XRD under a common, inspectable contract for database-independent single- and multiphase identification and refinement evaluation.Predicted structures are accepted independently of any specific phase database.Source: §1.2 · p. 34
- The release contains 62,044 standardized patterns, including 50,000 multiphase examples, with CIF-based ranking metrics, exact-set and macro-averaged multiphase metrics, and refinement-quality scores.The reported identification metrics include Top-1, Top-3, Top-5 and MRR@5 for single-phase predictions, and precision, recall, F1 and coverage for multiphase predictions; refinement reports Rp, Rwp, correlation and a continuous score.Source: §1.2 · p. 34
Data sources and standardization
- MP500 patterns are simulated with randomized broadening, zero shifts, background and intensity-dependent noise, whereas RRUFF and opXRD provide experimental structure–pattern pairs.Patterns use a common 7,001-point grid, baseline subtraction, clipping of negative values and unit-integrated-intensity normalization, while release metadata preserves raw-pattern provenance.Source: §1.2 · p. 35
Multiphase XRD generation
- Multiphase examples mix two or three distinct patterns without replacement, with fractions sampled after reserving at least 0.10 per constituent; mixtures probe peak overlap but omit some experimental nonlinearities.The stated omissions include absorption and microstructural interaction.Source: §1.2 · pp. 35, 37
Task 1: Phase identification
- For phase identification, submissions provide ranked CIFs or phase sets, which are resolved to structures and scored through structural matching rather than database identifiers.Multiphase matches use one-to-one structural matching so each predicted or reference phase can count at most once.Source: §1.2 · p. 37
Identification metrics
- Multiphase metrics are unweighted sample-wise macro averages, and missing, empty, or invalid predictions receive zero scores rather than being excluded.Metrics use all eligible mixtures as the denominator, not pooled phase counts.Source: §1.2 · pp. 40–41
- Precision penalizes extra predicted phases, recall penalizes missed phases, and exact-set recovery requires every phase to match with equal predicted and reference set sizes.A correct phase count alone is insufficient if any structural assignment is wrong.Source: §1.2 · p. 40
Sampling Strategy for Multiphase Evaluation
- The benchmark samples 1,000 multiphase patterns, repeats experiments with three fixed seeds, and reports the arithmetic mean of seed-level metrics without pooling predictions.Each seed uses the complete set of 1,000 eligible mixtures as its denominator.Source: §1.2 · p. 41
Task 2: Refinement assessment
- Refinement assessment interpolates calculated patterns onto the experimental grid and evaluates profile agreement with weighted residual Rwp and Pearson correlation.Approximate Poisson weights are used for Rwp when point-wise uncertainties are unavailable.Source: §1.2 · p. 41
Benchmark implementation
- The reference implementation packages patterns, manifests, and structures, and provides builders, an evaluator, and portable reports with aggregate metrics and sample-level evidence.The reports include evidence of missing predictions and extra phases.Source: §1.2 · p. 41
1.3 XMatcher: search-and-match XRD phase identification
XMatcher combines theoretical-pattern libraries with experimental peak evidence to retrieve and validate phase hypotheses. It also exposes matching evidence for inspection, while its ranking score alone does not establish phase identity.
Access and interpretability
- The open version provides reference data, candidate generation and matching evidence for inspection, reproducibility and further development.The full implementation remains closed-source, while a basic version is available for matching experimental patterns against theoretical peak libraries.Source: §1.3 · p. 42
XMatcher workflow
- XMatcher builds theoretical libraries, preprocesses experimental profiles, retrieves single-phase candidates, fits multiphase hypotheses with AutoMix and validates them against supplied structures.The workflow includes peak detection and whole-pattern validation.Source: §1.3 · p. 42
Evidence reporting
- One-to-one peak assignment leaves unmatched peaks as residual evidence, helping identify observations that support or contradict each candidate.XMatcher retains optimized shifts, peak assignments and unmatched peaks for inspection.Source: §1.3 · pp. 42, 44
Interpretation
- The ranking score H prioritizes hypotheses but does not by itself establish phase identity.Candidates and residual features require inspection.Source: §1.3 · pp. 42, 44
- AutoMix phase contributions describe fitted retained-peak evidence, not Rietveld-refined mass or volume fractions.A required structure ID must exceed the configured minimum contribution, 3% by default.Source: §1.3 · p. 45
1.4 XQueryer Lightweight
XQueryer Lightweight is a compact, composition-guided model for single-phase structure identification from XRD profiles. It uses multiscale frequency views and compact element-guided attention, but requires constituent elements at inference.
Model design
- XQueryer Lightweight combines multiscale frequency-aware peak encoding with compact element-guided cross-attention for structure identification.Four frequency views are produced from the input trace; four compact queries replace a heavy element-to-length-3500 expansion.Source: §1.4 · pp. 45–47
Training and inference
- The model is trained on MP500 and classifies profiles among 100,315 structures by default.Its input profile is interpolated onto the training grid before classification.Source: §1.4 · pp. 46, 48
Data split
- The model uses an XRD-level split: structures occur across folds, but deterministic simulation seeds are disjoint between training, validation and test.The default train, validation and test counts are 20, one and two patterns per structure, respectively.Source: §1.4 · p. 46
Inference scope
- XQueryer-LW requires constituent elements at inference and does not generate predictions when elemental information is unavailable.This differs from the original XQueryer, designed for more general structure-identification settings.Source: §1.4 · p. 48
1.5 XDecomposer: set-based decomposition of multiphase XRD
XDecomposer separates a mixed powder diffraction profile into candidate component profiles before phase identification. Its learned phase-query mechanism supports an unknown phase count without a predefined phase list.
Decomposition objective
- XDecomposer decomposes mixed XRD patterns into component contributions without requiring a predefined candidate-structure list or specified phase count.It uses up to four output slots, each with a predicted component and an activity probability.Source: §1.5 · pp. 49–50
Data preparation
- Training mixtures contain two to four phases, use sampled mixing coefficients constrained to at least 0.15, and are split by crystal ID before mixture construction.The simulated corpus has 2,006,300 patterns generated from 100,315 MP500 structures.Source: §1.5 · p. 50
Diffraction encoding and phase-query modulation
- A hierarchical convolutional encoder and frozen pretrained Transformer feed learnable phase queries that condition component reconstruction through FiLM modulation.The Transformer is pretrained on single-phase profiles using masked reconstruction and then kept fixed during mixture training.Source: §1.5 · pp. 49–51
Component reconstruction
- Independent sigmoid masks assign continuous intensity fractions to components, allowing multiple phases to contribute at overlapping reflections while their sum reconstructs the input.Each predicted component is bounded by the observed intensity at every angular sample.Source: §1.5 · p. 52
1.6 Statistical whole-pattern decomposition with PyXplore
This section presents PyXplore’s EM–Bragg methods for probabilistic whole-pattern decomposition under hard diffraction constraints, including soft assignment of overlapping reflections to peak-shape components. It also covers Bragg-law lattice refinement and mixture-fraction estimation, using a monotonic surrogate for likelihood maximization and alternative intensity-based estimates.
1.6 Statistical whole-pattern decomposition with PyXplore
- PyXplore recasts whole-pattern decomposition as probabilistic inference with hard diffraction constraints to address failures under severe reflection overlap.Classical refinements can produce numerically fragile least-squares solutions and non-physical intensities when reflections overlap.Source: §1.6 · pp. 53–54
- EM–Bragg represents the background-free profile as a mixture of peak-shape functions and uses soft assignments to estimate component responsibilities.The component weights are proportional to integrated intensity.Source: §1.6 · pp. 54–55
- Each peak uses a thin-tailed pseudo-Voigt density combining Lorentzian and Gaussian components, whose widths are independently optimized to accommodate heterogeneous broadening and severe overlap.The Lorentzian component captures diffraction emission, while the Gaussian component accounts for instrumental effects and random noise.Source: §1.6 · p. 54, 𝑦WPEM · p. 57
- Bragg-law constraints guide peak-position updates, while continuous peak-shape functions enable smooth optimization and a physically consistent representation of intensities across the angular range.Initialization uses Bragg’s law and structural constants from an initial structure-identification model.Source: §1.6 · pp. 55–56, 𝑦WPEM · p. 59
Mathematical Construction
- Because Lorentzian mixture terms make direct Q-function maximization intractable, EM–Bragg uses a surrogate lower bound that increases at each iteration.This construction is described as ensuring monotonic convergence of the algorithm.Source: 𝑦WPEM · p. 61
Batch EM–Bragg optimization
- Batch EM–Bragg pools and sorts peaks across mixture components, then refines each component’s lattice parameters independently under Bragg’s law.Updated peaks are mapped back to their component identities and propagated to the next iteration.Source: 𝜇WPEM · pp. 64–65
Volume Fraction Determination
- For mixture-fraction estimation, the section offers strict and approximate intensity-based methods and an integrated-intensity method.Under identical measurement conditions, the Debye–Waller factor is approximated as constant and absorption as proportional to 1/μ.Source: 𝜇WPEM · pp. 66–67
1.7 XRDinspector: a screening layer for PXRD phase identification and refinement assessment
XRDinspector screens PXRD phase hypotheses and refinement outputs by exposing complementary evidence and mapping diagnostics to conservative delivery levels.
1.7 XRDinspector: a screening layer for PXRD phase identification and refinement assessment
- A candidate may match prominent features yet leave measured intensity unexplained, while a physically plausible minor phase may remain below the practical detection limit.The quality layer is designed to expose evidence and limits rather than overstate certainty.Source: §1.7 · p. 67
- XRDinspector accepts observed patterns with complete CIF structures or observed and calculated patterns from external refinement software, then returns an auditable report.The report retains matching counts and phase-wise evidence alongside quality metrics, warnings and settings.Source: §1.7 · pp. 67–68, Figure S3 · p. 68
- For supplied CIFs, predicted reflections are matched to baseline-corrected observed peaks using configurable intensity thresholds, angular distance and 2θ tolerance, with an optional zero shift.The predicted reflections include systematic absences and calculated relative intensities.Source: §1.7 · p. 67
- Four conservative delivery levels distinguish high-confidence pass, provisionally acceptable, uncertain or likely incorrect, and incorrect results; only levels 1 and 2 are deliverable.Level 2 conclusions carry limitations, while levels 3 and 4 are not deliverable as scientific conclusions.Source: §1.7 · p. 68
- Refinement assessment compares interpolated traces over a sufficient common range, reporting Rp, Rwp and correlation, with uncertainty-dependent statistics where available.A maximum relative residual can flag local disagreement even when a global score seems reasonable.Source: Figure S3 · p. 68, §1.7 · p. 69
- Single-phase scoring combines observed-peak coverage, predicted-position precision and positional support; multiphase scoring adds relative-intensity agreement.The multiphase fit uses non-negative least squares, and phase support is averaged so an unsupported minor candidate cannot be concealed by a major phase.Source: §1.7 · pp. 68–69
1.8 Gan Jiang enables evidence-governed refinement across FullProf and GSAS-II
Gan Jiang coordinates refinement through FullProf and GSAS-II while leaving numerical optimization to the crystallographic engines. Its evidence-governed, staged workflow reviews physical plausibility as well as fit diagnostics and preserves a reviewable record.
1.8 Gan Jiang enables evidence-governed refinement across FullProf and GSAS-II
- Refinement proceeds from a focused, testable hypothesis using data, instrument metadata, candidate structures and a scientific objective; unknown samples first require phase-identification evidence.The candidate phase set must be known or supported by prior identification evidence.Source: §1.8 · pp. 70–71
- FullProf and GSAS-II complement the WPEM (PyXplore) engine, with each selected engine retaining responsibility for profile calculation and least-squares optimization.The same reasoning loop connects to the scriptable GSAS-II API.Source: §1.8 · pp. 70, 72
- FullProf tests one explicit hypothesis at a time through reversible stages, inspecting observed, calculated and difference profiles and reverting changes that are unstable or chemically implausible.Strongly correlated quantities are not initially released together, and only parameters stable in earlier stages enter the restricted final cycle.Source: §1.8 · p. 71
- The GSAS-II branch uses immutable inputs and an isolated working directory, recording its plan, project, execution state, fit metrics and any error traceback for reconstruction.The workflow diagram distinguishes ordered refinement stages from decision gates.Source: §1.8 · p. 72, Figure S4 · p. 72
- Acceptance treats fit statistics as diagnostics, additionally reviewing residual profiles, phase identity, structural plausibility, parameter uncertainties and correlated or initialization-sensitive parameters.The review also flags parameters unable to account for systematic misfit.Source: §1.8 · pp. 72–73
- Evidence-governed sequencing prevents reductions in Rwp obtained through non-physical compensation while producing a complete, reviewable record of the refinement trajectory.Gan Jiang coordinates refinement while crystallographic engines perform numerical optimization.Source: §1.8 · pp. 70, 73
Supplementary Note 2 Supplementary results
These supplementary results describe Gan Jiang’s access and interpretation interfaces, structural libraries, and artifact-based workflows for diffraction identification, calculation, and refinement. They also characterize candidate retrieval using co-occurring peak fingerprints and document tool-specific refinement skills and skill-learning case studies.
2.1 Gan Jiang API
- Gan Jiang either autonomously selects and interprets diffraction operations in agent mode or lets users and external programs invoke shared tools directly through the CLI.The agent can sequence steps such as peak detection, candidate retrieval and refinement; CLI callers select individual operations.Source: §2.1 · p. 74
- CLI files are exchanged as artifacts referenced by identifiers, allowing inputs to be reused across operations while retaining their identity and provenance.Derived representations and provenance manifests are stored separately from original files, and the agent uses the same artifact representation as the CLI.Source: §2.1 · pp. 75–76
- Individual CLI operations support peak detection, single- and multiphase matching, learned retrieval and decomposition, and diffraction-pattern calculation from CIF structures.User-supplied CIFs can be passed directly for calculation, without a preceding phase-identification step.Source: §2.1 · p. 76
- Refinement supports GSAS-II, FullProf and PyWPEM/PyXplore backends, runs asynchronously, and returns job references for status checks and retrieval of outputs.Outputs can include refined CIFs, calculated profiles, fit diagnostics and backend-specific summaries.Source: §2.1 · p. 78
- The CLI exposes selected computations, whereas agent mode adds evidence interpretation and iterative decisions; successful execution alone does not establish scientific correctness.In agent mode, Gan Jiang evaluates computational outputs before accepting, revising or rejecting a structural hypothesis.Source: §2.1 · p. 79
2.2 Gan Jiang structural dataset
- MP500 contains 100,315 structures across 84 elements, with ternary (45,132; 45.0%) and four-element (26,974; 26.9%) structures dominating its compositional mix.The dataset is weighted towards ternary and quaternary compositions, a consideration for train–test splits and performance reporting by chemical order.Source: §2.2 · p. 80, Figure S5 · p. 82
- MP500 structures span 1–360 atoms per stored cell (median 20), while the first two composition PCA components explain 25.7% and 5.6% of variance.Cell size refers to stored-cell atom count, not symmetry-inequivalent sites or primitive-cell atom count.Source: §2.2 · pp. 80–81, Figure S5 · p. 82
2.2.1 Experimental dataset
- The experimental candidate library combines 1,159 RRUFF6 structures and 848 opXRD1 + private-data structures (2,007 total), retaining only complete, parseable 3D periodic models.Source: §2.2.1 · p. 82
- The experimental library contains 2,001 distinct CIF checksums and 1,339 reduced compositions, spans 80 elements, and includes cells of 2–496 atoms (median 54).Its structures cover 141 space groups across seven crystal systems; monoclinic records are the largest class (587), followed by orthorhombic (428). RRUFF is enriched in oxygen-bearing mineral systems, while the opXRD + private-data branch has more C-, H-, and N-bearing structures.Source: §2.2.1 · p. 83
2.3 Indexing of Gan Jiang crystal dataset
- Agreement among several peaks in the same diffraction barcode is more discriminative for phase identification than a single peak near a frequently occupied angle.The index links stored theoretical diffraction patterns to source structures for candidate retrieval and later full-pattern examination.Source: §2.3 · pp. 83–84
2.4 Skill learning through refinement case studies
- FullProf’s revised skill specifies a bounded, progressively finer search over Gaussian width and angular zero, with residual and fit-error checks before narrowing the search.The neighborhood radii begin at 0.008° and 0.004°, then reduce to 0.004°/0.002° and 0.002°/0.001°; repeat a resolution if the best point keeps moving.Source: §2.4 · p. 86
- GSAS-II’s skill revision favors staged, individually verified refinements and adds safeguards against saved-project inconsistency and silently ignored parameter overrides.It requires confirmation from run output before claiming an override was applied and added a parameter-response contract.Source: §2.4 · pp. 86–87
- WPEM’s revised workflow skips structure solving by default for known CIFs and adds an explicit response to Bragg-step convergence problems.Structure solving remains available when explicitly requested.Source: §2.4 · pp. 87–88
- For inadequate convergence, verify CIF identity and order, wavelength, range, and peak lists before conservatively adjusting initialization or iteration parameters.For Bragg-step divergence or timeouts on low-symmetry, reflection-rich cells, prefer fixed_cell=true over more iterations.Source: §2.4 · p. 88
- The updated skill recommends three to five EM iterations under the historical 600 s, one-CPU budget, with fixed_cell=true as a suggested override to the false default.It also reinforces default-first, one-group-at-a-time tuning.Source: §2.4 · p. 88
- A training example’s multi-group intervention produced relative L2 ≈0.81, versus approximately 0.23 for defaults.The skill text uses this example to strengthen default-first, one-group-at-a-time tuning.Source: §2.4 · p. 88
Supplementary Note 3 Extended results
Gan Jiang decomposes controlled binary and ternary powder mixtures into phase-resolved profiles while retaining an inspectable connection to the measured patterns. Table S8 reports refined lattice parameters for five phases in an ancient Egyptian cosmetic powder.
Supplementary Note 3 Extended results
- Table S8 reports refined lattice parameters for the five mineral phases identified in the ancient Egyptian cosmetic powder.Parentheses give estimated uncertainties in the final reported digit.Source: Supplementary Note 3 Extended results · p. 89, Table S8 · p. 89
- Recovered component profiles retain characteristic phase reflections, separating overlapping signals while preserving a direct, inspectable connection to the measured pattern.The decomposition fits measured scans, background and phase-resolved contributions for nominal binary and ternary mixtures.Source: Supplementary Note 3 Extended results · p. 89
- Figure S8 shows fits for nominal 2:8 SiO2–TiO2 and 1:1:1 Al2O3–ZnO–NaCl mixtures, with recovered profiles for each phase.Measured scans, fitted backgrounds and phase-resolved contributions are distinguished in the fits.Source: Figure S8 · p. 89, Supplementary Note 3 Extended results · p. 89