Scientific analysis in the browser: XRD and VTNA methods and validation

Numerical validation of browser XRD and VTNA: 39 diffraction inputs, kinetic-fitting arrays, model assumptions, paired timings and reproduction from public data.

Felix Fei

2026-10-01 · Mol2Mat · revision 1

Mol2Mat implements powder X-ray diffraction (XRD) and variable time normalization analysis (VTNA) in the browser. Numerical validation compares XRD peak tables with pymatgen and VTNA normalized times, scores and residuals with Auto-VTNA. The two studies examine input coverage and execution time alongside numerical agreement. The methods and accompanying data specify the scattering model, kinetic-fit assumptions and procedures for reproducing the figures and timing statistics.

In the 10 October 2026 verification, all 39 XRD inputs passed, with a maximum peak-position difference of 1.4211×10⁻¹³°. The independent VTNA check covered 13,436 numerical values, with a maximum absolute difference of 5.1509×10⁻¹¹. Paired warmed silicon tasks fell from a median of 78.2 to 3.5 ms; VTNA scores and residuals show how fitting constraints affect selected reaction orders.

XRD: powder diffraction and validation

Lattice, structure factors and powder intensity

Let the columns of lattice matrix AA be real-space basis vectors, using a reciprocal-lattice convention with the 2π factor omitted. For integer indices h=(h,k,l)\mathbf h=(h,k,l), the reciprocal vector, interplanar spacing and Bragg condition are:

g=A−Th,dhkl=1∥g∥,2dhklsin⁡θ=λ.\mathbf g=A^{-\mathsf T}\mathbf h,\qquad d_{hkl}=\frac{1}{\lVert\mathbf g\rVert},\qquad 2d_{hkl}\sin\theta=\lambda.

Cell lengths and wavelength are in Å; degrees and radians are converted at display and trigonometric boundaries.

Native and TypeScript peak positions and intensities overlap for silicon and rutile.
Figure 1. Synthetic-cell calculations at λ = 1.5406 Å. Blue sticks: native discrete peaks; open circles: TypeScript output.

Atomic scattering factors use pinned element-specific coefficients. With s=sin⁡θ/λs=\sin\theta/\lambda, occupancy ojo_j and fractional position rj\mathbf r_j:

fj(s)=Zj−41.78214s2∑m=14ajmexp⁡(−bjms2),Fhkl=∑jojfj(s)exp⁡(2πih ⁣⋅ ⁣rj).f_j(s)=Z_j-41.78214s^2\sum_{m=1}^{4}a_{jm}\exp(-b_{jm}s^2),\qquad F_{hkl}=\sum_j o_jf_j(s)\exp(2\pi i\mathbf h\!\cdot\!\mathbf r_j).

Species sharing a site contribute coherently through their own scattering factors and occupancies; vacancies contribute zero scattering.

After accumulating reflections at the same angle, the calculation uses the reference Lorentz–polarization factor:

Ihkl∝∣Fhkl∣21+cos⁡2(2θ)sin⁡2θcos⁡θ.I_{hkl}\propto |F_{hkl}|^2\frac{1+\cos^2(2\theta)}{\sin^2\theta\cos\theta}.

The largest peak across the reference range is normalized to 100. Figure 1 displays calculated discrete reflections of synthetic cells, with heights in relative-intensity units.

Reference inputs and calculation domain

The double-precision TypeScript kernel uses pymatgen 2026.9.23 XRDCalculator as its reference. The 39 frozen inputs comprise 19 accepted results, including two empty peak intervals, and 20 expected rejections. They cover silicon, gold, rutile, hexagonal titanium, a triclinic cell, mixed occupancies, repeated sites, vacancies, wavelength changes and the 200-site limit.

Accepted, expected-rejection and empty-interval counts for 39 computational fixtures.
Figure 2. Thirty-nine frozen inputs: 19 accepted and 20 expected rejections. Accepted results include 17 nonempty patterns and two empty intervals. Counts are computational fixtures.

Reflections are filtered by their reciprocal-vector lengths, with Friedel symmetry and reuse of elemental scattering factors reducing repeated work. Peak merging uses 10⁻⁵° bins and ties-to-even rounding, with a 0.001 % intensity cutoff. Enumeration and normalization cover 0–150° before cropping the requested interval. The original lattice, coordinates and occupancies are retained, with symprec=0 by default.

Dense peak tables and boundary cases

The triclinic fixture contains 856 discrete peaks and tests general reciprocal lattices and family merging. Replay also covers either side of the intensity cutoff, cropping at the first peak and rejection reasons. Each input retains its native peak table, reference timing and SHA-256 identity.

Peak counts range from zero to 856 across 19 native outputs.
Figure 3. Actual peak counts for 19 accepted native outputs, covering intensity thresholds and crop boundaries. Raw data provide each cell, wavelength and angle range. Both empty intervals are labelled zero.

