Docs are under construction. Content may be incomplete or change.

tako.xrd Settings

Page type: Reference · Generated from src/script/takoScriptDocs.ts · Verified 2026-07-11T00:00:00.000Z
On this page

This page is generated from code-owned Doxygen-style metadata in src/script/takoScriptDocs.ts. Update that file first, then regenerate this page so runtime capability descriptions, docs, and agent guidance stay aligned.

tako.xrd

Computes geometry-only periodic Bragg sticks or a finite Cartesian-pair Debye curve. The actual returned mode can silently differ from a periodic request when cell or PBC is absent.

Signature: await tako.xrd(structure, { radiation, mode, twoThetaMinDegrees, twoThetaMaxDegrees, twoThetaStepDegrees, scaledIntensities, symmetryRefinement, debyeDampingAngstrom2 })

Theory

  • Periodic XRD applies Bragg diffraction: lattice spacings map to two-theta peak positions for a chosen X-ray wavelength, and structure factors determine relative intensities.
  • Debye scattering uses ordinary finite Cartesian pair distances without periodic replicas or minimum-image wrapping. Its damping is reciprocal-space attenuation, not peak broadening.
  • Periodic intensities assume full occupancy, neutral-atom bundled form factors, zero Debye-Waller factors, and one ideal powder Lorentz-polarization model. Debye form factors are nonzero only for a small hardcoded element set.

Usage Notes

  • Require result.mode === "periodic" when reciprocal-lattice semantics are mandatory; missing cell/PBC silently falls back to Debye.
  • Keep the radiation line fixed when comparing predicted patterns to experiment or between structures.
  • scaledIntensities and symmetryRefinement affect periodic mode only. The viewer normalizes display height independently for both modes.
  • Validate Debye element coverage: only C, N, O, P, S, Cl, Ni, Cu, Pd, Ag, Pt, and Au have nonzero current form factors; H/others contribute zero.

Settings

SettingTypeDefaultValuesUnitValidationDescription
radiationenumCuKaCuKa, CuKa1, CuKa2, CuKb1, MoKa, MoKa1, MoKa2, MoKb1, CrKa, FeKa, CoKa, AgKa, WLa1, WLa2Unknown values normalize to CuKa in TypeScript; unsupported values reaching WASM reject.Single stored source wavelength. Generic Ka choices are averages, not synthesized Ka1/Ka2 doublets.
modeenumperiodicperiodic, debyeUnknown values normalize to periodic. Runtime overrides periodic to Debye when cell or non-none PBC is absent.Requested algorithm. The returned mode is authoritative.
twoThetaMinDegreesnumber5degreesNonfinite values fall back to 5. Negative finite values are accepted, but Debye later rejects negative scattering coordinate.Lower angular bound. Included exactly in the Debye grid; periodic reflections are filtered against it.
twoThetaMaxDegreesnumber90degreesNonfinite values fall back to 90. If not greater than minimum, normalization uses 90 when possible or minimum+1.Reported upper bound. Debye grid may end below it due to nonintegral step or the 20,000-point cap.
twoThetaStepDegreesnumber0.02degreesNonpositive/nonfinite falls back to 0.02; WASM clamps to at least 0.001.Debye sampling interval. Periodic mode ignores it but echoes it in metadata.
scaledIntensitiesbooleantrueBoolean default true; ignored in Debye mode.Periodic only: scale strongest retained merged peak to 100. False remains arbitrary theoretical units, not absolute counts.
symmetryRefinementbooleantrueBoolean default true; ignored in Debye mode. Periodic standardization failure silently falls back to exact input.Periodic only: request spg standardization at fixed 1e-5 internal-bohr tolerance. No standardized structure, space group, or success flag is returned.
debyeDampingAngstrom2number0.04ŲNegative/nonfinite values normalize to 0.04 in TypeScript; WASM clamps residual negative input to zero. Ignored in periodic mode.Debye reciprocal-space exponential attenuation applied once to total intensity; not line broadening or a periodic site Debye-Waller factor.

Example

const crystal = await tako.input("input/powder-candidate.extxyz");
const result = await tako.xrd(crystal, {
  radiation: "CuKa",
  mode: "periodic",
  twoThetaMinDegrees: 5,
  twoThetaMaxDegrees: 80,
  twoThetaStepDegrees: 0.02,
  scaledIntensities: true,
});
await tako.output("output/xrd.json", result);

Result

Discriminated XRD result. Periodic mode returns merged Bragg sticks/families; Debye mode returns sampled finite-pair points. No calculator provenance, settings record, standardized cell, experimental profile, or restart state is returned.

FieldTypeUnitAvailabilityDescription
kind”xrd”Every resolved resultRuntime discriminator.
mode”periodic” | “debye”Every resolved resultActual branch. Debye can result from an explicit request or silent missing-cell/PBC fallback.
radiationstringEvery resolved resultASCII radiation enum label such as CuKa1.
wavelength_angstromnumberÅEvery resolved resultExact stored single-line wavelength used for angle/scattering conversion.
two_theta_range[number, number]degreesEvery resolved resultNormalized reported range. In capped Debye output it can extend beyond the last actual point.
two_theta_step_degreesnumberdegreesEvery resolved resultEffective step after minimum 0.001 clamp; metadata-only in periodic mode.
scaled_intensitiesbooleanPeriodic mode onlyRequested periodic scaling flag.
symmetry_refinementbooleanPeriodic mode onlyRequested periodic standardization flag; not evidence that standardization succeeded.
peaksobject[]Periodic mode only; may be empty when no retained reflection lies in rangeMerged ideal powder sticks sorted by angle.
peaks[].two_theta_degreesnumberdegreesEvery periodic peakBragg angle of the first reflection retained in the merged peak.
peaks[].d_spacing_angstromnumberÅEvery periodic peakInterplanar spacing associated with the retained representative reflection.
peaks[].intensitynumberrelative; 0–100 when scaled, arbitrary otherwiseEvery periodic peakMerged structure-factor × multiplicity × Lorentz-polarization model intensity.
peaks[].familiesobject[]Every periodic peakMetric-grouped reflection families merged at the angle.
peaks[].families[].hkl[integer, integer, integer]Every periodic familyRepresentative Miller index; grouping is metric-based rather than a returned space-group equivalence proof.
peaks[].families[].multiplicityintegerEvery periodic familyCount of enumerated reflections assigned to the family.
pointsobject[]Debye mode only; nonempty for a valid nonnegative gridFinite-cluster Debye curve in increasing sampled angle.
points[].two_theta_degreesnumberdegreesEvery Debye pointSampled angle. Minimum is included; reported maximum is not guaranteed.
points[].intensitynumberraw arbitrary Iwasa/Debye unitsEvery Debye pointUnscaled pair-sum intensity including angular and damping multipliers. Viewer display normalizes and clamps negatives separately.

Errors and Promise Behavior

  • Rejects unsupported radiation, invalid/singular periodic lattice or reciprocal metric, missing periodic scattering parameters, or Debye negative scattering coordinate/invalid numerical input.
  • Requested periodic mode does not reject missing cell/PBC; it resolves through Debye. Require result.mode when branch identity is an invariant.
  • Periodic symmetry standardization failure is silent and falls back to exact input while symmetry_refinement remains true in output.
  • Debye form-factor noncoverage is silent: H and unsupported elements contribute zero rather than rejecting.
  • Cancellation terminates the worker and exposes no partial reflection/pair cache. The complete partialResult event arrives only after branch computation.