1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! X-ray reference data for the elements — a pure-Rust port of
//! [XrayDB](https://github.com/xraypy/XrayDB).
//!
//! The complete database (elements, absorption edges, emission lines, Elam and Chantler
//! cross-sections, Waasmaier–Kirfel form factors) is compiled into the binary as a
//! 3 MB zstd blob and decoded lazily on first use. There are no runtime files to ship
//! and no network access.
//!
//! # Getting started
//!
//! ```
//! use xraydb::{CrossSectionKind, XrayDb};
//!
//! let db = XrayDb::try_new()?;
//!
//! // Element facts
//! assert_eq!(db.atomic_number("Fe")?, 26);
//! assert_eq!(db.symbol("iron")?, "Fe");
//!
//! // Absorption edges
//! assert_eq!(db.xray_edge("Fe", "K")?.energy, 7112.0);
//!
//! // Mass attenuation, single energy
//! let mu = db.mu_elam_at("Fe", 10_000.0, CrossSectionKind::Total)?;
//! assert!(mu > 0.0);
//!
//! // Compounds, by formula and density
//! let mu_water = db.material_mu_at("H2O", 1.0, 10_000.0, CrossSectionKind::Total)?;
//! assert!((mu_water - 5.33).abs() < 0.05);
//! # Ok::<(), xraydb::XrayDbError>(())
//! ```
//!
//! # Scalar and batch forms
//!
//! Every array-valued calculation has an `_at` scalar counterpart that allocates
//! nothing. Prefer the batch form when evaluating many energies at once — it resolves
//! the element and its table rows a single time for the whole slice.
//!
//! ```
//! # use xraydb::{CrossSectionKind, XrayDb};
//! # let db = XrayDb::try_new()?;
//! let energies: Vec<f64> = (0..100).map(|i| 5_000.0 + 100.0 * i as f64).collect();
//! let mu = db.mu_elam("Fe", &energies, CrossSectionKind::Total)?;
//! assert_eq!(mu.len(), energies.len());
//! # Ok::<(), xraydb::XrayDbError>(())
//! ```
//!
//! # Energy clamping
//!
//! Following upstream XrayDB, energies outside a table's range are **clamped** to its
//! endpoints rather than rejected. Use [`XrayDb::elam_energy_range`] and
//! [`XrayDb::chantler_energy_range`] to check before querying.
//!
//! # Features
//!
//! * `optics` — crystal Darwin widths and mirror/multilayer reflectivity
//! ([`optics`]). Adds a dependency on `num-complex`.
//!
//! # Attribution
//!
//! X-ray data from the [XrayDB](https://github.com/xraypy/XrayDB) project by
//! Matt Newville et al., released into the public domain (CC0 1.0).
pub
pub
pub
pub
pub use ChantlerKind;
pub use ;
pub use ComptonEnergies;
pub use XrayDb;
pub use ;
pub use ;
pub use IonChamberFluxes;
pub use RefractiveIndex;
pub use Material;
pub use ;
pub use ;
pub use xraydb_data;