Peak-by-peak numerical agreement

Acceptance compares individual peaks. Peak counts, membership and hklhkl family sets must agree; 2θ2\theta, d and relative intensity use the pre-existing absolute tolerances below. The intensity tolerance applies to the 0–100 numerical scale.

All three numerical fields remain below their acceptance limits across the fixture corpus.
Figure 4. Nineteen accepted fixtures include two empty intervals. The ordinate is maximum error / fixed tolerance; the logarithmic axis displays positive differences. Peak membership and hkl families receive exact checks.
Table 1. Fixed tolerances and maximum differences
FieldAbsolute toleranceMaximum absolute difference
2θ / °1×10⁻⁶1.4211 × 10⁻¹³
d / Å1×10⁻⁷1.7764 × 10⁻¹⁵
Relative intensity / 0–1001×10⁻⁴9.9476 × 10⁻¹⁴
Peak membership, hkl familiesExactAll equal

Across the 19 accepted inputs, maximum differences in angle, spacing and intensity are 1.4211×10⁻¹³°, 1.7764×10⁻¹⁵ Å and 9.9476×10⁻¹⁴. All 39 tests pass, including expected rejections. The plotted differences show that the two double-precision programs give closely matching results for the same structure. The accuracy of the structural parameters depends on their source and measurement conditions.

Product exports additionally contain six calculated peaks for COD 1512541 and 14 for JARVIS dft_3d_JVASP-1002. The maximum angular difference from native pymatgen is 2.8422×10⁻¹⁴° in both cases. Peak tables are calculated from each record’s lattice, atomic coordinates and occupancies, with source identities and input hashes retained. [2, 3, 4]

Paired measurements of the warmed silicon task

Old and new distribution Workers alternate the silicon fixture in the same macOS Chromium session, with one warmup and three measured trials per version. Old observations are 77.1, 78.2 and 79.3 ms; new observations are 3.5, 3.5 and 2.4 ms. The median falls from 78.2 to 3.5 ms, a 95.5 % reduction and approximately 74.7 ms saved. [5]

Optimized Worker tasks take less time with identical scientific outputs.
Figure 5. 2026-10-10, macOS Chromium. Alternating old/new distributions, one warmup and n = 3 each. Timing covers task submission through result transfer, including protocol, progress and calculation. Bars: medians; points: observations.
Table 2. Paired medians under a common timing boundary, n = 3
InputBefore / msAfter / msTime reduction
silicon78.23.595.5 %

Both versions retain all 21 progress events and identical scientific fields; device-self-test time is the sole field removed from comparison. Seventeen current distribution checks cover Worker protocol, storage, domain and numerics. Cancellation takes approximately 1.1 ms and retry succeeds. All 39 frozen fixtures retain their original position, spacing and intensity tolerances.

Timing covers submission, computation, progress notifications and result delivery in a warmed Worker. Reproduction uses identical inputs, initialization state and complete-task boundaries; individual timings determine the plotted median and range.

Historical costs for different inputs

Enumeration cost depends jointly on reciprocal-space candidates and site count. The current domain is an explicit three-dimensionally periodic cell with 1–200 sites, wavelength 0.5–3 Å and angle intervals within 5–150°. The integer box permits up to 250000 candidates and candidates times sites up to 5000000. Large cells can produce dense reciprocal points even with few atoms.

Historical single observations give approximately 1.89 ms for the silicon Node kernel and 9.11 ms for native Python; the 200-site fixture takes approximately 27.89 and 35.31 ms. The table preserves these n=1n=1 cost records, with each native and Node timing entry point available in the data.

Product receipts record task times of 0.135 s for COD and 0.081 s for JARVIS. Independent Python verification also includes work such as initialization, so these records measure different processes. The preceding section's paired measurements, from task submission to result transfer, establish the optimization's effect. Historical records describe the cost of different inputs.

Table 3. Single development-machine timings, n = 1
FixtureNode / msPython / ms
silicon1.8949.111
rutile-noncubic0.5483.795
triclinic4.8068.720
200-sites27.88635.311

Structure and experimental conditions

The calculation uses the kinematic approximation, real normal atomic scattering factors and an occupancy-averaged structure. Real scattering factors give equal Friedel-pair intensities; partial site occupancies enter Bragg reflections through coherently averaged amplitudes. The output consists of discrete peaks normalized over the specified range, suitable for structural previews and reference peak-table reproduction. Experimental-pattern modelling additionally considers anomalous scattering, thermal motion, defects and disorder, preferred orientation, line shape, background and instrument response.

VTNA: reaction-order analysis and validation

Concentration normalization and the time axis

Reaction-progress curves usually advance at different rates when initial concentrations change. Variable Time Normalization Analysis (VTNA) rescales time with candidate concentration powers to find reaction orders that bring these curves into alignment. Overlay quality contributes to kinetic interpretation alongside temperature, material balances, catalyst state and experimental design. [6, 7]

For an apparent rate law v=k∏jcjnjv=k\prod_j c_j^{n_j}, continuous normalized time for the selected species is τ(t)=∫0t∏jcj(u)nj du\tau(t)=\int_0^t\prod_j c_j(u)^{n_j}\,du. At fixed powers, experiments sharing a progress function may approach an overlay, provided their conditions and progress definitions are comparable.

The numerical core first computes concentration midpoints, then applies powers and accumulates:

τi=∑k=0i−1(tk+1−tk)∏j(cj,k+1+cj,k2)nj.\tau_i=\sum_{k=0}^{i-1}(t_{k+1}-t_k)\prod_j\left(\frac{c_{j,k+1}+c_{j,k}}{2}\right)^{n_j}.

This generally differs from applying powers before trapezoidal integration. Fractional and negative orders and sparse sampling can amplify the difference, making the discrete integration sequence part of the porting comparison.

Time is standardized to s and concentration to M, giving normalized-time units of s M∑jnj\mathrm{s}\,\mathrm{M}^{\sum_j n_j}. Input checks cover time ordering and the domain of concentration powers. Provenance, initial concentrations, temperature, solvent and unit conversions are preserved with the result.

Fitting constraints and selected orders

Curves share the same alignment and concentration scaling; normalized time is scaled consistently before global fitting. Through-origin, polynomial and monotonic constrained polynomial models use all experimental points in the score:

RMSE⁡(n)=1N∑r,i(yr,iscaled−y^(τr,i;n))2.\operatorname{RMSE}(\mathbf n)=\sqrt{\frac{1}{N}\sum_{r,i}\left(y^{\mathrm{scaled}}_{r,i}-\hat y(\tau_{r,i};\mathbf n)\right)^2}.

The score is in scaled-concentration units. Measurement uncertainty and statistical likelihood require a separate error model.

Two simulated curves after concentration-power normalization, with overlapping native and browser fit points.
Figure 6. Two synthetic sparse concentration profiles. Native and browser fits share inputs, orders and monotonic constraints; the discrete fit selects nA=1.22n_A=1.22.

The order search evaluates a coarse grid, refines promising regions and retains scores for all evaluated points. Refitting at the selected order verifies agreement with the search score. For this synthetic input, monotonic and ordinary polynomial fits select 1.22, while through-origin fitting selects 0.80; both implementations make the same selections. The comparison quantifies the influence of fitting constraints on the selected apparent order.

Scores and independent array verification

The frozen reference contains 32 fixtures and solver-path outputs. Field-level comparison covers array lengths, fields, strings, booleans, normalized times, selected orders, score surfaces, fitted curves, residuals and warnings. Solver parameters must agree exactly. [8]

Discrete RMSE curves match between implementations, while the selected order depends on the fitting model.
Figure 7. Lines: native; open markers: browser. All 11 evaluated points are shown. Monotonic and polynomial fits select 1.22; through-origin fitting selects 0.80.
Table 4. Numerical verification boundaries
ItemRule or result
Frozen fixtures32
Numbers compared13436
Score / RMSE tolerance1×10⁻⁷
Other numerical tolerance1×10⁻⁹ + 1×10⁻⁷ |native|
Maximum absolute difference5.150946336129891×10⁻¹¹
Confirmed tied optima0
Explicit out-of-domain rejections4

Scores and overlay RMSE use an absolute tolerance of 10⁻⁷; other numbers use ∣xb−xn∣≤10−9+10−7∣xn∣|x_b-x_n|\leq10^{-9}+10^{-7}|x_n|. Selected optima agree throughout this corpus. Across 13436 values, the maximum absolute difference is 5.1509×10⁻¹¹, in a scaled residual of the 500-observation fixture.

The archived probe’s overall status is blocked and the independent field-level verification reports numeric-passed; both records are preserved separately. Four out-of-domain fixtures retain native results and verify the corresponding browser domain limitations. This checks both in-domain fitting and out-of-domain handling.

Two product exports additionally cover 3,610 numerical values, with a maximum difference of 8.8818×10⁻¹⁶. The offline record uses a fully cached runtime and dependencies.

Residuals and order sensitivity

The residual figure makes these effects visible. Changing the fitting method changes the selected order, while native and browser residuals nearly coincide within each method. Pointwise residuals and score curves help distinguish differences caused by fitting assumptions from numerical differences introduced by the port.

Residuals and selected orders for three fits, with native and browser values coinciding point by point.
Figure 8. The same synthetic input. Lines: native; open markers: browser; colours distinguish the two experiments. The abscissa is original time and the ordinate is scaled-concentration residual. Each model uses its own selected order.

The score envelope retains searched points satisfying S≤Smin⁡(1+ε)+10−14S\leq S_{\min}(1+\varepsilon)+10^{-14}, describing order sensitivity on the specified grid and threshold. Interpretation also uses the initial-concentration design, confounding caused by jointly varied species, material balance and same-excess information. Statistical confidence intervals require experimental replication and a measurement-error model.

Solver settings and execution costs

The numerical core is pinned to Auto-VTNA 1.2.4 and revision 4acdbd53bc38f33e2ba2fa8f50a7ba3fad93c88d. The browser uses Pyodide 314.0.7, Python 3.14.2, polyfit 1.0, OSQP 1.1.3 and SCS 3.3.1. OSQP retains eps_abs=eps_rel=10⁻⁸; the SCS fallback uses eps=10⁻⁴ and max_iters=100000. Normal execution, fallback, retry and full-chain failure all have retained verification records.

The browser monotonic fit takes approximately 1.2194 seconds; polynomial and through-origin fits approximately 0.006 seconds.
Figure 9. Development-machine native and Chromium records from 2026-10-06, n = 1, including each path’s initialization and solving work. Asset loading is timed separately.
Table 5. Single synthetic-fixture wall times, n = 1
FitNative / sBrowser / sSelected order
monotonic0.0280841.21941.22
polynomial0.0020070.00621.22
origin0.0040250.00650.80

The Python scientific runtime and solvers require about 52.3 MiB of assets. In the Chromium test, runtime loading takes 3.2695 s and all dependencies are ready at 3.2798 s, measured from the same starting point. WASM linear memory is 234749952 bytes, approximately 223.9 MiB. The browser process also uses memory for JavaScript objects and other allocations.

For the same synthetic input, monotonic, polynomial and through-origin browser fits take approximately 1.2194, 0.0062 and 0.0065 s. Figure 9 also shows native times, with one measurement per record. Each fitting path includes different initialization and solver work, so Figure 9 describes the cost of these executions. Comparing repeated performance requires the same initialization state.

Task isolation and cancellation follow the shared execution section. VTNA retains the measured costs of each solver path and runtime loading.

Input domain and kinetic interpretation

The browser domain permits 2–4 experiments, up to 500 observations, 1–2 normalized species, polynomial degrees 1–5 and up to 61 score evaluations, with observations times evaluations capped at 21000 and positive residual degrees of freedom. Tasks have a 120 s wall limit and a 768 MiB admission-memory estimate. Out-of-domain inputs return explicit reasons while grids, refinement and solver settings retain their definitions.

Covarying initial concentrations confound order combinations. Narrow concentration ranges, low signal-to-noise ratios, mixing and mass-transfer control can also produce similar overlays. Catalyst deactivation, product inhibition and reversibility require additional experiments and kinetic models.

Data and reproduction

Saved XRD and VTNA results can be independently verified from the public gzip JSON and CSV files. XRD data contain 39 fixed inputs and native/browser peak tables. Pairing peak membership and hklhkl families permits separate calculation of differences in 2θ2\theta, d and relative intensity, together with checks of 19 accepted results and 20 expected rejections. optimization.json and optimization.csv provide warmup markers, individual timings and output-agreement records for recalculating paired silicon-task medians and time reductions.

VTNA data provide original inputs, normalized times, scores, fitted curves and pointwise residuals. Curves are reconstructed using the recorded discrete-integration order, concentration scaling, grid and fitting constraints, then compared with the field-specific tolerances reported here. Repeating XRD uses the pinned pymatgen and scattering coefficients; VTNA uses the pinned Auto-VTNA, numerical dependencies and solver configuration. Public attachments support reproduction of saved arrays, figures and statistics.

Data and sources

  1. pymatgen: XRDCalculator and powder diffraction model
  2. Mol2Mat: archived XRD evidence and source identities
  3. Crystallography Open Database: theoretical Si record 1512541
  4. NIST JARVIS-DFT: structural data and calculation provenance
  5. Mol2Mat: paired real-Worker scheduling and state-reuse measurements, 2026-10-10
  6. D. Dalland, L. Schrecker, K. K. Hii. Auto-VTNA: an automatic VTNA platform for determination of global rate laws. Digital Discovery 3, 2118–2129 (2024). doi:10.1039/D4DD00111G
  7. J. Burés. Variable Time Normalization Analysis: General Graphical Elucidation of Reaction Orders from Concentration Profiles. Angewandte Chemie International Edition 55, 16084–16087 (2016). doi:10.1002/anie.201609757
  8. Mol2Mat: frozen VTNA sources, browser arrays and verification
  9. Auto-VTNA upstream source and usage documentation
  10. Pyodide: Python scientific runtime for WebAssembly